rtime

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


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

The output I get for the call

system.time(myfunction())

is:

    user  system elapsed   
  117.36    5.65  127.86

What does 'user' and 'system' measure?


Solution

  • 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._