Class: Vernier::Collector::CustomCollector
- Inherits:
-
Collector
- Object
- Collector
- Vernier::Collector::CustomCollector
- Defined in:
- lib/vernier/collector.rb
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(mode, options) ⇒ CustomCollector
constructor
A new instance of CustomCollector.
- #sample ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(mode, options) ⇒ CustomCollector
Returns a new instance of CustomCollector.
9 10 11 12 13 14 15 16 17 |
# File 'lib/vernier/collector.rb', line 9 def initialize(mode, ) @stack_table = StackTable.new @samples = [] @timestamps = [] @started_at = Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) super end |
Instance Method Details
#finish ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vernier/collector.rb', line 27 def finish result = Result.new result.instance_variable_set(:@threads, { 0 => { tid: 0, is_main: true, name: "custom", started_at: @started_at, samples: @samples, weights: [1] * @samples.size, timestamps: @timestamps, sample_categories: [0] * @samples.size, } }) result.instance_variable_set(:@meta, { started_at: @started_at }) result end |
#sample ⇒ Object
19 20 21 22 |
# File 'lib/vernier/collector.rb', line 19 def sample @samples << @stack_table.current_stack @timestamps << Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond) end |
#start ⇒ Object
24 25 |
# File 'lib/vernier/collector.rb', line 24 def start end |