Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp752688rwe; Wed, 31 Aug 2022 10:18:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/T4jS6IbU2HpvSpZ15hdOkEh+r/X/s9CtpPgYkFZE0k5P2t9MPhM18TNPIS4h3EaDQW8p X-Received: by 2002:a17:90b:1648:b0:1fa:81bb:aefe with SMTP id il8-20020a17090b164800b001fa81bbaefemr4359118pjb.57.1661966337302; Wed, 31 Aug 2022 10:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661966337; cv=none; d=google.com; s=arc-20160816; b=tnf8ia5JvcIW4kVs7NDIL1cbZwMnku8jKswo+0qZA2YISo3/nxJtfyq/adoSg6K4AE Gf1P67X4lrwJqjs+UFnyr9rJrYyC6ZuMxs+KCxQ8r6K4rGAkwv6TNRAO1dI/u4t8ACES Kp5rQuujDSxCBt7kKBnaRgkCz7QGOyQnSSYhOiZWIw7WLKr3rU1FVhpXNXnNwbvaBq3f JZK3YzsqUh5LND7sz8rkfKXB75/Cqe0ik0uPKZ/UVaxIjGJGx/X4wvoujUZOKxcg5m+2 WYra6WFp0h2UiYA1efelsIu5+u+aWzkLySEu0GLOdRqZzEYSwQky9M31+dAyIPiCUJHR wJ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=JEP5P0FivNXzUzqKfDvRWYdY+bpNYj7QyhA+GvUOAA8=; b=XYm4o8jVoY2wTWN2Db1aZDZe2qxhqDpDGs+Z+zU6TT8itHvOT5s+NbsYf9tDalR4Mo HgqOvsym6L8YjcJ+Uskt/6DY5NoCgsUxugm6LIkUBfDo6tnR0Tb9SDaNJ3qLDbv4+TII T/y5nm0YHumDRrOmeW1qJ4fBrY8rm3Jw6nx4CNgGbLhryZ/jsPWtex71Xj3EGLQK7fIb n1LK9CX2WA/lkD1u65l5mSWr6QGUC5JpEkWX8DKi8lcesGjcYLIuFhWgp2fyuM9MG0nx 6PXtqdKaeuT3cb1777E1YcJQ0Rfbmzpm/u+AN71d3vLeIpKabYbNK84jN5MJdRiO+XvK a+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oy8BDHTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qe17-20020a17090b4f9100b001fafaf2e8fesi2494260pjb.104.2022.08.31.10.18.46; Wed, 31 Aug 2022 10:18:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oy8BDHTF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbiHaQyz (ORCPT + 99 others); Wed, 31 Aug 2022 12:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiHaQyx (ORCPT ); Wed, 31 Aug 2022 12:54:53 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19BB9D31FE; Wed, 31 Aug 2022 09:54:43 -0700 (PDT) Date: Wed, 31 Aug 2022 12:54:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661964881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JEP5P0FivNXzUzqKfDvRWYdY+bpNYj7QyhA+GvUOAA8=; b=oy8BDHTFcP2BrlGTXifpszllUxXH86Pv/uhrb5Vvx0qLa2JoLx3g7wnt0nSOLOMYEKiDJs 2NCmMsw9mPuD8JADSvOWhLRPmi8UBEOqVzwFjz54BQPN6frJC8u3+q+B989+uxgznTkBGn hijZJCZAL0cuRmj5HQ86K6BZfEcahIU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Coly Li Cc: linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org Subject: Re: [PATCH 2/3] bcache: Convert to lib/time_stats Message-ID: <20220831165437.l27raas6k5nlqsdg@moria.home.lan> References: <20220829165344.2958640-1-kent.overstreet@linux.dev> <20220829165344.2958640-3-kent.overstreet@linux.dev> <14ACCED7-D24D-4AC4-8677-F7F4630A840A@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <14ACCED7-D24D-4AC4-8677-F7F4630A840A@suse.de> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 01, 2022 at 12:00:17AM +0800, Coly Li wrote: > > > > 2022年8月30日 00:53,Kent Overstreet 写道: > > > > 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 > > Cc: Coly Li > > Hi Kent, > > Overall I am OK with the change to bcache code. You may add > Acked-by: Coly Li > 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.