diff options
Diffstat (limited to 'ext/probeprofiler/lib')
-rw-r--r-- | ext/probeprofiler/lib/probeprofile.rb | 7 | ||||
-rw-r--r-- | ext/probeprofiler/lib/probeprofiler.rb | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/ext/probeprofiler/lib/probeprofile.rb b/ext/probeprofiler/lib/probeprofile.rb new file mode 100644 index 0000000000..f5ff40d2cc --- /dev/null +++ b/ext/probeprofiler/lib/probeprofile.rb @@ -0,0 +1,7 @@ +require 'probeprofiler'
+END{
+ ProbeProfiler.stop_profile
+ ProbeProfiler.print_profile
+}
+
+ProbeProfiler.start_profile
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
+
|