static void Main(string[] args) { PerformanceScope rootScope = null; using (rootScope = new PerformanceScope(nameof(Main))) { Console.WriteLine("Hello World!"); for (int i = 0; i < 10; i++) { TestMethod1(); } for (int i = 0; i < 50; i++) { TestMethod2(); Thread.Sleep(10); } } var outs = new StringWriter(); rootScope.Report(outs); Debug.WriteLine(outs.ToString()); }