lib/tunemygc/snapshotter.rb in tunemygc-1.0.53 vs lib/tunemygc/snapshotter.rb in tunemygc-1.0.54

- old
+ new

@@ -17,11 +17,11 @@ @unit_of_work = false @stat_keys = GC.stat.keys end def take(stage, meta = nil) - _buffer([TuneMyGc.walltime, TuneMyGc.peak_rss, TuneMyGc.current_rss, stage, GC.stat.values_at(*stat_keys), GC.latest_gc_info, meta]) + _buffer([TuneMyGc.walltime, TuneMyGc.peak_rss, TuneMyGc.current_rss, stage, GC.stat.values_at(*stat_keys), GC.latest_gc_info, meta, thread_id]) end # low level interface, for tests and GC callback def take_raw(snapshot) _buffer(snapshot) @@ -42,9 +42,15 @@ def empty? @buffer.empty? end private + def thread_id + if Thread.current == Thread.main + Thread.current.object_id + end + end + def _buffer(snapshot) if snapshot[3] =~ TERMINATED || size < MAX_SAMPLES self.unit_of_work = true if snapshot[3] =~ UNITS_OF_WORK @buffer << snapshot else \ No newline at end of file