Skip to contentSkip to conversation

libtraceeval: Do not update stats if both the timestamp and value are zero

PATCH New Steven Rostedt 1 participant 1 message Oct 10, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtraceeval: Do not update stats if both the timestamp and value are zero

From: "Steven Rostedt (Google)" <[email protected]>

If the timestamp and the value are both zero, the stats will not be updated. We may in the future add a way to allow it to add zero of both, but in most case, a delta of zero is pretty meaningless.

---
 src/histograms.c | 4 ++++
 1 file changed, 4 insertions(+)
src/histograms.c +4 -0
index 480b78da606b..4e03c967dca3 100644
@@ -538,6 +538,10 @@ __hidden void _teval_update_stat(struct traceeval_type *type,
 				 unsigned long long val,
 				 unsigned long long ts)
 {
+	/* If both the delta and the timestamp are zero, ignore this */
+	if (!val && !ts)
+		return;
+
 	if (!stat->count++) {
 		stat->max = val;
 		stat->min = val;
Signature · 1 line
2.42.0