Class: ProfilerDB

Inherits:
Object
  • Object
show all
Includes:
TimeHelpers
Defined in:
lib/shoes/profiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TimeHelpers

#cpu_time, #wall_time

Constructor Details

#initializeProfilerDB

Returns a new instance of ProfilerDB.



171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/shoes/profiler.rb', line 171

def initialize
  nodes = {}
  links = {}
  file = ''
  load_wall_st = 0
  load_wall_end = 0
  prof_wall_st = 0
  prof_wall_end = 0
  cpu_st = 0
  cpu_end = 0
  outdev = $stderr
  outfl = 0
end

Instance Attribute Details

#add_c_callsObject

Returns the value of attribute add_c_calls.



168
169
170
# File 'lib/shoes/profiler.rb', line 168

def add_c_calls
  @add_c_calls
end

#cpu_endObject

Returns the value of attribute cpu_end.



170
171
172
# File 'lib/shoes/profiler.rb', line 170

def cpu_end
  @cpu_end
end

#cpu_stObject

Returns the value of attribute cpu_st.



170
171
172
# File 'lib/shoes/profiler.rb', line 170

def cpu_st
  @cpu_st
end

#fileObject

Returns the value of attribute file.



168
169
170
# File 'lib/shoes/profiler.rb', line 168

def file
  @file
end

Returns the value of attribute links.



168
169
170
# File 'lib/shoes/profiler.rb', line 168

def links
  @links
end

#load_wall_endObject

Returns the value of attribute load_wall_end.



169
170
171
# File 'lib/shoes/profiler.rb', line 169

def load_wall_end
  @load_wall_end
end

#load_wall_stObject

Returns the value of attribute load_wall_st.



169
170
171
# File 'lib/shoes/profiler.rb', line 169

def load_wall_st
  @load_wall_st
end

#nodesObject

Returns the value of attribute nodes.



168
169
170
# File 'lib/shoes/profiler.rb', line 168

def nodes
  @nodes
end

#outdevObject

Returns the value of attribute outdev.



170
171
172
# File 'lib/shoes/profiler.rb', line 170

def outdev
  @outdev
end

#outflObject

Returns the value of attribute outfl.



170
171
172
# File 'lib/shoes/profiler.rb', line 170

def outfl
  @outfl
end

#prof_wall_endObject

Returns the value of attribute prof_wall_end.



169
170
171
# File 'lib/shoes/profiler.rb', line 169

def prof_wall_end
  @prof_wall_end
end

#prof_wall_stObject

Returns the value of attribute prof_wall_st.



169
170
171
# File 'lib/shoes/profiler.rb', line 169

def prof_wall_st
  @prof_wall_st
end

Instance Method Details

#startObject



185
186
187
188
189
190
191
# File 'lib/shoes/profiler.rb', line 185

def start
  @tracer = nil if @tracer
  @tracer = Tracer.new(Reporter.new, add_c_calls)
  @cpu_st = cpu_time
  @tracer.enable
  yield
end

#stop(ld_st, ld_end, pf_end) ⇒ Object



193
194
195
196
197
198
199
200
201
# File 'lib/shoes/profiler.rb', line 193

def stop(ld_st, ld_end, pf_end)
  @cpu_end = cpu_time
  @tracer.disable
  @load_wall_st = ld_st
  @load_wall_end = ld_end
  @prof_wall_st = ld_end
  @prof_wall_end = pf_end
  @tracer.result
end