4 # Adapted from Shugo Maeda's unprof.rb
5 def self.print_profile(results
, io
= $stderr)
6 total
= results
.detect
{ |i
|
7 i
.method_class
.nil? && i
.method_id
== :"#toplevel"
9 total
= 0.001 if total
< 0.001
11 io
.puts
" %% cumulative self self total"
12 io
.puts
" time seconds seconds calls ms/call ms/call name"
18 name
= if r
.method_class
.nil?
20 elsif r
.method_class
.is_a
?(Class
)
21 "#{r.method_class}##{r.method_id}"
23 "#{r.method_class}.#{r.method_id}"
25 io
.printf
"%6.2f %8.3f %8.3f %8d %8.2f %8.2f %s\n",
26 r
.self_time
/ total
* 100,
30 r
.self_time
* 1000 / r
.count
,
31 r
.total_time
* 1000 / r
.count
,