[DTrace-devel] [PATCH] Simplify code to match aggregation key

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Aug 15 01:16:51 UTC 2023


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 libdtrace/dt_aggregate.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/libdtrace/dt_aggregate.c b/libdtrace/dt_aggregate.c
index 7c09908d..05f41f5d 100644
--- a/libdtrace/dt_aggregate.c
+++ b/libdtrace/dt_aggregate.c
@@ -522,14 +522,8 @@ dt_aggregate_snap_one(dtrace_hdl_t *dtp, int aggid, int cpu, const char *key,
 			continue;
 
 		/* Aggregation key needs to match.  */
-		ptr = agd->dtada_key;
-		for (i = 0; i < agg->dtagd_nkrecs; i++) {
-			rec = &agg->dtagd_krecs[i];
-			off = rec->dtrd_offset;
-
-			if (memcmp(&key[off], &ptr[off], rec->dtrd_size) != 0)
-				goto hashnext;
-		}
+		if (memcmp(key, agd->dtada_key, agg->dtagd_ksize))
+			goto hashnext;
 
 		/*
 		 * Clear hash data (and update its gen) if the data gen is
-- 
2.18.4




More information about the DTrace-devel mailing list