public History(Inspector inspector) { this.history = new SortedDictionary<ulong, Dictionary<ulong, Counter>> (); this.inspector = inspector; this.inspector.Sample += OnInspectorSampleTick; }
private void OnInspectorSampleTick(object sender, Inspector.SampleEventArgs a) { Dictionary<ulong, Counter> counters; if (this.history.Count == 0) { counters = new Dictionary<ulong, Counter> (); foreach (var c in a.Counters) counters.Add (c.Index, c); } else { counters = new Dictionary<ulong, Counter> (this.history [LastTimestamp]); foreach (var c in a.Counters) counters [c.Index] = c; } lock (this.history) { this.history.Add (a.Timestamp, counters); } }
public InspectorEventListener(Inspector inspector) { Inspector = inspector; }