Untitled Document
time Command

When we have multiple versions of a program , we need to find out how efficiently they use the sstem resources . The time command accepts the entire command line to be timed as its argument and does this work . It executes the program and also displays the time usage on the terminal . This enables programmers to tune their programs to keep CPU usage at a optimum level .

1. Basic Example -

The following command find out the time taken to perform a sorting operation by preceding the sort command with time .

   time sort -o user_logs.txt sort_user.txt 
   output -
   real 0m21.511s
   user 0m5.210s
   sys  0m7.810s

The real time shown is the clock elapsed time from the invocation of the command until its termination . The user time shows the time spent by the program in executing itself . The sys indicates the time used by the kernel in doing work on behalf of the user process.The sum of the user time and sys time actually represnts the CPU time . This would be sifnificantly less than the real time on a heavily loaded system

Untitled Document