summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-05 13:47:09 -0800
committerKent Overstreet <kent.overstreet@linux.dev>2025-03-07 16:16:26 -0500
commitacd3ad2f80ca86ba56390772bbdaab81cc13a64a (patch)
tree7336c64a1c9a80e87ce0a213490942688c0a3152
parent743a26ab5d3c1ddb50131835cfcf537499b0f7bd (diff)
time_stats: allow custom epoch names
Let callers of time_stats_to_seq_buf define the epoch name; "mount" doesn't make sense generally. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/time_stats.c4
-rw-r--r--fs/bcachefs/time_stats.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/fs/bcachefs/time_stats.c b/fs/bcachefs/time_stats.c
index 12ef0c42eebb..8d2795fbdc19 100644
--- a/fs/bcachefs/time_stats.c
+++ b/fs/bcachefs/time_stats.c
@@ -180,7 +180,7 @@ static inline u64 time_stats_lifetime(const struct bch2_time_stats *stats)
}
void bch2_time_stats_to_seq_buf(struct seq_buf *out, struct bch2_time_stats *stats,
- unsigned int flags)
+ const char *epoch_name, unsigned int flags)
{
struct quantiles *quantiles = time_stats_to_quantiles(stats);
s64 f_mean = 0, d_mean = 0;
@@ -212,7 +212,7 @@ void bch2_time_stats_to_seq_buf(struct seq_buf *out, struct bch2_time_stats *sta
seq_buf_time_units_aligned(out, lifetime);
seq_buf_printf(out, "\n");
- seq_buf_printf(out, " since mount recent\n");
+ seq_buf_printf(out, " since %-12s recent\n", epoch_name);
seq_buf_printf(out, "duration of events\n");
diff --git a/fs/bcachefs/time_stats.h b/fs/bcachefs/time_stats.h
index 27c328360937..a8483c81da9a 100644
--- a/fs/bcachefs/time_stats.h
+++ b/fs/bcachefs/time_stats.h
@@ -147,7 +147,8 @@ void bch2_time_stats_reset(struct bch2_time_stats *);
#define TIME_STATS_PRINT_NO_ZEROES (1U << 0) /* print nothing if zero count */
struct seq_buf;
-void bch2_time_stats_to_seq_buf(struct seq_buf *, struct bch2_time_stats *, unsigned int);
+void bch2_time_stats_to_seq_buf(struct seq_buf *, struct bch2_time_stats *,
+ const char *epoch_name, unsigned int flags);
void bch2_time_stats_exit(struct bch2_time_stats *);
void bch2_time_stats_init(struct bch2_time_stats *);