sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 79785b2955277c520e37bf0488c01d32cfc7ea33
parent bbccaef8f7db2827edfdb1ef675f1af32e2867d2
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date:   Sat, 23 Jan 2010 19:16:00 -0800

enable ruby-prof with SUP_PROFILE environment variable

If SUP_PROFILE is set, it's used as the filename to dump profiling output
which you can use kcachegrind to inspect.

Diffstat:
M bin/sup | 10 ++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -14,6 +14,11 @@ require 'fileutils'
 require 'trollop'
 require "sup"; Redwood::check_library_version_against "git"
 
+if ENV['SUP_PROFILE']
+  require 'ruby-prof'
+  RubyProf.start
+end
+
 if no_ncursesw
   debug "No 'ncursesw' gem detected. Install it for wide character support."
 end
@@ -395,6 +400,11 @@ ensure
   end
 
   Index.unlock
+
+  if (fn = ENV['SUP_PROFILE'])
+    result = RubyProf.stop
+    File.open(fn, 'w') { |io| RubyProf::CallTreePrinter.new(result).print(io) }
+  end
 end
 
 unless Redwood::exceptions.empty?