Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable
@ 2010-01-24  3:16 Rich Lane
  2010-01-24  3:22 ` Anthony Martinez
  2010-02-27  7:45 ` Rich Lane
  0 siblings, 2 replies; 3+ messages in thread
From: Rich Lane @ 2010-01-24  3:16 UTC (permalink / raw)
  To: sup-devel

If SUP_PROFILE is set, it's used as the filename to dump profiling output
which you can use kcachegrind to inspect.
---
 bin/sup |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/bin/sup b/bin/sup
index 7824aca..f7c4af7 100755
--- 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
@@ -379,6 +384,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?
-- 
1.6.3.3

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable
  2010-01-24  3:16 [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable Rich Lane
@ 2010-01-24  3:22 ` Anthony Martinez
  2010-02-27  7:45 ` Rich Lane
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Martinez @ 2010-01-24  3:22 UTC (permalink / raw)
  To: sup-devel

Excerpts from Rich Lane's message of Sat Jan 23 20:16:00 -0700 2010:
> If SUP_PROFILE is set, it's used as the filename to dump profiling output
> which you can use kcachegrind to inspect.

Excellent. I could use this to track down why it's taking forever to load a
20,000 line message :)

-- 
If Java had true garbage collection, most programs would delete themselves upon execution.
-- Robert Sewell
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable
  2010-01-24  3:16 [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable Rich Lane
  2010-01-24  3:22 ` Anthony Martinez
@ 2010-02-27  7:45 ` Rich Lane
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Lane @ 2010-02-27  7:45 UTC (permalink / raw)
  To: sup-devel

Applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-27  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-24  3:16 [sup-devel] [PATCH] enable ruby-prof with SUP_PROFILE environment variable Rich Lane
2010-01-24  3:22 ` Anthony Martinez
2010-02-27  7:45 ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox