Timing Pipelines

Leo de Wit leo at philmds.UUCP
Thu Mar 16 22:09:07 AEST 1989


In article <3680044 at eecs.nwu.edu> naim at eecs.nwu.edu (Naim Abdullah) writes:
|How can one time a pipeline in the csh/sh so that the time returned
|is that of the longest running process in the pipeline ?
|
|So, for example running it on "ls | sleep 5" should return 5 seconds
|assuming that the ls finishes before then.
|
|A sample solution would be
|
|% time sh -c "ls | sleep 5"
|
|but that involves creating an extra process. Is there a clever
|quoting trick that would avoid the extra process ?

I would expect that

% time eval 'ls|sleep 5'

would perform your trick, but strange enough ls and sleep are executed
one after another (parallel? at least no pipe). What is this, another
csh bug (without 'time' the problem remains) ?

   Leo.



More information about the Comp.unix.questions mailing list