summaryrefslogtreecommitdiff
path: root/ext/probeprofiler/lib/probeprofiler.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-25 03:50:00 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-25 03:50:00 +0000
commitabcbd7ea38f64f942a934ba065aabf9da81a21bc (patch)
tree8bf33e560f4c99904d36a1f0681bf5c2ebd34dae /ext/probeprofiler/lib/probeprofiler.rb
parent354844be45efe799031b1a9799e8c6d52cc6b16d (diff)
* yarvcore.h: remove rb_control_frame_t#callee_id.
* vm_macro.def: ditto. * eval_intern.h (exec_event_hooks): fix to check event flags * eval_intern.h (EXEC_EVENT_HOOK): fix to re-check event flags. * ext/probeprofiler : added. this profiler is sampling based profiler. * vm.c: add rb_thread_current_status() API for probeprofiler. * thread.c (rb_thread_execute_interrupts): add comments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/probeprofiler/lib/probeprofiler.rb')
-rw-r--r--ext/probeprofiler/lib/probeprofiler.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/probeprofiler/lib/probeprofiler.rb b/ext/probeprofiler/lib/probeprofiler.rb
new file mode 100644
index 0000000000..e014adda2f
--- /dev/null
+++ b/ext/probeprofiler/lib/probeprofiler.rb
@@ -0,0 +1,14 @@
+
+require 'probeprofiler.so'
+
+def ProbeProfiler.print_profile
+ data = ProbeProfiler.profile_data
+ total = 0.0
+ printf("%-60s %-8s %-7s\n", "ProbeProfile Result: Method signature", "count", "ratio")
+ data.map{|k, n| total += n; [n, k]}.sort.reverse.each{|n, sig|
+ #
+ printf("%-60s %8d %7.2f%%\n", sig, n, 100 * n / total)
+ }
+ printf("%60s %8d\n", "total:", total)
+end
+