File s390-tools-sles16sp0-chpstat-Fix-scaling-of-DPU-utilization-calculation.patch of Package s390-tools
Subject: [PATCH] [BZ 214726] chpstat: Fix DPU utilization scaling in reports
From: Peter Oberparleiter <oberpar@linux.ibm.com>
Description: chpstat: Fix DPU utilization scaling in reports
Symptom: chpstat reports incorrect values in the DPU utilization
columns for channel-paths associated with the IBM z17
DPU (Data Processing Unit) hardware component.
Problem: DPU utilization values are reported as fractions in the range
0..1 while they are expected to be reported as percentage in the
range 0..100.
Solution: Adjust DPU utilization reporting to use percentage scaling.
Reproduction: Run 'chpstat --cmg 4,5 --format json' on IBM z17 systems and
observe fields named 'dpu_util*'.
Upstream-ID: e1692b7079ae1e5b8d829dcca2f26dbc44110944
Conflicts: None
Problem-ID: 214726
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
zconf/chp/chpstat/cmg4.c | 12 ++++++++----
zconf/chp/chpstat/cmg5.c | 12 ++++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
--- a/zconf/chp/chpstat/cmg4.c
+++ b/zconf/chp/chpstat/cmg4.c
@@ -281,13 +281,17 @@ static void calc_ext_metrics(struct cmg_
if (cmcb->dpu_num_cores == 0)
return;
- /* dpu_util = dpu_exec_time_cpc / (t * dpu_num_cores) */
+ /* dpu_util = 100 * dpu_exec_time_cpc / (t * dpu_num_cores) */
delta = field_delta(dpu_exec_time_cpc, ext_a, ext_b);
- m->dpu_util = delta / ((double)ticks * cmcb->dpu_num_cores);
+ m->dpu_util = 100.0 * delta / ((double)ticks * cmcb->dpu_num_cores);
- /* dpu_util_total = dpu_channel_exec_time_cpc / (t * dpu_num_cores) */
+ /*
+ * dpu_util_total = 100 * dpu_channel_exec_time_cpc /
+ * (t * dpu_num_cores)
+ */
delta = field_delta(dpu_channel_exec_time_cpc, ext_a, ext_b);
- m->dpu_util_total = delta / ((double)ticks * cmcb->dpu_num_cores);
+ m->dpu_util_total = 100.0 * delta /
+ ((double)ticks * cmcb->dpu_num_cores);
/* dpu_util_part = dpu_util_total * channel_work_units /
* channel_work_units_cpc */
--- a/zconf/chp/chpstat/cmg5.c
+++ b/zconf/chp/chpstat/cmg5.c
@@ -350,13 +350,17 @@ static void calc_ext_metrics(struct cmg_
if (cmcb->dpu_num_cores == 0)
return;
- /* dpu_util = dpu_exec_time_cpc / (t * dpu_num_cores) */
+ /* dpu_util = 100 * dpu_exec_time_cpc / (t * dpu_num_cores) */
delta = field_delta(dpu_exec_time_cpc, ext_a, ext_b);
- m->dpu_util = delta / ((double)ticks * cmcb->dpu_num_cores);
+ m->dpu_util = 100.0 * delta / ((double)ticks * cmcb->dpu_num_cores);
- /* dpu_util_total = dpu_channel_exec_time_cpc / (t * dpu_num_cores) */
+ /*
+ * dpu_util_total = 100 * dpu_channel_exec_time_cpc /
+ * (t * dpu_num_cores)
+ */
delta = field_delta(dpu_channel_exec_time_cpc, ext_a, ext_b);
- m->dpu_util_total = delta / ((double)ticks * cmcb->dpu_num_cores);
+ m->dpu_util_total = 100.0 * delta /
+ ((double)ticks * cmcb->dpu_num_cores);
/* dpu_util_part = dpu_util_total * channel_work_units /
* channel_work_units_cpc */