Skip to content

Commit d355725

Browse files
mg12gangj
authored andcommitted
CP-308465: RRD metric "runnable_vcups": rebase on top of xen.spec/PR#481
Query runstate with the new API: Xenctrl.Runstateinfo.V2.domain_get Signed-off-by: Marcus Granado <[email protected]>
1 parent 2c8c7c7 commit d355725

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

ocaml/xcp-rrdd/bin/rrdp-cpu/rrdp_cpu.ml

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ let dss_vcpus xc doms =
5959
in
6060
let ( ++ ) = Int64.add in
6161
try
62-
let ri = Xenctrl.domain_get_runstate_info xc domid in
62+
let ri = Xenctrl.Runstateinfo.V2.domain_get xc domid in
6363
let runnable_vcpus_ds =
64-
match ri.Xenctrl.runnable with
64+
match ri.Xenctrl.Runstateinfo.V2.runnable with
6565
| 0L ->
6666
[]
6767
| _ ->
@@ -70,7 +70,9 @@ let dss_vcpus xc doms =
7070
, Ds.ds_make ~name:"runnable_vcpus" ~units:"(fraction)"
7171
~value:
7272
(Rrd.VT_Float
73-
(Int64.to_float ri.Xenctrl.runnable /. 1.0e9)
73+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.runnable
74+
/. 1.0e9
75+
)
7476
)
7577
~description:
7678
"Fraction of time that vCPUs of the domain are runnable"
@@ -80,13 +82,19 @@ let dss_vcpus xc doms =
8082
in
8183
( Rrd.VM uuid
8284
, Ds.ds_make ~name:"runstate_fullrun" ~units:"(fraction)"
83-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time0 /. 1.0e9))
85+
~value:
86+
(Rrd.VT_Float
87+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time0 /. 1.0e9)
88+
)
8489
~description:"Fraction of time that all vCPUs are running"
8590
~ty:Rrd.Derive ~default:false ~min:0.0 ~max:1.0 ()
8691
)
8792
:: ( Rrd.VM uuid
8893
, Ds.ds_make ~name:"runstate_full_contention" ~units:"(fraction)"
89-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time1 /. 1.0e9))
94+
~value:
95+
(Rrd.VT_Float
96+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time1 /. 1.0e9)
97+
)
9098
~description:
9199
"Fraction of time that all vCPUs are runnable (i.e., \
92100
waiting for CPU)"
@@ -95,22 +103,31 @@ let dss_vcpus xc doms =
95103
:: ( Rrd.VM uuid
96104
, Ds.ds_make ~name:"runstate_concurrency_hazard"
97105
~units:"(fraction)"
98-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time2 /. 1.0e9))
106+
~value:
107+
(Rrd.VT_Float
108+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time2 /. 1.0e9)
109+
)
99110
~description:
100111
"Fraction of time that some vCPUs are running and some are \
101112
runnable"
102113
~ty:Rrd.Derive ~default:false ~min:0.0 ~max:1.0 ()
103114
)
104115
:: ( Rrd.VM uuid
105116
, Ds.ds_make ~name:"runstate_blocked" ~units:"(fraction)"
106-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time3 /. 1.0e9))
117+
~value:
118+
(Rrd.VT_Float
119+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time3 /. 1.0e9)
120+
)
107121
~description:
108122
"Fraction of time that all vCPUs are blocked or offline"
109123
~ty:Rrd.Derive ~default:false ~min:0.0 ~max:1.0 ()
110124
)
111125
:: ( Rrd.VM uuid
112126
, Ds.ds_make ~name:"runstate_partial_run" ~units:"(fraction)"
113-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time4 /. 1.0e9))
127+
~value:
128+
(Rrd.VT_Float
129+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time4 /. 1.0e9)
130+
)
114131
~description:
115132
"Fraction of time that some vCPUs are running and some are \
116133
blocked"
@@ -119,7 +136,10 @@ let dss_vcpus xc doms =
119136
:: ( Rrd.VM uuid
120137
, Ds.ds_make ~name:"runstate_partial_contention"
121138
~units:"(fraction)"
122-
~value:(Rrd.VT_Float (Int64.to_float ri.Xenctrl.time5 /. 1.0e9))
139+
~value:
140+
(Rrd.VT_Float
141+
(Int64.to_float ri.Xenctrl.Runstateinfo.V2.time5 /. 1.0e9)
142+
)
123143
~description:
124144
"Fraction of time that some vCPUs are runnable and some are \
125145
blocked"
@@ -130,9 +150,9 @@ let dss_vcpus xc doms =
130150
~value:
131151
(Rrd.VT_Float
132152
(Int64.to_float
133-
(ri.Xenctrl.time1
134-
++ ri.Xenctrl.time2
135-
++ ri.Xenctrl.time5
153+
(ri.Xenctrl.Runstateinfo.V2.time1
154+
++ ri.Xenctrl.Runstateinfo.V2.time2
155+
++ ri.Xenctrl.Runstateinfo.V2.time5
136156
)
137157
/. 1.0e9
138158
)

0 commit comments

Comments
 (0)