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

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:%21Ld\n",
           "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.

转载注明原文:linux – / proc / pid / sched中的clock-delta是什么? - 代码日志