public static double Pop() { if (Enabled == false || TimeProvider == null) { return(0); } if (counterStack.Count == 0) { return(0); } PerfEntry entry = counterStack.Pop(); long diff = TimeProvider.GetTimestamp() - entry.StartTime; double seconds = (double)diff / (double)TimeProvider.GetFrequency(); bool performLog = true; if (LogLongRunningTasksOnly == true) { performLog = (seconds >= LongRunningTaskThresholdInSeconds); } if (performLog) { Log.Write(LogType.Performance, LogSeverity.Debug, entry.Description + " took " + (seconds * 1000) + " ms"); } return(seconds); }
public static double Pop() { if (Enabled == false) { return(0); } if (counterStack.Count == 0) { return(0); } PerfEntry entry = counterStack.Pop(); long diff = System.Diagnostics.Stopwatch.GetTimestamp() - entry.StartTime; double seconds = (double)diff / (double)System.Diagnostics.Stopwatch.Frequency; bool performLog = true; if (DebugOptions.LogLongRunningTasksOnly == true) { performLog = (seconds >= DebugOptions.LongRunningTaskThresholdInSeconds); } if (performLog) { Log.Write(LogType.Performance, LogSeverity.Debug, entry.Description + " took " + (seconds * 1000) + " ms"); } return(seconds); }
public static void Push(string description) { if (Enabled == false) return; PerfEntry entry = new PerfEntry(); entry.StartTime = System.Diagnostics.Stopwatch.GetTimestamp(); entry.Description = description; counterStack.Push(entry); if (DebugOptions.LogLongRunningTasksOnly == false) Log.Write(LogType.Performance, LogSeverity.Debug, entry.Description + " starts"); }
public static void Push(string description) { if (Enabled == false || TimeProvider == null) { return; } PerfEntry entry = new PerfEntry(); entry.StartTime = TimeProvider.GetTimestamp(); entry.Description = description; counterStack.Push(entry); if (LogLongRunningTasksOnly == false) { Log.Write(LogType.Performance, LogSeverity.Debug, entry.Description + " starts"); } }
public static void Push(string description) { if (Enabled == false) { return; } PerfEntry entry = new PerfEntry(); entry.StartTime = System.Diagnostics.Stopwatch.GetTimestamp(); entry.Description = description; counterStack.Push(entry); if (DebugOptions.LogLongRunningTasksOnly == false) { Log.Write(LogType.Performance, LogSeverity.Debug, entry.Description + " starts"); } }