0

I am working on c++ application for Mac OS

There I would like to get percentage of CPU that my app is using.

I have seen getrusage() gives me cpu time used by the app.

   timeval userCPU = usage.ru_utime;
   timeval sysCPU = usage.ru_stime;

Do both values in the struct store cpu time consumed by the app. Is there any way to get cpu time used by the whole computer?

If not, how can I get the percentage?

Thanks in advance

RuLoViC
  • 825
  • 7
  • 23

0 Answers0