Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I execute and time many commands (i.e. nslookup) through SSH and I collect the total time needed for the implied service to complete (i.e. DNS). So I collect the user and sys time as the real time counts time when my process is blocking which I do not need...I guess.

But some of my tests had results as such:

real 3m22.033s
user 0m0.009s
sys 0m0.014s

I execute these tests on limited resources linux boxes but still, the real time is significantly high. Would this only indicate that the box is VERY busy running different processes ? Is it still correct to add up the user and sys times to know how much the service took ?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Real is the total time it took for the process to terminate (that is difference between starting time and stopping time) :

$ time sleep 3

real    0m3.002s
user    0m0.000s
sys     0m0.000s

In this listing, user and sys refer to the time spent respectively in user mode and kernel mode. These do not include the time spent while being inactive, in sleeping state. A process goes sleeping when it deliberately requested it, or when it's waiting for IO (networking/disk access/user interaction) to be available, or waiting for other processes to terminate, for lack of CPU available when the system is under very high load, etc.

Typically, if you call time on wget, real will correspond to the time the download takes, user should be negligible (unless wget is asked to perform intensive data processing), sys should be small (some time might be spent to deal with buffers, moving data back and forth from kernel space to user space.)

share|improve this answer
    
I'm sorry I added wget to the question, I actually don't time it but thanks for the explanation though. Saying that real includes blocking times such as waiting for network IO makes me think to include that time too because I'm actually testing the network. Thank you. –  Muhammad Gelbana Oct 30 '12 at 13:45
    
Would you please confirm the following, to test the network's performance and the responsiveness of the queried machine whether it's a DNS server or a pinged machine, is it sufficient to only measure the real time ? –  Muhammad Gelbana Oct 30 '12 at 14:09
    
@MuhammadGelbana: This real time is just a stopwatch, nothing more. If you let ping run for 3 minutes 22, it will return 3 minutes 22. It's just useless in this case (and actually it's useless as a benchmark most of the time, the result depends on external factors). –  Stéphane Gimenez Oct 30 '12 at 14:14
    
thanks. But would you know why it didn't timeout ? I read that the default timeout for nslookup is 5 seconds ! –  Muhammad Gelbana Oct 30 '12 at 14:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.