I am using system.time(expression) to measure execution time for an R function.
The output I get for the call
system.time(myfunction())
Since those time variables are defined by your OS, you can retrieve information on how they are calculated by executing man time in your shell (on Unix):
...These statistics consist of (i) the elapsed real time between invocation and termination, (ii) the user CPU time (the sum of the
tms_utimeandtms_cutimevalues in a struct tms as returned by times(2)), and (iii) the system CPU time (the sum of thetms_stimeandtms_cstimevalues in a struct tms as returned by times(2)).
The definition of the mentioned time variables can be found here:
tms_utimeUser CPU time.
tms_stimeSystem CPU time.
tms_cutimeUser CPU time of terminated child processes.
tms_cstimeSystem CPU time of terminated child processes.
A a clarification of the differences between user and system time is described in daroczig's answer and elsewhere on SO:
The
tms_utimeelement is the amount of time spent executing your code, or the code in the C library. Thetms_stimeelement is the amount of time spent in the kernel executing code on your behalf.