Advertisement
Guest User

Untitled

a guest
Jul 29th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.53 KB | None | 0 0
  1. # frequenza aggiornamento kernel
  2. cat /boot/config-`uname -r` | grep HZ
  3.  
  4. # pcpu espressa da ps
  5. total_time = pp->utime + pp->stime;
  6. if(include_dead_children) total_time += (pp->cutime + pp->cstime);
  7. seconds = seconds_since_boot - pp->start_time / Hertz;
  8. if(seconds) pcpu = (total_time * 1000ULL / Hertz) / seconds;
  9. if (pcpu > 999U)
  10. return snprintf(outbuf, COLWID, "%u", pcpu/10U);
  11. return snprintf(outbuf, COLWID, "%u.%u", pcpu/10U, pcpu%10U);
  12.  
  13. # process time raccolti dal kernel in /proc/pid/stat
  14. http://stackoverflow.com/questions/16726779/total-cpu-usage-of-an-application-from-proc-pid-stat
  15.  
  16. # process time in /proc dettagliati
  17. 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.
  18. 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)).
  19. 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).
  20. 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