4 # Author:: Daigo Moriwaki
5 # Homepage:: http://sourceforge.jp/projects/shogi-server/
8 # Copyright (C) 2011-2012 Daigo Moriwaki (daigo at debian dot org)
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 # shogi-server-profile is a wrapper of shogi-server to take profile, which
28 # is only used by Shogi-server developers.
33 # Same as shogi-server.
37 # Sample Command lines that isntall prerequires will work on Debian.
39 # * {ruby-prof}[http://rubyforge.org/projects/ruby-prof/]
41 # $ sudo gem1.9.1 install ruby-prof
45 # Same as shogi-server. It will result in a profile log file (calltree.log),
46 # which can be read by KCacheGrind.
56 TCPSocket.do_not_reverse_lookup = true
57 Thread.abort_on_exception = $DEBUG ? true : false
60 result = RubyProf.profile do
63 printer = RubyProf::CallTreePrinter.new(result)
64 f = File.open("calltree.log", "w")
66 rescue Exception => ex
68 log_error("main: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}")
70 $stderr.puts "main: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"