Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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");
            }
        }
Ejemplo n.º 5
0
        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");
            }
        }