2

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

O.

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

For CPU usage, you can call GetThreadTimes.

2 Comments

I'm guessing he means current total CPU utilization (i.e. for the whole OS rather than just one thread).
yes, i need total, for the whole system - I have more than one processes that are mine, and i want to know about all of them (from within one 'master' proc) thanks!
1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.