[DTrace-devel] [PATCH 46/61] Change aid to act in dt_agg_one_agg()

eugene.loh at oracle.com eugene.loh at oracle.com
Fri Jul 8 14:45:30 UTC 2022


From: Eugene Loh <eugene.loh at oracle.com>

---
 libdtrace/dt_aggregate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libdtrace/dt_aggregate.c b/libdtrace/dt_aggregate.c
index ccd1934b..191aef52 100644
--- a/libdtrace/dt_aggregate.c
+++ b/libdtrace/dt_aggregate.c
@@ -417,7 +417,7 @@ typedef struct dt_snapstate {
 } dt_snapstate_t;
 
 static void
-dt_agg_one_agg(dt_ident_t *aid, int64_t *dst, int64_t *src, uint_t realsz)
+dt_agg_one_agg(uint_t act, int64_t *dst, int64_t *src, uint_t realsz)
 {
 	uint_t i, cnt;
 
@@ -425,7 +425,7 @@ dt_agg_one_agg(dt_ident_t *aid, int64_t *dst, int64_t *src, uint_t realsz)
 		return;
 
 	src++;  /* skip latch sequence number */
-	switch (((dt_ident_t *)aid->di_iarg)->di_id) {
+	switch (act) {
 	case DT_AGG_MAX:
 		if (*src > *dst)
 			*dst = *src;
@@ -475,19 +475,22 @@ dt_aggregate_snap_one(dt_idhash_t *dhp, dt_ident_t *aid, dt_snapstate_t *st)
 
 	/* See if we already have an entry for this aggregation. */
 	for (h = agh->dtah_hash[ndx]; h != NULL; h = h->dtahe_next) {
+		uint_t act;
+
 		if (h->dtahe_hval != hval || h->dtahe_size != agg->dtagd_size)
 			continue;
 
 		/* Entry found - process the data. */
 		agd = &h->dtahe_data;
+		act = ((dt_ident_t *)aid->di_iarg)->di_id;
 
 		rec = &agg->dtagd_recs[nrecs - 1];
-		dt_agg_one_agg(aid, (int64_t *)(agd->dtada_data + rec->dtrd_offset),
+		dt_agg_one_agg(act, (int64_t *)(agd->dtada_data + rec->dtrd_offset),
 			       src, datasz);
 
 		/* If we keep per-CPU data - process that as well. */
 		if (agd->dtada_percpu != NULL)
-			dt_agg_one_agg(aid, (int64_t *)agd->dtada_percpu[st->cpu],
+			dt_agg_one_agg(act, (int64_t *)agd->dtada_percpu[st->cpu],
 			    src, datasz);
 
 		return 0;
-- 
2.18.4




More information about the DTrace-devel mailing list