Portable system / process information library

I need to get process information in a C / C ++ program. I need at least basic things, such as CPU and memory utilization, but additional data will also be useful.

The problem is that I need to use this information in a portable program that will work on several platforms: windows, linux, MAC, and possibly Solaris.

Is there a library that I can use, or do I need to write my own HAL for different platforms? I tried to look at google, but I did not see anything obvious.

+6
c ++ memory-management operating-system system cpu-usage
source share
2 answers

I cannot help you with a complete solution, but here is 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 another Unixy-OS that has / proc / stat as well, 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

+1
source share

This information must be obtained from the OS.
By definition, this is not portable, but there are a couple of layers of OS abstraction. The one that comes to mind is ACE .

0
source share

All Articles