Timing the shell script

I have two shell scripts, one written with xargs for parallel processing (p1) and the other written in old school way (p3) [ `jobs | wc -l` -ge 25 ].

when I execute them, i get the below values.

$ time ./p1
real    0m25.36s
user    0m0.32s
sys     0m0.80s

$ time ./p3
real    0m23.25s
user    0m6.20s
sys     0m22.36s

Leaving the realtime (elasped time), what does the other time numbers mean in terms of efficiency

Thanks much

user time is user mode cpu time
sys is kernel mode cpu time

elapsed is usually due to I/O wait or scheduling cpu waits. -plus the other two times.

1 Like

I wanted to know more about the efficiency of the program timing, not about the decsription. Like for example, both the scripts complete nearly at the same time, one has more cpu time and the other less cpu time.

p1 appears to have spent most of its time asleep.

Regards,
Alister

Although, p1 finishes late by 2 seconds, I assume that it does not strain the cpu and is mostly in sleep mode. In that case, I shall go with P1 script.

Thanks much.