r - R system.time(exp) 输出中测量的 'user' 和 'system' 时间是多少?

标签 r time

我正在使用 system.time(expression) 来测量 R 函数的执行时间。

我获得的调用输出

system.time(myfunction())

是:

    user  system elapsed   
  117.36    5.65  127.86

“用户”和“系统”衡量什么?

最佳答案

我读过的关于用户系统运行时间之间差异的最清晰的解释由William Dunlap on [R-help]提供。 :

"User CPU time" gives the CPU time spent by the current process (i.e., the current R session) and "system CPU time" gives the CPU time spent by the kernel (the operating system) on behalf of the current process. The operating system is used for things like opening files, doing input or output, starting other processes, and looking at the system clock: operations that involve resources that many processes must share.

虽然 ?proc.time 返回类似的内容,但这个描述对我来说更容易理解。

关于r - R system.time(exp) 输出中测量的 'user' 和 'system' 时间是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5688949/

相关文章:

r - dplyr 追加组 ID 序列?

r - Print() 函数不在循环/函数内打印变量(R 代码)

r - 通过重复行来转换数据帧并创建一个变量来计算两个变量的值

r - R中时变协变量Cox比例风险建模的数据格式

python - 根据 python 中的区域设置格式化日期

r - 删除列名中的字符

sql - 在 dbplyr SQL 查询中的 string::str_detect 中使用带有正则表达式的变量

c - 测量线程的上下文切换时间

Mysql 存储和检索时间和日期

c - 导入 POSIX 函数时 undefined reference