You need to take the difference over a period of time and then factor in the run occupancy.
Below two
perfstat_cpu_total_t data structures called cpu_tot_p and cpu_tot_q -> the current (p) and previous values (q)
#define DELTA(member) (cpu_tot_p->member - cpu_tot_q->member)
if (DELTA(runque) == 0 || DELTA(runocc) == 0)
pdouble("run_queue", 0.0);
else
pdouble("run_queue", ((double)(DELTA(runque))) / ((double)(DELTA(runocc)))); /* fixed */
I am nosy, what are you actually up to with this cost?
Perhaps, I have suggestions that could help.
Cheers Nigel @mr_nmon
------------------------------
Nigel Griffiths
------------------------------
Original Message:
Sent: Mon September 23, 2019 10:46 PM
From: Archive User
Subject: How to get runque from libperfstat?
Originally posted by: CK_
I tried to obtain "runque" values from libperfstat.
I get two pattern of value, both are different from the value of vmstat.
How can I get the value equivalent to vmstat(r)?
1. perfstat_cpu_total_t:runque
It is very large as runque length. Also, the result increases monotonically.
runque = 4769829
runque = 4769832
runque = 4769837
.....
2. perfstat_cpu_t:runque
It is output for each CPU.
The total value of runque is large than vmstat(r), as follows.
name = cpu0
runque = 2
name = cpu1
runque = 0
name = cpu2
runque = 0
name = cpu3
runque = 0
name = cpu4
runque = 0
name = cpu5
runque = 0
name = cpu6
runque = 0
name = cpu7
runque = 0
$ vmstat 1 1
System Configuration: lcpu=8 mem=29824MB
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
0 0 877859 5321674 0 0 0 0 0 0 9 1252 619 0 0 99 0
Thank you for your cooperation.