Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp334946ybc; Fri, 15 Nov 2019 23:55:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyh04FgtfWGEx06n0r8UkvfKhGSYUvWb+pt/T2z3UY9h7Yfliu0NlPN2giqi0IRxU0jw2jp X-Received: by 2002:a17:906:c41:: with SMTP id t1mr7659568ejf.282.1573890931527; Fri, 15 Nov 2019 23:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573890931; cv=none; d=google.com; s=arc-20160816; b=rFtSc3ArphsIGqQqRF7jR1ooM413llDIUZE9yHCXABRrprzoFfHRBB5zD8x3Z2Y6Te cmzJVWvVNh/P1kFmtrQI7xnypT42TvOpX1UTzI0FEXIl8kuiG0Q6Ro//WfbRPBUPjJl5 g03lyT20UlOhuegdX+O01TZnXS/QTKfdInUR0ZRZNssRHeeyUwi+QMsWr/+nCUy68qdx rwSN/mDbk1l0wpy9IUxahBp/cimQ3rXnAn3O2u0TY7dSn6qfJyB8E+2z4lfbyXFukL7y JkDilkCtKA0Zj2kwaEvRUVyEOE9Zhm1WKZX4YefBQqFAISRPmHnbU9YOLIXhY+oz99B+ Ac1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=slKwPVVYWgPUPVPVOIHS0GU7kIStC9JMISMF672Icno=; b=WtCTV6LSUtDZJyy8b6Ckw6+O+sdokaIbFnGObPyN3eCwFO7g0aAyEoPnqYVN9HSJ+r i7AAWKAJkKCo7Ku/Bi+FGu9SQjG2upw9EDF9xlaEzq2DQahRVGsya/XUlj/2bUuOEYpX IeZJimpuTIwHwNta/3chMLvM9ikssy481iwvCsuG2kP7xTNzcAFxDGe6mG3XZTbemjv2 qwuQ3+c/Ad/in+iCrGBjawDAMEglO5ivrsszCCw6S2ZmUCv+Jdzd2PldSjZCES+s+4oT OA4rNHf7y1UEW/FUm45oGeBZnxIEP+CYgtU26lTmle0FKDijd7zZlx6VwDTYedaPNiXL oQbg== 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 z65si9788936ede.388.2019.11.15.23.55.06; Fri, 15 Nov 2019 23:55:31 -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 S1727471AbfKPHwv (ORCPT + 99 others); Sat, 16 Nov 2019 02:52:51 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6240 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726034AbfKPHwv (ORCPT ); Sat, 16 Nov 2019 02:52:51 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9D016F1133B732AF9015; Sat, 16 Nov 2019 15:52:48 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Sat, 16 Nov 2019 15:52:40 +0800 From: lqqq341 To: , , , CC: , , , , , , , , , , , Subject: [PATCH] Perf stat: Fix the ratio comments of miss-events Date: Sat, 16 Nov 2019 15:48:41 +0800 Message-ID: <1573890521-56450-1-git-send-email-liuqi115@hisilicon.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qi Liu Perf stat displays miss ratio of L1-dcache, L1-icache, dTLB cache, iTLB cache and LL-cache. 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" seems better. The comments of L1-icache, dTLB cache, iTLB cache and LL-cache are fixed in the same way. Signed-off-by: Qi Liu --- tools/perf/util/stat-shadow.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index 2c41d47..a3bdf2b 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -506,7 +506,8 @@ 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 accesses", ratio); } static void print_l1_icache_misses(struct perf_stat_config *config, @@ -527,7 +528,8 @@ 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 accesses", ratio); } static void print_dtlb_cache_misses(struct perf_stat_config *config, @@ -547,7 +549,8 @@ 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 accesses", ratio); } static void print_itlb_cache_misses(struct perf_stat_config *config, @@ -567,7 +570,8 @@ 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 accesses", ratio); } static void print_ll_cache_misses(struct perf_stat_config *config, @@ -587,7 +591,8 @@ 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 accesses", ratio); } /* @@ -872,7 +877,8 @@ 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 accesses", 0); } else if ( evsel->core.attr.type == PERF_TYPE_HW_CACHE && evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_L1I | @@ -882,7 +888,8 @@ 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 accesses", 0); } else if ( evsel->core.attr.type == PERF_TYPE_HW_CACHE && evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_DTLB | @@ -892,7 +899,8 @@ 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 accesses", 0); } else if ( evsel->core.attr.type == PERF_TYPE_HW_CACHE && evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_ITLB | @@ -902,7 +910,8 @@ 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 accesses", 0); } else if ( evsel->core.attr.type == PERF_TYPE_HW_CACHE && evsel->core.attr.config == ( PERF_COUNT_HW_CACHE_LL | @@ -912,7 +921,8 @@ 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 accesses", 0); } else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) { total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu); -- 2.8.1