void OnThreadTransition(ProfileEvent e) { if (currentThread != null) currentThread.Complete(e.timestamp, frequency); currentThread = new Activation<Thread>(threads[e.id], e.timestamp); }
void OnEnterFunction(ProfileEvent e) { Thread t = currentThread.Target; Function parent = (t.activations.Count == 0) ? null : t.activations.Peek().Target; IDictionary<uint, Function> dict = (parent == null) ? t.roots : parent.children; Function f; Name name = names(e.id); if (!dict.TryGetValue(e.id, out f)) dict.Add(e.id, f = new Function(e.id, name, parent)); t.activations.Push(new Activation<Function>(f, e.timestamp)); if (!allCalledFunctions.Contains(e.id)) allCalledFunctions.Add(e.id); }
void OnLeaveFunction(ProfileEvent e) { currentThread.Target.activations.Pop().Complete(e.timestamp, frequency); }