[System.Runtime.InteropServices.DllImport("kernel32.dll")]
static extern uint GetTickCount();
private void button1_Click(object sender, System.EventArgs e)
{
uint t=GetTickCount();
//这里是你要测试的执行过程
uint time=GetTickCount()-t;
}
也可以使用 TimeSpan.Milliseconds 但精度好像没有使用GetTickCount()高
static extern uint GetTickCount();
private void button1_Click(object sender, System.EventArgs e)
{
uint t=GetTickCount();
//这里是你要测试的执行过程
uint time=GetTickCount()-t;
}
也可以使用 TimeSpan.Milliseconds 但精度好像没有使用GetTickCount()高