NPlot.StepTimer.GetResultsPercent C# (CSharp) Method

GetResultsPercent() public static method

public static GetResultsPercent ( ) : string
return 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

        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());
        }