summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-02-01 21:01:02 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-02-01 21:01:24 -0500
commit291c109084ad3e247ff13728f18cc7290d5220ab (patch)
treedad8c3ba8dea340593f5cbd81c9d778a380f9cda
parentc6b1fccba07757a4dc458c0016e137d9a3d2b983 (diff)
time_stats: Check for last_event == 0 when updating freq stats
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--lib/time_stats.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/time_stats.c b/lib/time_stats.c
index 1426d76e7756..4c5310dc6ca8 100644
--- a/lib/time_stats.c
+++ b/lib/time_stats.c
@@ -79,14 +79,15 @@ static inline void time_stats_update_one(struct time_stats *stats,
quantiles_update(&stats->quantiles, duration);
}
- if (time_after64(end, stats->last_event)) {
+ if (stats->last_event && time_after64(end, stats->last_event)) {
freq = end - stats->last_event;
mean_and_variance_update(&stats->freq_stats, freq);
mean_and_variance_weighted_update(&stats->freq_stats_weighted, freq);
stats->max_freq = max(stats->max_freq, freq);
stats->min_freq = min(stats->min_freq, freq);
- stats->last_event = end;
}
+
+ stats->last_event = end;
}
void __time_stats_clear_buffer(struct time_stats *stats,