diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-17 08:58:21 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-03-17 08:58:21 +0000 |
| commit | b54db8568cae6f5be8b98977a82d11df2d5c8c73 (patch) | |
| tree | b7027454a641e7c51404b316cb9b0b28f66acd3d /lib/profile.rb | |
| parent | 8f043b64fb245bb4ce6748850f77e1ff48d97fa5 (diff) | |
| download | ruby-b54db8568cae6f5be8b98977a82d11df2d5c8c73.tar.gz ruby-b54db8568cae6f5be8b98977a82d11df2d5c8c73.tar.xz ruby-b54db8568cae6f5be8b98977a82d11df2d5c8c73.zip | |
2000-03-17
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/profile.rb')
| -rw-r--r-- | lib/profile.rb | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/profile.rb b/lib/profile.rb index e4b1b4b18..d94b09da9 100644 --- a/lib/profile.rb +++ b/lib/profile.rb @@ -3,7 +3,7 @@ module Profiler__ Start = Float(Time.times[0]) top = "toplevel".intern Stack = [[0, 0, top]] - MAP = {top => [1, 0, 0, "#toplevel"]} + MAP = {"#toplevel" => [1, 0, 0, "#toplevel"]} p = proc{|event, file, line, id, binding, klass| case event @@ -13,17 +13,18 @@ module Profiler__ when "return", "c-return" now = Float(Time.times[0]) tick = Stack.pop - data = MAP[id] + name = klass.to_s + if name.nil? then name = '' end + if klass.kind_of? Class + name += "#" + else + name += "." + end + name += id.id2name + data = MAP[name] unless data - name = klass.to_s - if name.nil? then name = '' end - if klass.kind_of? Class - name += "#" - else - name += "." - end - data = [0.0, 0.0, 0.0, name+id.id2name] - MAP[id] = data + data = [0.0, 0.0, 0.0, name] + MAP[name] = data end data[0] += 1 cost = now - tick[0] @@ -36,7 +37,7 @@ module Profiler__ set_trace_func nil total = Float(Time.times[0]) - Start if total == 0 then total = 0.01 end - MAP[:toplevel][1] = total + MAP["#toplevel"][1] = total # f = open("./rmon.out", "w") f = STDERR data = MAP.values.sort!{|a,b| b[2] <=> a[2]} |
