linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet@linux.dev>
To: Coly Li <colyli@suse.de>
Cc: linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org
Subject: Re: [PATCH 2/3] bcache: Convert to lib/time_stats
Date: Wed, 31 Aug 2022 12:54:37 -0400	[thread overview]
Message-ID: <20220831165437.l27raas6k5nlqsdg@moria.home.lan> (raw)
In-Reply-To: <14ACCED7-D24D-4AC4-8677-F7F4630A840A@suse.de>

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.

  reply	other threads:[~2022-08-31 16:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 16:53 Time stats library (from bcache/bcachefs) & generic latency instrumentation Kent Overstreet
2022-08-29 16:53 ` [PATCH 1/3] lib/time_stats: New library for statistics on events Kent Overstreet
2022-08-29 23:34   ` Randy Dunlap
2022-08-30  0:00     ` Kent Overstreet
2022-08-29 16:53 ` [PATCH 2/3] bcache: Convert to lib/time_stats Kent Overstreet
2022-08-31 16:00   ` Coly Li
2022-08-31 16:54     ` Kent Overstreet [this message]
2022-08-31 17:02       ` Coly Li
2022-08-31 17:36         ` Kent Overstreet
2022-09-01  2:19           ` Coly Li
2022-08-29 16:53 ` [PATCH 3/3] Code tagging based latency tracking Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220831165437.l27raas6k5nlqsdg@moria.home.lan \
    --to=kent.overstreet@linux.dev \
    --cc=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).