Unix time command

I was wondering what the overhead of using the time command on unix is.

I know how to use it, but I want to know how much longer the command

$ time java HelloWorld

takes a terminal than a command

$ java HelloWorld

I especially I am interested in how these overheads depend on the duration of the program.

Context :: I use it to measure the time spent on a bunch of lengthy experiments written in Java.

+5
source share
2 answers

, , , (time), (a). , time time ( fork).

:

  • .
  • , fork exec .

, time ( wait), .

, time , . , time .

, time, , , :

pax> time sleep 0
real    0m0.001s
user    0m0.000s
sys     0m0.000s

pax> time sleep 1
real    0m1.001s
user    0m0.000s
sys     0m0.000s

pax> time sleep 10
real    0m10.001s
user    0m0.000s
sys     0m0.004s

pax> time sleep 100
real    1m40.001s
user    0m0.000s
sys     0m0.000s

, .

, , , , ( , , , ), time .


(a): time (, bash time), .

+9

time , . , , , , .

..: , time. "Hello World", , . -, , , .

+3

All Articles