[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] How to get CPU time?



Hi,

Why not discussing on mintlist anymore?

Sorry, I have made a mistake :)


Well, it's not really lack of functions.

For example, on Linux, for to get CPU usage, I make:

char s[256];

FILE *f=fopen("/proc/stat","r");
fgets(s,sizeof(s),f);
sscanf(s,"%*s %lu %lu %lu %lu",&user,&nice,&sys,&idle);

As MiNT doesn't provide something like "/proc/stat", how can I do to get the CPU usage?


Use /kern/stat instead. As /proc was already used under FreeMiNT we named the Linux style proc /kern.

I have already thought about that but with the MiNT kernel that I use( 1.16.0Beta), /kern/stat and all the datas from the /kern folder are empties :/


or look at getloadavg,

getloadavg() gets only system load averages, so no the CPU's load at the moment where we call this function.


eventually is getrusage helpful too.

Thx, I will try it !


Thanks again for your help !
Zorro