执行时间计算
答
System
。 Diagnostics
。 Process
。 GetCurrentProcess()
。 TotalProcessorTime
- 进程使用的处理器时间(用户模式和内核模式)。对于单独的值,使用UserProcessorTime
和PrivilegedProcessorTime
。
System
。 Diagnostics
。 Process
。 GetCurrentProcess()
。 StartTime
- 收益率与DateTime
相结合。 Now
该进程的运行时间。
使用System
。 Diagnostics
。 StopWatch
来分析分离的任务。
对于您可以使用System
高级任务。 Diagnostics
。 PerformanceCounter
。
答
使用的GetTickCount()API函数,当你进入main()和当你要退出它,并把他们之间的差别让你的程序了毫秒数一次。