[Crash-utility] Calculating CPU time consumed by a process in its current run

sandeep kumar Mantrala sandeep.mvd at gmail.com
Wed Dec 23 09:50:28 UTC 2020


I see an option in runq to check the time of the processes in the runq

help runq
     -m  Display the amount of time that the active task on each cpu has
been
         running, expressed in a format consisting of days, hours, minutes,
         seconds and milliseconds.

Is this time the time the process has been running in this instance? Or is
it the complete time the process had CPU?

Example :

crash> runq -m
 CPU 0: [0 00:00:00.000]  PID: 48     TASK: ffff88045a0bcd80  COMMAND:
"khungtaskd"
 CPU 1: [0 00:00:02.155]  PID: 21     TASK: ffff88045a74ec80  COMMAND:
"ksoftirqd/1"
 CPU 2: [2 08:03:10.267]  PID: 0      TASK: ffff88045a71ec80  COMMAND:
"swapper/2"
 CPU 3: [2 08:03:10.267]  PID: 0      TASK: ffff88045a748000  COMMAND:
"swapper/3"


For ksoftirqd/1 it says the time is 2 seconds 155 ms
What exactly is this time? The time in the current run or is it the
complete CPU time of this process since boot?

-------

Also I was trying to find the same using task_struct
crash> task 21
...
    exec_start = 201790266578639,
    sum_exec_runtime = 264131400786,
    vruntime = 18446744073703683341,
    prev_sum_exec_runtime = 35796104514,
...

it seems like, sum_exec_runtime - prev_sum_exec_runtime should give me the
time(in ns) that this process has been running in its current run

sum_exec_runtime - prev_sum_exec_runtime = 264131400786 - 35796104514 = 228
seconds

228 seconds is very different from what i see in runq -m

Can I please get some help on understanding and interpreting these times?
Any alternate methods will also be very helpful.

Thank you

Sandeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20201223/eeec749d/attachment.htm>


More information about the Crash-utility mailing list