开发者

need a library to get performance counters data under Win CE, c++ code

Under WindowsCE, C++ project, I'd like to get CPU utilization and memory allocation data real time - for logging and troubleshooting. Is there a library or activeX available that i could include in my code and use [without bringing my process to a halt, preferably], anyone knows?

thanks much for any ins开发者_开发知识库ight!

O.


If you are running on an arm based system (don't know enough about x86 systems) then you need to calculate cpu load on your own by spawning an idle thread and check how much time it consumes.

You can use the ToolHelpApi (a nice blog post that demonstrates this) to extract more information about processes.


For CPU usage, you can call GetThreadTimes.


It's not entirely clear whether you're trying to have the process monitor itself, or have one process monitoring another. In the first case, you want to put your monitoring in a separate thread to keep it from bringing the rest of the program to a halt.

SLaks has already covered getting CPU usage, so I won't repeat that.

You can get information about the blocks of memory allocated to a process with VirtualQuery or VirtualQueryEx (VirtualQuery to query the process' own memory, VirtualQueryEx to look at another process). At least for the first attempt, I'd count the private pages as the ones allocated by a particular process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜