Linux-Trace-Devel Archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Ross Zwisler <zwisler@google.com>
Subject: [PATCH] libtraceeval: Do not update stats if both the timestamp and value are zero
Date: Tue, 10 Oct 2023 15:54:27 -0400	[thread overview]
Message-ID: <20231010155427.4822d4d7@gandalf.local.home> (raw)

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 --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;
-- 
2.42.0


                 reply	other threads:[~2023-10-10 19:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231010155427.4822d4d7@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=zwisler@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).