We have moved to www.dataGenX.net, Keep Learning with us.

Friday, January 13, 2012

The Unix Time Command : tips & tricks


If you have a program ./prog.e then in the bash/ksh shell you can type this command and the output on the screen details how long the code took to run:
     
$ time ./prog.e
real   24m10.951s user    6m2.390s sys     0m15.705s



Real time - Elapsed time from beginning to end of program (or wall clock time).The real time is the total  time of execution.
CPU time - Divided into User time and System time.
User time - time used by the program itself and any library subroutines it calls.The user time is the time spent processing at the user/application process level.
System time - time used by the system calls invoked by the program (directly or indirectly).The sys time is the time spent by the system at the system/kernel level.

If the wall clock time is consistently much longer than the total of the system and user time, then the fetching of data to and from hard drives may be taking a good deal of time. In parallel codes, the code may be spending a good deal of time waiting on communication between processors.

By this command you can check your script performance.

happy scripting :-)

1 comment :

  1. just what I needed to know. Thanks

    ReplyDelete