/// <summary> /// Gets or create a session tied to the label. /// </summary> /// <param name="label"></param> /// <returns></returns> public static DiagnosticSession GetSession(string label) { if (_sessions == null) _sessions = new Dictionary<string, DiagnosticSession>(); DiagnosticSession session = null; if (!_sessions.ContainsKey(label)) { session = new DiagnosticSession(); session.Label = label; session.StartTime = DateTime.Now; _sessions[label] = session; } else { session = _sessions[label]; } return session; }
/// <summary> /// Gets or creates a new session. /// </summary> /// <param name="label"></param> /// <returns></returns> public static DiagnosticSession SessionStart(string label, bool setAsCurrent) { DiagnosticSession session = GetSession(label); // Set as the current session. if (setAsCurrent) _session = session; return session; }
/// <summary> /// Sets the current session. /// </summary> /// <returns></returns> public static DiagnosticSession CurrentSession() { if (_session == null) _session = GetSession("default"); return _session; }