diff mbox series

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

Message ID 20231010155427.4822d4d7@gandalf.local.home (mailing list archive)
State Under Review
Headers show
Series libtraceeval: Do not update stats if both the timestamp and value are zero | expand

Commit Message

Steven Rostedt Oct. 10, 2023, 7:54 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

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.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/histograms.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/src/histograms.c b/src/histograms.c
index 480b78da606b..4e03c967dca3 100644
--- a/src/histograms.c
+++ b/src/histograms.c
@@ -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;