From e1692b7079ae1e5b8d829dcca2f26dbc44110944 Mon Sep 17 00:00:00 2001 From: Peter Oberparleiter Date: Fri, 8 Aug 2025 14:47:22 +0200 Subject: [PATCH] chpstat: Fix scaling of DPU utilization calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit chpstat incorrectly reports DPU utilization as fraction instead of percent. Fix this by scaling utilization values to 100%. Reviewed-by: Jan Höppner Reviewed-by: Vineeth Vijayan Signed-off-by: Peter Oberparleiter Signed-off-by: Jan Höppner --- zconf/chp/chpstat/cmg4.c | 12 ++++++++---- zconf/chp/chpstat/cmg5.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/zconf/chp/chpstat/cmg4.c b/zconf/chp/chpstat/cmg4.c index 0f47787d..615fb001 100644 --- a/zconf/chp/chpstat/cmg4.c +++ b/zconf/chp/chpstat/cmg4.c @@ -281,13 +281,17 @@ static void calc_ext_metrics(struct cmg_data_t *data, u32 ticks) 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 */ diff --git a/zconf/chp/chpstat/cmg5.c b/zconf/chp/chpstat/cmg5.c index 804e938c..d429a90e 100644 --- a/zconf/chp/chpstat/cmg5.c +++ b/zconf/chp/chpstat/cmg5.c @@ -350,13 +350,17 @@ static void calc_ext_metrics(struct cmg_data_t *data, double seconds, u32 ticks) 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 */