引用:using System.Diagnostics; 

定义:Stopwatch watch = new Stopwatch();

开始监听:watch.Start();

此处是执行的代码。。。。。

结束监听:watch.Stop();

后台提示信息:watch.ElapsedMilliseconds
//Response.Write("<Script Language=JavaScript>...alert(''+endTime-startTime +'');</Script>");
Response.Write("<script>alert('2-" + watch.ElapsedMilliseconds + "')</script>");

 

重新监听: watch.Restart();