Hi all, This series reduces the memory consumption of individual time_stats objects, and adds reporting of how long each stat counter has been making observations. It's a prep patch for adding some counters to XFS, for which we'll want as low overhead as possible to maximimze shotgunning effect. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=timestats-cleanups --- Commits in this patchset: * time_stats: report lifetime of the stats object * time_stats: split stats-with-quantiles into a separate structure * time_stats: fix struct layout bloat * time_stats: add larger units * time_stats: don't print any output if event count is zero * time_stats: allow custom epoch names * mean_and_variance: put struct mean_and_variance_weighted on a diet * time_stats: shrink time_stat_buffer for better alignment * time_stats: report information in json format * time_stats: Kill TIME_STATS_HAVE_QUANTILES --- fs/bcachefs/bcachefs.h | 2 - fs/bcachefs/io_write.c | 2 - fs/bcachefs/super.c | 10 +-- fs/bcachefs/sysfs.c | 4 + fs/bcachefs/util.c | 15 ++-- include/linux/mean_and_variance.h | 14 ++-- include/linux/time_stats.h | 43 ++++++++++- lib/math/mean_and_variance.c | 28 +++++-- lib/math/mean_and_variance_test.c | 80 +++++++++++--------- lib/time_stats.c | 148 +++++++++++++++++++++++++++++++------ 10 files changed, 248 insertions(+), 98 deletions(-)