lkml.org 
[lkml]   [2022]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] bcache: Convert to lib/time_stats
On Thu, Sep 01, 2022 at 12:00:17AM +0800, Coly Li wrote:
>
>
> > 2022年8月30日 00:53,Kent Overstreet <kent.overstreet@linux.dev> 写道:
> >
> > This patch converts bcache to the new generic time_stats code
> > lib/time_stats.c. The new code is from bcachefs, and has some changes
> > from the version in bcache:
> >
> > - we now use ktime_get_ns(), not local_clock(). When the code was
> > originally written multi processor systems that lacked synchronized
> > TSCs were still common, and so local_clock() was much cheaper than
> > sched_clock() (though not necessarily fully accurate, due to TSC
> > drift). ktime_get_ns() should be cheap enough on all common hardware
> > now, and more standard/correct.
> >
> > - time_stats are now exported in a single file in sysfs, which means we
> > can improve the statistics we keep track of without changing all
> > users. This also means we don't have to manually specify which units
> > (ms, us, ns) a given time_stats should be printed in; that's handled
> > dynamically.
> >
> > - There's a lazily-allocated percpu buffer, which now needs to be freed
> > with time_stats_exit().
> >
> > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> > Cc: Coly Li <colyli@suse.de>
>
> Hi Kent,
>
> Overall I am OK with the change to bcache code. You may add
> Acked-by: Coly Li <colyli@suse.de>
> in future version of this patch.
>
> In bcache-tools, they don’t read the changed sysfs files (including bcache-status), IMHO changing the output format won’t be problem for upstream.
>
> My only question is, how to understand the time_stats_to_text() output format,
> count: 3
> rate: 0/sec
> frequency: 4 sec
> avg duration: 4 sec
> max duration: 4 sec
> quantiles (ns): 0 4288669120 4288669120 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048 5360836048
>
> Fro the above output, what are “rate”, “frequence” and “quantiles” for?

Rate and frequency are inverses - in this example, we're seeing 4 events per
second.

The quantiles are for the duration, they give you an idea of the statistical
distribution, see https://en.wikipedia.org/wiki/Quantile

In the near future, the quantiles will be removed and replaced with standard
deviation, true and weighted - the quantiles algorithm isn't super accurate, we
can give more accurate numbers with standard deviation.

\
 
 \ /
  Last update: 2022-08-31 18:55    [W:0.068 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site