更具体地说,这是我的用例:
有一个进程等待用户执行程序的请求.为了执行这些程序,这个过程调用子进程(一次最多限制为5个)&每个子进程执行其中一个提交的程序(假设用户一次提交了15个程序).因此,如果用户提交了15个程序,那么将运行3批5个子进程.子进程在完成程序执行后立即被终止.
我想知道在执行这15个程序期间父进程及其所有子进程的%cpu利用率.
使用top或其他命令有没有简单的方法呢? (或者我应该附加到父进程的任何工具.)
解决方法
utime %lu
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
Amount of time that this process has been scheduled in kernel mode,
measured in clock ticks (divide by sysconf(_SC_CLK_TCK).cutime %ld
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
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).
有关详情,请参见proc(5) manpage.