What do 'real', 'user' and 'sys' mean in the output of time(1)?

前端 未结 7 823
执笔经年
执笔经年 2020-11-22 00:35
$ time foo
real        0m0.003s
user        0m0.000s
sys         0m0.004s
$

What do \'real\', \'user\' and \'sys\' mean in the output of time?

7条回答
  •  半阙折子戏
    2020-11-22 00:51

    To expand on the accepted answer, I just wanted to provide another reason why realuser + sys.

    Keep in mind that real represents actual elapsed time, while user and sys values represent CPU execution time. As a result, on a multicore system, the user and/or sys time (as well as their sum) can actually exceed the real time. For example, on a Java app I'm running for class I get this set of values:

    real    1m47.363s
    user    2m41.318s
    sys     0m4.013s
    

提交回复
热议问题