跨平台方式获得CPU /内存利用率

时间:2021-07-11 12:15:35

Looking for a library or a fairly cross platform method to get CPU utilization, memory utilization, etc in C/C++. Something OTHER than getrusage(), I need for entire system, not one process. I've checked around, but haven't found much. I really need it on Linux, Mac Os X, and Windows, but if there's a solution for *nix systems (including OS X) but not Windows, I can work around that.

寻找一个库或一个相当跨平台的方法来获得C / C ++中的CPU利用率,内存利用率等。除了getrusage()以外的东西,我需要整个系统,而不是一个过程。我已经检查过,但没有找到太多。我真的需要它在Linux,Mac Os X和Windows上,但如果有* nix系统(包括OS X)但不是Windows的解决方案,我可以解决这个问题。

If all else fails, then ANY methods to do this on ANY of the above platforms would be good to know, and I can figure out how to package them myself!

如果所有其他方法都失败了,那么在任何上述平台上执行此操作的任何方法都会很有用,我可以自己弄清楚如何打包它们!

Thanks

1 个解决方案

#1


The cross platform framework ACE has a wrapper for getrusage that should work on most if not all supported platforms.

跨平台框架ACE有一个getrusage包装器,它应该适用于大多数(如果不是全部)支持的平台。

#1


The cross platform framework ACE has a wrapper for getrusage that should work on most if not all supported platforms.

跨平台框架ACE有一个getrusage包装器,它应该适用于大多数(如果不是全部)支持的平台。