From patchwork Thu Aug 11 06:24:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12941177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA278C19F2D for ; Thu, 11 Aug 2022 06:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0NifWvjKO5+ycShOxvURZ1U11T/0zJoX1jn5ZdcZnME=; b=aPyhNMI56Ajo2k JtruSHz1UoHizYmGYhGbJePT2w3cJZOo6rr2hOVczp8Fl9+ATEUqjkxrFHvhCQwiJIwLPBQgFe8yV w4I0m6JbV+9XrDFbHA0bSFH2bhjAUqlH0Dzs6Z2grIz8ZLd8mXUtytf6TmdmWVivdW6atYozqYsFp Uba7lQqNnH4CCiS+C53J4S2wjC5TJ0hZ5aPx6LnBwHcQTQJOtpIFAQX5UXjmOGEGbtHIYJQ1EhhbI O9Qq3eGBiULsJBZCyV7NgrM3vSn4XDCTAwt43cgAHRqEtawawQTGByT6Lt/U2BrdDaHXrJuugAUkk ftMHBrBUYDJZGVWQi8QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1fC-006wMf-Nn; Thu, 11 Aug 2022 06:27:27 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oM1dY-006ruu-Gh for linux-arm-kernel@lists.infradead.org; Thu, 11 Aug 2022 06:25:46 +0000 Received: by mail-pj1-x1029.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so4226793pjf.2 for ; Wed, 10 Aug 2022 23:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=vISqy0c46VUo7jta0UtXmJx/Ve8c21OQoVpZLZn1UYc=; b=h7rsvlA/DKHR/BdvhLttV1R8+DWflxwegrY19QrEYi/HrJLaOrVadDv0Y8BndWg086 9PaM7exnp8eudXhUPvQJBxuhh8dlyUNnfocSegrWeaZTHPvt2zbOJOJDzFMCMW+Af2sW HbErtOvVSamm1w46ylLVlWdbMvRA3nt1FS56fnBCfYT+y8KDwe5dl2dbTrpk0ClsKxAJ Ad4vEN1vJqJ+xqgoe/ebyl2Nnu9uDE+TJ5+B9ln3UkhVQtgBnJWkp34QEy5Iq/CE0j9o ZXpGtENYY+VQcoprTGCEScYf9j4WHXV5UuTDBHXscy8wjGD0NRMBJ7jvzRIu1OAUl+9l BIww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=vISqy0c46VUo7jta0UtXmJx/Ve8c21OQoVpZLZn1UYc=; b=OtAkb8ru5/b2ROqsTyssr/zF0/g5rqAlI82aw/DUD5YF0vhbPeP1bLay5qaCXc2N5c tuH/XA/gPThp/hqg9OrDcopG+XHqTSeovhn//hxmfG0XQMdWf8kQq4ad18dL/QFL5spy 87yad7pdwwDOkbfgiTczLSL4vmJ0MZXdI1KCPIiQOVUQyKRhpmLifp7zg+5slK/i/CtL w83J174L+KKr6AodgGlQF7FGhlN7hMsqFwefSDTdWrdcHwri1naqyWKb+4jctqLpbbOj m0hWF1mhjOilHhD2KIuOeKmqimPGmVciKs1MYoeiqo+HQQtdZsOOZ0maloAzDUz+f05K RKqg== X-Gm-Message-State: ACgBeo0F19ZW85XVwfjbhMn2F+2WHKyoEoVr678Ugtj8qmGfsn+2LfNX hzoTU0KQPmvSbgklRQm6bZZR6g== X-Google-Smtp-Source: AA6agR7lkSLN6rJ6hUBSmVi8yPIjpU1fCn3mFsbOnrulHhaKiTNkZ5V/2K5DvZG4DWeSBLU+RN8GKg== X-Received: by 2002:a17:902:dacb:b0:16f:63c:3e8b with SMTP id q11-20020a170902dacb00b0016f063c3e8bmr31372372plx.64.1660199143892; Wed, 10 Aug 2022 23:25:43 -0700 (PDT) Received: from leoy-yangtze.lan (n058152077182.netvigator.com. [58.152.77.182]) by smtp.gmail.com with ESMTPSA id o12-20020a17090a55cc00b001f506009036sm2766926pjm.49.2022.08.10.23.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 23:25:43 -0700 (PDT) From: Leo Yan To: Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , John Garry , Will Deacon , James Clark , Mike Leach , Kajol Jain , Ali Saidi , Adrian Hunter , "Gustavo A. R. Silva" , Anshuman Khandual , Ian Rogers , Like Xu , German Gomez , Timothy Hayes , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Leo Yan Subject: [PATCH v6 07/15] perf c2c: Add dimensions of peer metrics for cache line view Date: Thu, 11 Aug 2022 14:24:43 +0800 Message-Id: <20220811062451.435810-8-leo.yan@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220811062451.435810-1-leo.yan@linaro.org> References: <20220811062451.435810-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220810_232544_683120_4797D062 X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds dimensions of peer ops, which will be used for Shared cache line distribution pareto. It adds the percentage dimensions for local and remote peer operations, and the dimensions for accounting operation numbers which is used for stdio mode. Signed-off-by: Leo Yan Acked-by: Ian Rogers Tested-by: Ali Saidi Reviewed-by: Ali Saidi --- tools/perf/builtin-c2c.c | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 99c0c7307a4a..dd47f068b8da 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -902,6 +902,8 @@ static double percent_ ## __f(struct c2c_hist_entry *c2c_he) \ PERCENT_FN(rmt_hitm) PERCENT_FN(lcl_hitm) +PERCENT_FN(rmt_peer) +PERCENT_FN(lcl_peer) PERCENT_FN(st_l1hit) PERCENT_FN(st_l1miss) PERCENT_FN(st_na) @@ -968,6 +970,68 @@ percent_lcl_hitm_cmp(struct perf_hpp_fmt *fmt __maybe_unused, return per_left - per_right; } +static int +percent_lcl_peer_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + int width = c2c_width(fmt, hpp, he->hists); + double per = PERCENT(he, lcl_peer); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_lcl_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_lcl_peer); +} + +static int64_t +percent_lcl_peer_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + double per_left; + double per_right; + + per_left = PERCENT(left, lcl_peer); + per_right = PERCENT(right, lcl_peer); + + return per_left - per_right; +} + +static int +percent_rmt_peer_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + int width = c2c_width(fmt, hpp, he->hists); + double per = PERCENT(he, rmt_peer); + char buf[10]; + + return scnprintf(hpp->buf, hpp->size, "%*s", width, PERC_STR(buf, per)); +} + +static int +percent_rmt_peer_color(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, + struct hist_entry *he) +{ + return percent_color(fmt, hpp, he, percent_rmt_peer); +} + +static int64_t +percent_rmt_peer_cmp(struct perf_hpp_fmt *fmt __maybe_unused, + struct hist_entry *left, struct hist_entry *right) +{ + double per_left; + double per_right; + + per_left = PERCENT(left, rmt_peer); + per_right = PERCENT(right, rmt_peer); + + return per_left - per_right; +} + static int percent_stores_l1hit_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, struct hist_entry *he) @@ -1403,6 +1467,22 @@ static struct c2c_dimension dim_cl_lcl_hitm = { .width = 7, }; +static struct c2c_dimension dim_cl_rmt_peer = { + .header = HEADER_SPAN("----- Peer -----", "Rmt", 1), + .name = "cl_rmt_peer", + .cmp = rmt_peer_cmp, + .entry = rmt_peer_entry, + .width = 7, +}; + +static struct c2c_dimension dim_cl_lcl_peer = { + .header = HEADER_SPAN_LOW("Lcl"), + .name = "cl_lcl_peer", + .cmp = lcl_peer_cmp, + .entry = lcl_peer_entry, + .width = 7, +}; + static struct c2c_dimension dim_tot_stores = { .header = HEADER_BOTH("Total", "Stores"), .name = "tot_stores", @@ -1547,6 +1627,24 @@ static struct c2c_dimension dim_percent_lcl_hitm = { .width = 7, }; +static struct c2c_dimension dim_percent_rmt_peer = { + .header = HEADER_SPAN("-- Peer Snoop --", "Rmt", 1), + .name = "percent_rmt_peer", + .cmp = percent_rmt_peer_cmp, + .entry = percent_rmt_peer_entry, + .color = percent_rmt_peer_color, + .width = 7, +}; + +static struct c2c_dimension dim_percent_lcl_peer = { + .header = HEADER_SPAN_LOW("Lcl"), + .name = "percent_lcl_peer", + .cmp = percent_lcl_peer_cmp, + .entry = percent_lcl_peer_entry, + .color = percent_lcl_peer_color, + .width = 7, +}; + static struct c2c_dimension dim_percent_stores_l1hit = { .header = HEADER_SPAN("------- Store Refs ------", "L1 Hit", 2), .name = "percent_stores_l1hit", @@ -1704,6 +1802,8 @@ static struct c2c_dimension *dimensions[] = { &dim_rmt_peer, &dim_cl_lcl_hitm, &dim_cl_rmt_hitm, + &dim_cl_lcl_peer, + &dim_cl_rmt_peer, &dim_tot_stores, &dim_stores_l1hit, &dim_stores_l1miss, @@ -1721,6 +1821,8 @@ static struct c2c_dimension *dimensions[] = { &dim_percent_hitm, &dim_percent_rmt_hitm, &dim_percent_lcl_hitm, + &dim_percent_rmt_peer, + &dim_percent_lcl_peer, &dim_percent_stores_l1hit, &dim_percent_stores_l1miss, &dim_percent_stores_na,