What are 'user' and 'system' times measuring in R system.time(exp) output?

后端 未结 5 1446
粉色の甜心
粉色の甜心 2020-12-04 11:03

I am using system.time(expression) to measure execution time for an R function.

The output I get for the call

system.time(myfunction())
         


        
5条回答
  •  死守一世寂寞
    2020-12-04 11:24

    Here is some simple explanations:

    Elapsed Time is the time charged to the CPU(s) for the expression.

    User Time is the wall clock time. The time that you as a user experienced.

    Usually both times are relatively close. But they may vary in some other situations. For example:

    • If elapsed time > user time, this means that the CPU is waiting around for some other operations (may be external) to be done.
    • If elapsed time < user time, this means that your machine has multiple cores and is able to use them

提交回复
热议问题