执行时间计算 [英] execution time calculation
问题描述
如何计算C#Windows应用程序的执行时间。
How to you calculate Execution time of your C#, Windows Application.
是否有任何业界公认的方法?
Are there any industry recognized methods?
推荐答案
系统
。 诊断
。< a href = http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx rel = noreferrer> 流程
。 GetCurrentProcess()
。 TotalProcessorTime
-进程使用的处理器时间(用户模式和内核模式)。使用 UserProcessorTime
和 PrivilegedProcessorTime
用于单独的值。
System
.Diagnostics
.Process
.GetCurrentProcess()
.TotalProcessorTime
- the processor time used by the process (user mode and kernel mode). Use UserProcessorTime
and PrivilegedProcessorTime
for separate values.
系统
。 诊断
。 进程
。 GetCurrentProcess()
。 StartTime
-与 DateTime $ c $结合使用c>
。 现在
进程的运行时间。
System
.Diagnostics
.Process
.GetCurrentProcess()
.StartTime
- yields in combination with DateTime
.Now
the running time of the process.
使用 系统
。 诊断
。 StopWatch
来分析隔离的任务。
Use System
.Diagnostics
.StopWatch
to profile isolated tasks.
对于高级任务,您可以使用 系统
。 诊断
。 PerformanceCounter
。
For advanced tasks you can use System
.Diagnostics
.PerformanceCounter
.
这篇关于执行时间计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!