Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

portable system/process information library

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.

like image 710
user142968 Avatar asked Jul 22 '09 16:07

user142968


1 Answers

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

like image 196
Jeremy Friesner Avatar answered Nov 12 '22 08:11

Jeremy Friesner