Stopwatch示例

 1             //进行测试
 2         Stopwatch watcher = new Stopwatch();
 3             watcher.Start();
 4             for (int i = 0; i < count; i++)
 5             {
 6                 //装载当前页面的模板
 7                 this.LoadCurrentTemplate();
 8                 //初始化页面模板的数据
 9                 this.InitPageTemplate();
10                 //不输出.只呈现
11                 string text = this.Document.GetRenderText();
12             }
13             watcher.Stop();
14             Response.Write(string.Format("第{0}次测试(共运行{1}次)花费时间: {2} ms", num, count, watcher.ElapsedMilliseconds));
原文地址:https://www.cnblogs.com/tomsense/p/3337454.html