- shogi_server/board.rb, piece.rb: Refactoring to cache OU pieces,
which was inspired by 81SquareShogi-server's change
(74b24b88c843f1dd767412475b117481d1d5e8eb).
+ - Added shogi-server-profile to take profile of shogi-server.
* [mk_rate] [mk_game_results]
- Supports Ruby 1.9.3.
--- /dev/null
+#! /usr/bin/ruby1.9.1
+# $Id$
+#
+# Author:: Daigo Moriwaki
+# Homepage:: http://sourceforge.jp/projects/shogi-server/
+#
+#--
+# Copyright (C) 2011 Daigo Moriwaki (daigo at debian dot org)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#++
+#
+# == Synopsis
+#
+# shogi-server-profile is a wrapper of shogi-server to take profile, which
+# is only used by Shogi-server developers.
+#
+#
+# == Usage
+#
+# Same as shogi-server.
+#
+# == PREREQUIRE
+#
+# Sample Command lines that isntall prerequires will work on Debian.
+#
+# * {ruby-prof}[http://rubyforge.org/projects/ruby-prof/]
+#
+# $ sudo gem1.9.1 install ruby-prof
+#
+# == Run
+#
+# Same as shogi-server. It will result in a profile log file (calltree.log),
+# which can be read by KCacheGrind.
+#
+
+require 'ruby-prof'
+load 'shogi-server'
+
+
+if ($0 == __FILE__)
+ STDOUT.sync = true
+ STDERR.sync = true
+ TCPSocket.do_not_reverse_lookup = true
+ Thread.abort_on_exception = $DEBUG ? true : false
+
+ begin
+ result = RubyProf.profile do
+ main
+ end
+ printer = RubyProf::CallTreePrinter.new(result)
+ f = File.open("calltree.log", "w")
+ printer.print(f, {})
+ rescue Exception => ex
+ if $logger
+ log_error("main: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}")
+ else
+ $stderr.puts "main: #{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
+ end
+ end
+end
+