Class: Profiler::Collectors::FunctionProfilerCollector
Defined Under Namespace
Classes: CallFrame
Constant Summary
collapse
- GC_FRAME_NAME =
"(garbage collection)"
Instance Attribute Summary
#profile
Instance Method Summary
collapse
descendants, inherited, #initialize, #panel_content, #render_html, #render_mode
Instance Method Details
#collect ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 77
def collect
mode = Thread.current[:fn_profiler_mode] || Profiler.function_profiling_mode
clock = Thread.current[:fn_profiler_clock] || Profiler.function_profiling_clock
Thread.current[:fn_profiler_mode] = nil
Thread.current[:fn_profiler_clock] = nil
if mode == "lite" && defined?(StackProf)
StackProf.stop
result = StackProf.results
wall_ms = (Process.clock_gettime(Process::CLOCK_MONOTONIC) - (Thread.current[:fn_profiler_wall_start] || 0)) * 1000
cpu_ms = (Process.clock_gettime(Process::CLOCK_PROCESS_CPUTIME_ID) - (Thread.current[:fn_profiler_cpu_start] || 0)) * 1000
Thread.current[:fn_profiler_wall_start] = nil
Thread.current[:fn_profiler_cpu_start] = nil
collect_stackprof(result, mode, clock, wall_ms, cpu_ms)
else
collect_tracepoint(mode)
end
end
|
#has_data? ⇒ Boolean
41
42
43
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 41
def has_data?
false
end
|
#icon ⇒ Object
22
23
24
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 22
def icon
"⚡"
end
|
#name ⇒ Object
18
19
20
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 18
def name
"function_profile"
end
|
#priority ⇒ Object
26
27
28
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 26
def priority
31
end
|
#tab_config ⇒ Object
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 30
def tab_config
{
key: "function_profile",
label: "Function Profile",
icon: icon,
priority: priority,
enabled: false,
default_active: false
}
end
|
96
97
98
99
100
101
102
|
# File 'lib/profiler/collectors/function_profiler_collector.rb', line 96
def toolbar_summary
return { text: "off", color: "gray" } unless Profiler.function_profiling_enabled
case Profiler.function_profiling_mode
when "lite" then { text: "sampling on", color: "blue" }
else { text: "fn profiling on", color: "purple" }
end
end
|