简体   繁体   English

update_rq_clock 和 update_rq_clock_task 的区别

[英]difference between update_rq_clock and update_rq_clock_task

I understand the notion of update_rq_clock as it updates the run queue clock on system tick periodically.我理解 update_rq_clock 的概念,因为它会定期更新系统节拍上的运行队列时钟。 But this function calls update_rq_clock_task().但是这个function调用了update_rq_clock_task()。 What is the purpose behind this function?这个function背后的目的是什么?

Within update_rq_clock the difference between the CPU timestamp and the run queue clock is calculated (The rq->clock variable represents the last clock read from the CPU).update_rq_clock中计算 CPU 时间戳和运行队列时钟之间的差异(rq->clock 变量表示从 CPU 读取的最后一个时钟)。 That difference is added to the rq->clock and to the rq->clock_task (Which is the same as rq->clock - time for interrupts and stolen time) through update_rq_clock_task .该差异通过update_rq_clock_task添加到 rq->clock 和 rq->clock_task(与 rq->clock - 中断时间和被盗时间相同)。

There are a couple of options within the function, which you can activate with kernel build options. function 中有几个选项,您可以使用 kernel 构建选项激活它们。 But basically it breaks down to:但基本上它分解为:

...
rq->clock_task += delta;
...
update_rq_clock_pelt(rq, delta);
...

So, both functions together update the clock of the run queue and the clock of the run queue without accounting for interrupts and stolen time (unless you activated that accounting through the kernel options), so the actual time that the tasks used.因此,这两个函数一起更新运行队列的时钟和运行队列的时钟,而不考虑中断和被盗时间(除非您通过 kernel 选项激活该计算),因此任务使用的实际时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM