mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
profiler.rb: block calls
* lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): add b_call and b_return to profile block calls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0d7a197175
commit
9ed4d1ab8c
2 changed files with 6 additions and 3 deletions
|
@ -1,4 +1,7 @@
|
||||||
Sun Feb 3 09:37:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Feb 3 09:38:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): add b_call
|
||||||
|
and b_return to profile block calls.
|
||||||
|
|
||||||
* lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): split
|
* lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): split
|
||||||
PROFILE_PROC for call and return events.
|
PROFILE_PROC for call and return events.
|
||||||
|
|
|
@ -76,12 +76,12 @@ module Profiler__
|
||||||
@@start = nil # the start time that profiling began
|
@@start = nil # the start time that profiling began
|
||||||
@@stacks = nil # the map of stacks keyed by thread
|
@@stacks = nil # the map of stacks keyed by thread
|
||||||
@@maps = nil # the map of call data keyed by thread, class and id. Call data contains the call count, total time,
|
@@maps = nil # the map of call data keyed by thread, class and id. Call data contains the call count, total time,
|
||||||
PROFILE_CALL_PROC = TracePoint.new(:call, :c_call) {|tp| # :nodoc:
|
PROFILE_CALL_PROC = TracePoint.new(*%i[call c_call b_call]) {|tp| # :nodoc:
|
||||||
now = Process.times[0]
|
now = Process.times[0]
|
||||||
stack = (@@stacks[Thread.current] ||= [])
|
stack = (@@stacks[Thread.current] ||= [])
|
||||||
stack.push [now, 0.0]
|
stack.push [now, 0.0]
|
||||||
}
|
}
|
||||||
PROFILE_RETURN_PROC = TracePoint.new(:return, :c_return) {|tp| # :nodoc:
|
PROFILE_RETURN_PROC = TracePoint.new(*%i[return c_return b_return]) {|tp| # :nodoc:
|
||||||
now = Process.times[0]
|
now = Process.times[0]
|
||||||
key = Wrapper.new(tp.defined_class, tp.method_id)
|
key = Wrapper.new(tp.defined_class, tp.method_id)
|
||||||
stack = (@@stacks[Thread.current] ||= [])
|
stack = (@@stacks[Thread.current] ||= [])
|
||||||
|
|
Loading…
Reference in a new issue