
正文
C#程序运行计时
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
var stp = new System.Diagnostics.Stopwatch();
stp.Start();//计时启动
..........程序代码...........
stp.Stop();//停止计时
Classlog.WriterLog(string.Format("耗时:{0}毫秒",stp.ElapsedMilliseconds), "caltm");
stp.Restart();// 停止时间间隔测量,将运行时间重置为零,然后开始测量运行时间。
..........程序代码.................
Classlog.WriterLog(string.Format("耗时:{0}毫秒",stp.ElapsedMilliseconds), "caltm");
stp.Stop();







