Class: Vernier::Collector::RetainedCollector
Instance Attribute Summary
#stack_table
Instance Method Summary
collapse
#add_marker, #current_time, new, #record_interval, #stop
Constructor Details
Returns a new instance of RetainedCollector.
48
49
50
51
52
53
54
|
# File 'lib/vernier/collector.rb', line 48
def initialize(mode, options)
@stack_table = StackTable.new
@heap_tracker = HeapTracker.new(@stack_table)
@started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)
super
end
|
Instance Method Details
#drain ⇒ Object
60
61
62
|
# File 'lib/vernier/collector.rb', line 60
def drain
@heap_tracker.drain
end
|
#finish ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/vernier/collector.rb', line 64
def finish
@heap_tracker.drain
GC.start
@stack_table.finalize
GC.start
@heap_tracker.lock
tracker_data = @heap_tracker.data
samples = tracker_data.fetch(:samples)
weights = tracker_data.fetch(:weights)
result = Result.new
result.instance_variable_set(:@threads, {
0 => {
tid: 0,
name: "retained memory",
started_at: @started_at,
samples: samples,
weights: weights,
sample_categories: [0] * samples.size,
}
})
result.instance_variable_set(:@meta, {
started_at: @started_at
})
result
end
|
#start ⇒ Object
56
57
58
|
# File 'lib/vernier/collector.rb', line 56
def start
@heap_tracker.collect
end
|