summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/time_stats.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-01 12:41:42 -0800
committerKent Overstreet <kent.overstreet@linux.dev>2024-03-13 21:38:01 -0400
commit273960b8f374b95ebd234a99607b7887f515c791 (patch)
treeb50ec6f9658860cb3930b675b4b8cf5a9937bf2b /fs/bcachefs/time_stats.c
parent4b4f0876ab74167cc402ccd5ce9154e7dc666829 (diff)
downloadlinux-273960b8f374b95ebd234a99607b7887f515c791.tar.gz
linux-273960b8f374b95ebd234a99607b7887f515c791.tar.bz2
linux-273960b8f374b95ebd234a99607b7887f515c791.zip
bcachefs: time_stats: split stats-with-quantiles into a separate structure
Currently, struct time_stats has the optional ability to quantize the information that it collects. This is /probably/ useful for callers who want to see quantized information, but it more than doubles the size of the structure from 224 bytes to 464. For users who don't care about that (e.g. upcoming xfs patches) and want to avoid wasting 240 bytes per counter, split the two into separate pieces. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/time_stats.c')
-rw-r--r--fs/bcachefs/time_stats.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/time_stats.c b/fs/bcachefs/time_stats.c
index 4ac6ebfd264c..4508e9dcbee2 100644
--- a/fs/bcachefs/time_stats.c
+++ b/fs/bcachefs/time_stats.c
@@ -73,6 +73,8 @@ static inline void time_stats_update_one(struct bch2_time_stats *stats,
bool initted = stats->last_event != 0;
if (time_after64(end, start)) {
+ struct quantiles *quantiles = time_stats_to_quantiles(stats);
+
duration = end - start;
mean_and_variance_update(&stats->duration_stats, duration);
mean_and_variance_weighted_update(&stats->duration_stats_weighted,
@@ -81,8 +83,8 @@ static inline void time_stats_update_one(struct bch2_time_stats *stats,
stats->min_duration = min(stats->min_duration, duration);
stats->total_duration += duration;
- if (stats->quantiles_enabled)
- quantiles_update(&stats->quantiles, duration);
+ if (quantiles)
+ quantiles_update(quantiles, duration);
}
if (stats->last_event && time_after64(end, stats->last_event)) {