问题描述
我正在使用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.
除了之外,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?
谢谢。
推荐答案
有一个关于CPU使用的线程
There is a thread about usage of CPU
希望这些信息能为您提供帮助!
Hope this information can help you!
问候!
Jesse
这篇关于如何获取每个进程的内存/ CPU使用率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!