Skip to content

Linux版本的go-judge time依旧有时候为0,请问runtime可以作为oj网站题目的代码的运行时间吗? #108

Answered by criyle
xxdcz11 asked this question in Q&A
Discussion options

You must be logged in to vote
  1. 如果不是以 root 用户运行的 go-judge 默认使用的是 wait4 系统调用返回的时间,精度为 1ms。需要精确统计,请使用 root 帐户运行以给予 cgroup 使用权限。
  2. runtime 相当于在开始运行程序的时候同时开启一个秒表计时,然后在程序停止的时候结束计时。在高系统负载(例如同时多线程评测) 的情况下,并不能确认计时中 100% 的时间程序处于运行状态(例如被其他程序抢占)。
  3. 您可以使用这个指标,只是要注意到可能的误差。
  4. Linux, macOS 下的 runtime 统计口径一致。windows 由于疏忽尚未实现。

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@xxdcz11
Comment options

Answer selected by xxdcz11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants