internal Timing(string typeName, string methodName, string timerName, Profiler profiler, Timing parent, int threadId) { this.typeName = typeName; this.methodName = methodName; this.timerName = timerName; this.profiler = profiler; this.parent = parent; this.threadId = threadId; this.disposed = false; if (parent == null) { stopwatch = Stopwatch.StartNew(); startMilliseconds = 0; } else { if (parent.subTimings == null) { parent.subTimings = new List<Timing>(); } parent.subTimings.Add(this); stopwatch = parent.stopwatch; startMilliseconds = stopwatch.ElapsedMilliseconds; } }
public static void EnableProfiling(IBus bus) { if (_instance == null) { lock (_mutex) { if (_instance == null) { _instance = new Profiler(); _bus = bus; } } } }
public static void DisableProfiling() { _instance = null; }