Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # frequenza aggiornamento kernel
- cat /boot/config-`uname -r` | grep HZ
- # pcpu espressa da ps
- total_time = pp->utime + pp->stime;
- if(include_dead_children) total_time += (pp->cutime + pp->cstime);
- seconds = seconds_since_boot - pp->start_time / Hertz;
- if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
- if (pcpu > 999U)
- return snprintf(outbuf, COLWID, "%u", pcpu/10U);
- return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U);
- # process time raccolti dal kernel in /proc/pid/stat
- http://stackoverflow.com/questions/16726779/total-cpu-usage-of-an-application-from-proc-pid-stat
- # process time in /proc dettagliati
- utime %lu (14) Amount of time that this process has been scheduled in user mode, measured in clock ticks divide by sysconf(_SC_CLK_TCK)). This includes guest time, guest_time (time spent running a virtual CPU, see below), so that applications that are not aware of the guest time field do not lose that time from their calculations.
- stime %lu (15) Amount of time that this process has been scheduled in kernel mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
- cutime %ld (16) Amount of time that this process's waited-for children have been scheduled in user mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)). (See also times(2).) This includes guest time, cguest_time (time spent running a virtual CPU, see below).
- cstime %ld (17) Amount of time that this process's waited-for children have been scheduled in kernel mode, measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement