Does "time cmd" count the cpu consumption time or overall runtime? - Unix

This is a discussion on Does "time cmd" count the cpu consumption time or overall runtime? - Unix ; Assume I pass a cmd to "time" then the time of the command is measured. But which time exactly? The time which the cmd consumed or the total runtime? If the first is correct: How can I measure the real ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Does "time cmd" count the cpu consumption time or overall runtime?

  1. Does "time cmd" count the cpu consumption time or overall runtime?

    Assume I pass a cmd to "time" then the time of the command is measured.

    But which time exactly?

    The time which the cmd consumed or the total runtime?

    If the first is correct: How can I measure the real runtime?

    Peter

  2. Re: Does "time cmd" count the cpu consumption time or overallruntime?

    On May 20, 10:47 pm, p.oho@hotmail.com (Peter Ohoven) wrote:
    > Assume I pass a cmd to "time" then the time of the command is measured.
    > But which time exactly?
    > The time which the cmd consumed or the total runtime?
    > If the first is correct: How can I measure the real runtime?


    The answer is in the question:
    "But which time exactly?"
    Results typically will vary depending which time one uses (e.g. built
    into shell, or external
    command), and possibly also other factors such as environment setting
    and/or options to the
    time command (if the particular time command supports such options).

    Some examples:
    $ /usr/bin/time sleep 2
    0.00user 0.00system 0:02.01elapsed 0%CPU (0avgtext+0avgdata
    0maxresident)k
    0inputs+0outputs (142major+12minor)pagefaults 0swaps
    $ type time
    time is a shell keyword
    $ time sleep 2

    real 0m2.009s
    user 0m0.000s
    sys 0m0.000s
    $
    See also:
    time(1)
    sh(1)
    etc.

+ Reply to Thread