C# 使用 Stopwatch 测量代码运行时间
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
System.Threading.Thread.Sleep(3000);
sw.Stop();
Console.WriteLine(sw.Elapsed);
sw.Start();
System.Threading.Thread.Sleep(3000);
sw.Stop();
Console.WriteLine(sw.Elapsed);