执行时间计算 [英] execution time calculation

查看:114
本文介绍了执行时间计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算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 现在 进程的运行时间。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆