加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – / proc / pid / sched中的clock-delta是什么?

发布时间:2020-12-14 00:04:47 所属栏目:Linux 来源:网络整理
导读:main (xxxxx,#threads: xxxxx)---------------------------------------------------------se.exec_start : xxxxse.vruntime : xxxxse.sum_exec_runtime : xxxxse.wait_start : xxxx...policy : xxxxprio : xxxxclock-delta : 58 == this one 解决方法 我潜
main (xxxxx,#threads: xxxxx)
---------------------------------------------------------
se.exec_start                      :                 xxxx
se.vruntime                        :                 xxxx
se.sum_exec_runtime                :                 xxxx
se.wait_start                      :                 xxxx
...
policy                             :                 xxxx
prio                               :                 xxxx
clock-delta                        :                   58 <== this one

解决方法

我潜伏在内核源代码中,找出时钟增量表示的内容.

我发现在读取/ proc / pid / sched时将其打印出来的函数.

它是proc_sched_show_task,它位于kernel / sched / debug.c文件中.

深入了解我发现打印出时钟delta的代码部分…这里是:

unsigned int this_cpu = raw_smp_processor_id();
u64 t0,t1;

t0 = cpu_clock(this_cpu);
t1 = cpu_clock(this_cpu);
SEQ_printf(m,"%-35s:%21Ldn","clock-delta",(long long)(t1-t0));

raw_smp_processor_id返回运行当前线程的CPU的id.

所以… clock-delta是cpu_clock()返回的两个值之间的差值.

进入kernel / sched / clock.c我找到了这个函数的描述:

cpu_clock(i) provides a fast (execution time) high resolution clock with bounded drift between CPUs. The value of cpu_clock(i) is monotonic for constant i. The timestamp returned is in nanoseconds.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读