public static MonitoredScope NewFormat(string format, object arg0, object arg1, object arg2) { if (!MonitoredScope.TraceMonitoredScope) { return(MonitoredScope.dummyInstance); } return(MonitoredScope.New(string.Format(CultureInfo.InvariantCulture, format, arg0, arg1, arg2))); }
public static MonitoredScope NewConcat(string arg0, object arg1) { if (!MonitoredScope.TraceMonitoredScope) { return(MonitoredScope.dummyInstance); } if (arg1 != null) { return(MonitoredScope.New(arg0 + arg1)); } return(MonitoredScope.New(arg0)); }
public static void End(string name) { if (MonitoredScope.TraceMonitoredScope) { MonitoredScope monitoredScope = MonitoredScope.instance; if (!string.Equals(monitoredScope.stack.Peek().Key, name, StringComparison.InvariantCulture)) { throw new Exception("MonitoredScope cannot be ended because the start and end scope names do not match!"); } monitoredScope.Dispose(); } }
public static MonitoredScope New(string name) { if (!MonitoredScope.TraceMonitoredScope) { return(MonitoredScope.dummyInstance); } MonitoredScope monitoredScope = MonitoredScope.instance; if (monitoredScope == null) { monitoredScope = (MonitoredScope.instance = new MonitoredScope()); } monitoredScope.Start(name); return(monitoredScope); }