Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4505443ybv; Mon, 17 Feb 2020 00:08:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxZ91Zh1KQT2y4oEcOYB9ioNyibqC1umRjQ2vd88oav3eGoOi+SfS7GuNirfsO63+FEQE7Z X-Received: by 2002:a9d:7e99:: with SMTP id m25mr11088728otp.212.1581926918773; Mon, 17 Feb 2020 00:08:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581926918; cv=none; d=google.com; s=arc-20160816; b=ivai7sV+Q3/OequWplEkZkP4OKdFshsU97CNYnhJqG1awlleHqNU8zvJWc2BHkXs3C OaPWfMyY5CKNzHO2oU77B3NoSAWUv8xNI0EFpAtTYnU2XYUIuagmzaBGzh4JdcXQqT5R VGcAY7wrANYPgXS9hldU6epRICO1e+lJuhZC/EmYT8+7udX07CQmQb05VFybS0AgUjRG dN0ZeMvVFLhCKhJCLuxVkhFnBxKIbKlA7v0zxyn3YH9uBsXLcE6mSaowqSf2UzjL+YyA QVOnNKeyv3D2IXCW4dz0zyBY7gKyOl5GYJtQt0rJvc16TRO2loyiRf+QL7euygQ9FOV1 OM6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=m/+/n4nKdd6a3QaIQn+kABsYPxk1qwGLG1UGHCPxHrM=; b=gd2AhHfXcYh75oXzGGbFv8B9z9EDcEmzVA4OxqPFYDNlmZ5Am4lpIKyoDCT88oAOkf Sp0d3dyIdAvGM2ClxmZgBwizcA3AmEdrSVfKVjLZcfo7MEe1Vp87JnRhLOE5W7/n/+GP VR1tnEMwWHO8gcRqTkeDm/nM0GGsFeiap6yHA1sny+iAzGOpOzxrwOrxMFEeLD5Azlfa /WsDDeqKP/drdAXv4FR9Jp4XotyrBVjrRh9mbcFdIG/0oHntRxh5i5NG4upDr9Jxwdn0 hQn6+W75T78ssnjU78+p2D+ShSOsjUqtFttw+RI4N/ng/zEZd59KDp4xkpz6U+hkFye/ PJ/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si7242056oto.74.2020.02.17.00.08.26; Mon, 17 Feb 2020 00:08:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727485AbgBQIIH (ORCPT + 99 others); Mon, 17 Feb 2020 03:08:07 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:34338 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726996AbgBQIIH (ORCPT ); Mon, 17 Feb 2020 03:08:07 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 54AC2452F8F2324C5EA2; Mon, 17 Feb 2020 16:08:00 +0800 (CST) Received: from [127.0.0.1] (10.65.95.32) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Mon, 17 Feb 2020 16:07:51 +0800 Subject: Re: [PATCH] Perf stat: Fix the ratio comments of cache miss-events To: Lin Feng , , , , , References: <20200213085540.14998-1-linf@wangsu.com> CC: From: Qi Liu Message-ID: Date: Mon, 17 Feb 2020 16:07:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20200213085540.14998-1-linf@wangsu.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.65.95.32] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This modification seems fine for me, thanks for your work! On 2020/2/13 16:55, Lin Feng wrote: > Perf stat displays miss ratio of L1-dcache, L1-icache, dTLB cache, > iTLB cache and LL-cache, while the comments for them seem a bit > misleading. Take L1-dcache for example, its miss ratio > is caculated as "L1-dcache-load-misses/L1-dcache-loads". So "of all > L1-dcache hits" is unsuitable to describe it, and "of all L1-dcache > accesses/references" seems better. > > 285,132,521 cache-misses # 53.696 % of all cache refs [83.34%] > 531,015,219 cache-references [83.20%] > 220,465,183 LLC-load-misses # 72.33% of all LL-cache miss [83.44%] > ^^^^ > 304,787,745 LLC-loads [66.60%] > > There is an old patch here https://lkml.org/lkml/2019/11/16/37, but > seems not upstreamed yet. This patch follows suggestions by Arnaldo. > But one difference is using "refs" to follow the convention because > there is comment also for cache-misses event which uses > "of all cache refs". > The comments of L1-icache, dTLB cache, iTLB cache and LL-cache are > fixed in the same way. > > P.S. Liu and Andi if you don't mind this patch adds your Reviewed-by > and Signed-off-by, thanks. > > Reviewed-by: Andi Kleen > Signed-off-by: Qi Liu > Signed-off-by: Lin Feng > --- > tools/perf/util/stat-shadow.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c > index 2c41d47f6f83..070e9749e934 100644 > --- a/tools/perf/util/stat-shadow.c > +++ b/tools/perf/util/stat-shadow.c > @@ -506,7 +506,7 @@ static void print_l1_dcache_misses(struct perf_stat_config *config, > > color = get_ratio_color(GRC_CACHE_MISSES, ratio); > > - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio); > + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache refs", ratio); > } > > static void print_l1_icache_misses(struct perf_stat_config *config, > @@ -527,7 +527,7 @@ static void print_l1_icache_misses(struct perf_stat_config *config, > ratio = avg / total * 100.0; > > color = get_ratio_color(GRC_CACHE_MISSES, ratio); > - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio); > + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache refs", ratio); > } > > static void print_dtlb_cache_misses(struct perf_stat_config *config, > @@ -547,7 +547,7 @@ static void print_dtlb_cache_misses(struct perf_stat_config *config, > ratio = avg / total * 100.0; > > color = get_ratio_color(GRC_CACHE_MISSES, ratio); > - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio); > + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache refs", ratio); > } > > static void print_itlb_cache_misses(struct perf_stat_config *config, > @@ -567,7 +567,7 @@ static void print_itlb_cache_misses(struct perf_stat_config *config, > ratio = avg / total * 100.0; > > color = get_ratio_color(GRC_CACHE_MISSES, ratio); > - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio); > + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache refs", ratio); > } > > static void print_ll_cache_misses(struct perf_stat_config *config, > @@ -587,7 +587,7 @@ static void print_ll_cache_misses(struct perf_stat_config *config, > ratio = avg / total * 100.0; > > color = get_ratio_color(GRC_CACHE_MISSES, ratio); > - out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio); > + out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache refs", ratio); > } > > /* > @@ -872,7 +872,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config, > if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0) > print_l1_dcache_misses(config, cpu, evsel, avg, out, st); > else > - print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0); > + print_metric(config, ctxp, NULL, NULL, "of all L1-dcache refs", 0); > } else if ( > evsel->core.attr.type == PERF_TYPE_HW_CACHE && > evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_L1I | > @@ -882,7 +882,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config, > if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0) > print_l1_icache_misses(config, cpu, evsel, avg, out, st); > else > - print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0); > + print_metric(config, ctxp, NULL, NULL, "of all L1-icache refs", 0); > } else if ( > evsel->core.attr.type == PERF_TYPE_HW_CACHE && > evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_DTLB | > @@ -892,7 +892,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config, > if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0) > print_dtlb_cache_misses(config, cpu, evsel, avg, out, st); > else > - print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0); > + print_metric(config, ctxp, NULL, NULL, "of all dTLB cache refs", 0); > } else if ( > evsel->core.attr.type == PERF_TYPE_HW_CACHE && > evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_ITLB | > @@ -902,7 +902,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config, > if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0) > print_itlb_cache_misses(config, cpu, evsel, avg, out, st); > else > - print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0); > + print_metric(config, ctxp, NULL, NULL, "of all iTLB cache refs", 0); > } else if ( > evsel->core.attr.type == PERF_TYPE_HW_CACHE && > evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_LL | > @@ -912,7 +912,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config, > if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0) > print_ll_cache_misses(config, cpu, evsel, avg, out, st); > else > - print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0); > + print_metric(config, ctxp, NULL, NULL, "of all LL-cache refs", 0); > } else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) { > total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu); > >