System uptime
Hello,
I have a hw assignment to obtain the system totaltime and idletime, perform a calculation, obtain totaltime and uptime again, and calculate the percentage of time that the cpu was busy during that time. I know how to obtain the uptime and it is a file of the totaltime and idletime, but I don't know how to store those seperately. So far my prog looks like this: Code:
#include <iostream> thanks j |
Your real question is "how to read /proc/uptime".
One possible answer: substitute "popen()" for "system (cat SOMEFILE)". Then you can "fread()" or "fgets()" from /proc/uptime. An even better possibility: just "fopen()" /proc/update. Try it! IMHO ..PSM |
All times are GMT -5. The time now is 03:46 AM. |