diff options
author | Daniel Hill <daniel@gluo.nz> | 2022-07-14 20:31:36 +1200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:35 -0400 |
commit | 25055c690f9ab3d4fb72b8a07323bf952c2682dc (patch) | |
tree | b1b3abbda9bffb0e4628516b4ea8170ccef59510 /fs/bcachefs/util.c | |
parent | 8bfe14e86a00a44eb7bfbeff1d7368e44c93bb7c (diff) |
bcachefs: bch2_time_stats_to_text now indents properly
Printbufs indentation feature doesn't yet work with '\n' and '\t'. So we've
replaced all instances of '\n' with prt_newline.
Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.c')
-rw-r--r-- | fs/bcachefs/util.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c index a2e42ae77371..cb07ef2ceb59 100644 --- a/fs/bcachefs/util.c +++ b/fs/bcachefs/util.c @@ -378,31 +378,37 @@ void bch2_time_stats_to_text(struct printbuf *out, struct bch2_time_stats *stats u64 q, last_q = 0; int i; - prt_printf(out, "count:\t\t%llu\n", + prt_printf(out, "count:\t\t%llu", stats->count); - prt_printf(out, "rate:\t\t%llu/sec\n", + prt_newline(out); + prt_printf(out, "rate:\t\t%llu/sec", freq ? div64_u64(NSEC_PER_SEC, freq) : 0); + prt_newline(out); prt_printf(out, "frequency:\t"); bch2_pr_time_units(out, freq); - prt_printf(out, "\navg duration:\t"); + prt_newline(out); + prt_printf(out, "avg duration:\t"); bch2_pr_time_units(out, stats->average_duration); - prt_printf(out, "\nmax duration:\t"); + prt_newline(out); + prt_printf(out, "max duration:\t"); bch2_pr_time_units(out, stats->max_duration); i = eytzinger0_first(NR_QUANTILES); u = pick_time_units(stats->quantiles.entries[i].m); - prt_printf(out, "\nquantiles (%s):\t", u->name); + prt_newline(out); + prt_printf(out, "quantiles (%s):\t", u->name); eytzinger0_for_each(i, NR_QUANTILES) { bool is_last = eytzinger0_next(i, NR_QUANTILES) == -1; q = max(stats->quantiles.entries[i].m, last_q); - prt_printf(out, "%llu%s", - div_u64(q, u->nsecs), - is_last ? "\n" : " "); + prt_printf(out, "%llu ", + div_u64(q, u->nsecs)); + if (is_last) + prt_newline(out); last_q = q; } } |