StopWatch的使用,计算程序运行时间
Stopwatch sw = new Stopwatch(); sw.Reset(); sw.Start(); //...运行的代码 sw.Stop(); TimeSpan tp = sw.Elapsed; double s = tp.TotalSeconds;//得到运行的时间,单位为秒 Response.Write("绑定事件" + Math.Round(s, 2) + "</br>");//输出运行时间,两位小数
Stopwatch sw = new Stopwatch(); sw.Reset(); sw.Start(); //...运行的代码 sw.Stop(); TimeSpan tp = sw.Elapsed; double s = tp.TotalSeconds;//得到运行的时间,单位为秒 Response.Write("绑定事件" + Math.Round(s, 2) + "</br>");//输出运行时间,两位小数