如何获得一页面执行了多长时间
解决方案 »
- 跨页面传值安全性问题
- 大家在用formview 的插入模板进行添加记录时,是如何验证表单的
- 空格变成%20的现象
- 如何Page_Load事件中执行update命令呢?或是有其他方法在打开或刷新页面的时候执行update语句?
- 请绝顶高手回答一个绝顶难题
- webconfig文件出错,<authentication mode="Windows" /> ,请问如何解决。
- mvc模式下获取到easyui的datagrid的数据后,传到后台怎么接受?
- Forms验证问题目?
- 这个问题到底有没解(查遍相关问题没有答案)???
- 通过您的学习和使用,您认为ASP.NET和WEB FORM的精髓是什么??
- 为什么在类里用不了!ispostback
- 关于TIMER的问题 那个大哥帮帮我啊!~~~~
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Threading;namespace Win32
{
internal class HiPerfTimer
{
[DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceCounter(
out long lpPerformanceCount); [DllImport("Kernel32.dll")]
private static extern bool QueryPerformanceFrequency(
out long lpFrequency); private long startTime, stopTime;
private long freq; // Constructor
public HiPerfTimer()
{
startTime = 0;
stopTime = 0; if (QueryPerformanceFrequency(out freq) == false)
{
// high-performance counter not supported
throw new Win32Exception();
}
} // Start the timer
public void Start()
{
// lets do the waiting threads there work
Thread.Sleep(0); QueryPerformanceCounter(out startTime);
} // Stop the timer
public void Stop()
{
QueryPerformanceCounter(out stopTime);
} // Returns the duration of the timer (in seconds)
public double Duration
{
get
{
return (double)(stopTime - startTime) / (double) freq;
}
}
}
}这个类可以获得具体执行时间,在load中调用即可