Class: Tracy
- Inherits:
-
Object
- Object
- Tracy
- Defined in:
- lib/tracy.rb
Instance Method Summary collapse
- #done ⇒ Object
-
#initialize ⇒ Tracy
constructor
A new instance of Tracy.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Tracy
Returns a new instance of Tracy.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tracy.rb', line 6 def initialize @callers = Hash.new { |hash, key| hash[key] = {} } @trace = TracePoint.new(:call, :line) do |tp| case tp.event when :call @callers[data_array(tp)][@current_location] = 1 when :line @current_location = data_array(tp) end end end |
Instance Method Details
#done ⇒ Object
22 23 24 25 |
# File 'lib/tracy.rb', line 22 def done @trace.disable File.write("callsite-info.yml", YAML.dump(@callers)) end |
#start ⇒ Object
18 19 20 |
# File 'lib/tracy.rb', line 18 def start @trace.enable end |