diff options
Diffstat (limited to 'ext/probeprofiler/lib/probeprofiler.rb')
-rw-r--r-- | ext/probeprofiler/lib/probeprofiler.rb | 14 |
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
+
|