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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux