0

I executed a python script on the server with the time command like

time python myscript.py

The time output was :

312.90user 15.57system 2:10:42elapsed 4%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1major+152440minor)pagefaults 0swaps

So, does that mean the script took 2 hours 10 minutes and 42 seconds to complete execution ? Also, what is the meaning of 312.90user and 15.57system ?

Please Help Thank You

Joe
  • 3
  • 1
  • 3
    duplicate: http://stackoverflow.com/questions/556405/what-do-real-user-and-sys-mean-in-the-output-of-time1 (in your case *elapsed* is equivalent to *real*) – mhyfritz Jul 29 '11 at 10:47

2 Answers2

0

To put it simply:

"user" is the time the cpu spent running non-system calls in your myscript.py. These are the python codes.

"system" is the time the cpu spent serving system calls made by your myscript.py. These are code that call the c library functions like open, write, etc., for example.

"elapsed" is the wall clock duration that your program took to run. This is comparable to you measuring the time the program took to run using your wristwatch (if you wear one anyway).

holygeek
  • 15,653
  • 1
  • 40
  • 50
  • Thanks for the explanation :). What are the units for user time and system time ? – Joe Jul 29 '11 at 11:11
  • They're the CPU clock ticks. Read http://www.kernel.org/doc/man-pages/online/pages/man2/times.2.html and http://www.kernel.org/doc/man-pages/online/pages/man1/time.1.html for the nitty gritty details. – holygeek Jul 29 '11 at 12:03
0

The time is indeed 2 hours and 10 minutes from invocation to termination of your script. User shows the CPU time used in user mode and System the cpu time in the kernel.

Harel
  • 1,989
  • 3
  • 26
  • 44