NPlot.StepTimer.GetResultsPercent C# (CSharp) Метод

GetResultsPercent() публичный статический Метод

public static GetResultsPercent ( ) : string
Результат string
        public static string GetResultsPercent()
        {
            double total = 0;
            foreach (KeyValuePair<string, Stopwatch> kvp in AllStopwatches)
            {
                total += kvp.Value.Elapsed.TotalMilliseconds;
            }

            StringBuilder sb = new StringBuilder();
            foreach (KeyValuePair<string, Stopwatch> kvp in AllStopwatches)
            {
                sb.AppendLine(kvp.Key + '\t' + (kvp.Value.Elapsed.TotalMilliseconds / total).ToString("0.0%"));
            }
            return sb.ToString();
        }
    }

Usage Example

Пример #1
0
        public void RefreshSpeedTest()
        {
            ST.Reset();

            DebugStopwatch sw   = new DebugStopwatch();
            double         time = sw.TimeEvent(RefreshSpeed);

            Console.WriteLine(time.ToString() + " seconds to on average");

            Console.WriteLine(ST.GetResultsPercent());
        }