perf hists: Don't decay total_period for filtered entries
[firefly-linux-kernel-4.4.55.git] / tools / perf / util / hist.c
index 75526d123eb2da4d2a3129681250c50947842d91..1f269fd48944716daa3ba0821e6e87936d7b861b 100644 (file)
@@ -105,11 +105,16 @@ static void hist_entry__decay(struct hist_entry *he)
 
 static bool hists__decay_entry(struct hists *hists, struct hist_entry *he)
 {
-       if (he->period == 0)
+       u64 prev_period = he->period;
+
+       if (prev_period == 0)
                return true;
-       hists->stats.total_period -= he->period;
+
        hist_entry__decay(he);
-       hists->stats.total_period += he->period;
+
+       if (!he->filtered)
+               hists->stats.total_period -= prev_period - he->period;
+
        return he->period == 0;
 }