• R/O
  • HTTP
  • SSH
  • HTTPS

shogi-server:

shogi-server source


File Info

Rev. 6e9f2816b581e6b6100b3df25700cd3b28ee9a7c
Size 1,973 bytes
Time 2020-10-04 11:33:03
Author Daigo Moriwaki
Log Message

Bump up revision

Content

#! /usr/bin/ruby
# $Id$
#
# Author:: Daigo Moriwaki
# Homepage:: http://sourceforge.jp/projects/shogi-server/
#
#--
# Copyright (C) 2011-2012 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 gem 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

Show on old repository browser