aboutsummaryrefslogtreecommitdiffstats
path: root/lib/profile.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-17 08:58:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-17 08:58:21 +0000
commit5c13dd59db1ee6c04cdac4ce2ee97d5934115439 (patch)
treeb7027454a641e7c51404b316cb9b0b28f66acd3d /lib/profile.rb
parentd8f981b972aab02d1432abe1c9cadf0507945e77 (diff)
downloadruby-5c13dd59db1ee6c04cdac4ce2ee97d5934115439.tar.gz
2000-03-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/profile.rb')
-rw-r--r--lib/profile.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/profile.rb b/lib/profile.rb
index e4b1b4b189..d94b09da9e 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]}