如何获取每个进程的内存/ CPU使用率? [英] How to get the memory/cpu usage of per process running?

查看:128
本文介绍了如何获取每个进程的内存/ CPU使用率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Mobile 6中的taskmanager等应用程序/ net cf 3.5

I am working an application like taskmanager in Windows Mobile 6/net cf 3.5

但我发现很难获取进程的内存和CPU使用情况。

but I find it difficult to get the memory and cpu usage of the process.

对于内存使用情况,有一个页面显示您可以使用PROCVMINFO执行此操作。

For memory usage,There is one page shows that you can do it with PROCVMINFO.

除了 KernelLibIoControl 之外,MSDN对此一无所知

MSDN says nothing about it,except KernelLibIoControl

BOOL KernelLibIoControl(HANDLE hLib,DWORD dwIoControlCode,LPVOID lpInBuf,DWORD nInBufSize,LPVOID lpOutBuf,DWORD nOutBufSize,LPDWORD lpBytesReturned); 

const int KMOD_CORE = 1; 

const int IOCTL_KLIB_GETPROCMEMINFO = 8; 

BOOL KernelLibIoControl(HANDLE hLib, DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned); 
const int KMOD_CORE = 1; 
const int IOCTL_KLIB_GETPROCMEMINFO = 8; 

typedef struct _PROCVMINFO {
$
       处理hProc;          //处理ID


        DWORD  cbRwMemUsed;    // RW RAM使用


    } PROCVMINFO,* PPROCVMINFO;

typedef struct _PROCVMINFO {
        HANDLE hProc;          // process id
        DWORD  cbRwMemUsed;    // RW RAM used
    } PROCVMINFO, *PPROCVMINFO;



PROCVMINFO信息;

int idxProc; //进程ID

KernelLibIoControl((HANDLE)KMOD_CORE,IOCTL_KLIB_GETPROCMEMINFO,NULL,idxProc,& info,sizeof(info),NULL);


PROCVMINFO info;
int idxProc; //process id
KernelLibIoControl((HANDLE) KMOD_CORE, IOCTL_KLIB_GETPROCMEMINFO, NULL, idxProc, &info, sizeof(info), NULL);

它适用于C#p / invoke?

How does it work in C# p/invoke?

谢谢。

推荐答案

 

 

Hi,

 

有一个关于CPU使用的线程

There is a thread about usage of CPU

http://social.msdn.microsoft.com/Forums/en-US/windowsmobiledev/thread/3d999ae8-bfb1-4697 -9bb8-71c0c41ae9ff

 

希望这些信息能为您提供帮助!

Hope this information can help you!

 

问候!

Jesse


这篇关于如何获取每个进程的内存/ CPU使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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