On 1/8/14 7:00 AM, James Bonfield wrote: > Bash Version: 4.1 > Patch Level: 5 > Release Status: release > > Description: > If I have a process running in the background that finishes > while I have a foreground process being timed using the > builtin time command, then the CPU time of the background task > is erroneously added on to the foreground task. This does not > happen if the background task ends after the foreground task.
This is simply an artifact of how process time accounting is done. The time consumed by children of the current process is modified when a child process exits. The command timing code just looks at the difference in the time alloted to the shell process and its children before and after executing the timed command, and computes the time taken by subtracting before from after. It's more difficult to get timing information for other individual processes, and changing the code to do that would interfere with the ability to time builtins and other shell commands. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/