I need to retrieve process information in a C/C++ program. I need at least basic things like CPU% and memory usage, but additional details would be useful as well.
The problem is that I need to use this information in a portable program, that will run on multiple platforms: windows, linux, MAC and possibly Solaris too.
Is there a library that I can use or do I need to write my own HAL for the different platforms? I tried to look on google, but I couldn't see anything obvious.
I can't help you with a complete solution, but here's a link to my CPULoadMeter class, which you can use to poll CPU usage information over time. It works under MacOS/X, Windows, and Linux (and possibly other Unixy-OS's that have /proc/stat also, I don't know). Perhaps you can use it as a starting point.
https://public.msli.com/lcs/muscle/muscle/util/CPULoadMeter.h https://public.msli.com/lcs/muscle/muscle/util/CPULoadMeter.cpp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With