MLUG: [MLUG] Linux time command -- "kernel mode" and "user mode"
[MLUG] Linux time command -- "kernel mode" and "user mode"
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
We have written a program in C++ and we have also written it with a slightly different algorithm in Python. We want to see how much slower the Python program is than the C++ program. We get these results:

Python:
------
real    10m43.357s
user    9m51.050s
sys     0m23.420s

C++:
------
real    8m16.668s
user    5m38.360s
sys     2m37.780s

The thing I'm trying to understand is what the differences are in the three kinds of timings. "real" is pretty easy to understand, but it is the least useful of the three times because it depends heavily on system load. This was extracted from "man time" on GNU/Linux:

  When the -p option is given the (portable) output format
     real %e
     user %U
     sys %S
  is used.

  %E  Elapsed real time (in [hours:]minutes:seconds).

  %e  (Not in tcsh.) Elapsed real time (in seconds).

  %S  Total number of CPU-seconds that the process spent in kernel mode.

  %U  Total number of CPU-seconds that the process spent in user mode.

Now I just need a more thorough understanding of "kernel mode" and "user mode" -- know any references?

What I'm really interested in knowing is how the programs would compare in elapsed time under optimal conditions -- no other process competing for CPU, disk, etc. What would come closest to answering my question? Should I just add together the %S and %U times (kernel-mode seconds plus user-mode seconds)? Does that seem right?

Any tips will be appreciated.  Thanks.

Mike

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members