内存使用和执行时间,使用C#另一个进程? [英] Memory usage and time for execution for another process using C#?

查看:102
本文介绍了内存使用和执行时间,使用C#另一个进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所需要的内存使用量和处理时间,通过其他应用程序加载的应用程序。我使用C#。目前我使用 Process.WorkingSet 来获得内存使用情况 同样 Process.TotalProcessTime 得到执行时间,但它不给任何价值。因此,有你做什么建议?

I need the memory usage and processing time for an application loaded through another application. I am using C#. Currently I am using Process.WorkingSet to get memory usage similarly Process.TotalProcessTime to get time for execution, but it doesn't give any value. So have you make any suggestions?

推荐答案

使用WMI得到这样的信息,很好的支持System.Management命名空间。获得通过下载启动的<一个href="http://www.microsoft.com/downloads/en/details.aspx?familyid=2cc30a64-ea15-4661-8da4-55bbc145c30e&displaylang=en"相对=nofollow> WMI code Creator实用程序,它可以让你尝试查询,并可以自动生成C#你需要。

Use WMI to get this kind of info, well supported by the System.Management namespace. Get started by downloading the WMI Code Creator utility, it lets you experiment with queries and can auto-generate the C# you'll need.

您要查询Win32_Process的,它提供了大量的有关进程的信息。 PrivatePageCount将是一个很好的措施为的内存量,它使用了没有通过任何其他进程共享。 KernelModeTime和UserModeTime给你的时间花费在执行code。

You want to query Win32_Process, it provides lots of info about a process. PrivatePageCount would be a good measure for the amount of memory it uses that isn't shared by any other process. KernelModeTime and UserModeTime gives you time spent executing code.

这篇关于内存使用和执行时间,使用C#另一个进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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