AccordingConlusion:
If you don't want to read the whole explanation just read this:
Yes the value contained in /proc/[PID]/stat allows to determine the amount of CPU time used by a process and its children.
However, you can't use it for real time monitoring because value for children CPU time is updated only when child process die.
Explanation:
According to the man time time returns the following stats :
EDIT:
I though it was over but after doing some more researchAfter futher testing and talk wqith people, I tried the same with the command stressfinally get an answer, I've run a script that simply contains:
#!/bin/bash
sleep 5
time stress --cpu 4 -t 60s
stress: info: [18598] dispatching hogs: 4 cpu, 0 io, 0 --vm, 0 hdd
stress: info: [18598] successful run completed in 60s
real 1m0,003s
user -hang 3m53,663s15
sys sleep 0m0,349s5
During the execution I watch 2 times/second the result of the command:
cat /proc/11223$$/stat | cut -d ' ' -f 14-17
0 0 0 0exit
WhileAnd using watch to monitor the metric in ps faux | grep stress/proc/$$/stat would give me this particular PIDat the same time. As long as father of the fourchild process is not finished the counter are not updated. When stress threadends then the value displayed in /proc/$$/stat are updated and ends with similar result between time command and the column 14 to 17 of /proc.
Conlusion:Old edit Short answer no it not cumulative not even consistent at least from my observation.
stress
time stress --cpu 4 -t 60s
stress: info: [18598] dispatching hogs: 4 cpu, 0 io, 0 vm, 0 hdd
stress: info: [18598] successful run completed in 60s
real 1m0,003s
user 3m53,663s
sys 0m0,349s
During the execution I watch 2 times/second the result of the command:
cat /proc/11223/stat | cut -d ' ' -f 14-17
0 0 0 0
While ps faux | grep stress would give me this particular PID as father of the four stress thread.