6

I'm looking to find a C/C++ library that gives me system stats like CPU usage and memory usage.

Is there one that works cross platform?

I just don't want to have to re-invent the wheel (badly).

3
  • Scraping /proc/self/stat is probably as close as you will get to "cross-platform".
    – Sergey L.
    Commented Sep 12, 2014 at 13:30
  • @SergeyL., Isn't that Linux specific? What about Windows?
    – batman
    Commented Sep 12, 2014 at 13:36
  • Comments are not for discussion of closure, please go to meta if you have a complaint or need opinions how to make your question better.
    – kayess
    Commented Jul 11, 2018 at 9:18

1 Answer 1

3

You could use SIGAR API (C++)

This is an open source library that does basically what your looking for, but unfortunally there is no platform independent function for this.

If you want one for cross-platforms, ACE has a good one that works for a lot of languages! Note that ACE abstracts the OS in general, and might be heavyweight for what you want. ACE

1
  • Have you used SIGAR? I'm trying to set it up but I'm confused with the build process and then wiki page doesn't really help. After cloning it, what are the exact files that I should compile along with my C++ source to be able to use it? Thanks.
    – batman
    Commented Sep 12, 2014 at 16:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.