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

后端 未结 5 1445
粉色の甜心
粉色の甜心 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:49

    This is discussed in ?proc.time (system.time() returns an object of class "proc.time"):

    Details:
    
         ‘proc.time’ returns five elements for backwards compatibility, but
         its ‘print’ method prints a named vector of length 3.  The first
         two entries are the total user and system CPU times of the current
         R process and any child processes on which it has waited, and the
         third entry is the ‘real’ elapsed time since the process was
         started.
    

    ....and

    Value:
    
    ....
    
         The definition of ‘user’ and ‘system’ times is from your OS.
         Typically it is something like
    
         _The ‘user time’ is the CPU time charged for the execution of user
         instructions of the calling process. The ‘system time’ is the CPU
         time charged for execution by the system on behalf of the calling
         process._
    

提交回复
热议问题