From e6dbcea3cec47d3efa22f030ae4eaa7746f0404b Mon Sep 17 00:00:00 2001 From: "Christopher J. Morrone" Date: Thu, 15 Aug 2024 13:04:23 -0700 Subject: [PATCH] decomp_static: call ldmsd_row_cache_make_list() just once We only need to generate the row cache list once before iterating over the columns in the rows. We don't need to fully regenerate the list for each operation. --- ldms/src/decomp/static/decomp_static.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ldms/src/decomp/static/decomp_static.c b/ldms/src/decomp/static/decomp_static.c index 9e6155f46..f8e5b6c8e 100644 --- a/ldms/src/decomp/static/decomp_static.c +++ b/ldms/src/decomp/static/decomp_static.c @@ -1805,13 +1805,13 @@ static int decomp_static_decompose(ldmsd_strgp_t strgp, ldms_set_t set, dup_row = row_cache_dup(cfg_row, mid_rbn, row); /* Apply functional operators to columns */ + struct ldmsd_row_list_s tmp_row_list; + int count; + count = ldmsd_row_cache_make_list(&tmp_row_list, + cfg_row->row_limit, + strgp->row_cache, + group_idx); for (j = 0; j < row->col_count; j++) { - struct ldmsd_row_list_s row_list; - int count = ldmsd_row_cache_make_list( - &row_list, - cfg_row->row_limit, - strgp->row_cache, - group_idx); cfg_col = &cfg_row->cols[j]; if (cfg_col->op != LDMSD_DECOMP_OP_NONE && count < cfg_row->row_limit) @@ -1822,7 +1822,7 @@ static int decomp_static_decompose(ldmsd_strgp_t strgp, ldms_set_t set, strgp->obj.name, count, cfg_row->row_limit, ldmsd_decomp_op_to_string(cfg_col->op), cfg_col->dst); - rc = op_table[cfg_col->op](&row_list, dup_row, j); + rc = op_table[cfg_col->op](&tmp_row_list, dup_row, j); } ldmsd_row_cache_idx_free(group_idx); row = dup_row;