Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3107289lqo; Tue, 14 May 2024 22:46:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVPQdXm4ftWgIT1RMTsoNgWz8C85aJnDiVybuuz20o60ZbnYf7CBCSVDFm4TBBP2CEgrKETXPAITuvybl/7hRZBWWdSgaiEvc2dyVsWTg== X-Google-Smtp-Source: AGHT+IEbVs1i8T9lUwwdYCg6Oky00mCmMsUqlHcXY97AxVinOBPyY2y1mgZjsphaqN4f2U0jGoPn X-Received: by 2002:a5b:cc2:0:b0:dcd:c3ba:d788 with SMTP id 3f1490d57ef6-dee4f360256mr12529790276.47.1715751964450; Tue, 14 May 2024 22:46:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715751964; cv=pass; d=google.com; s=arc-20160816; b=CxDKBrPeee2FY6C1eZngn7DX3VbkHMSM+nUI1WmS4G0FP4w4+CHZLpVBHhKzy2uGhu cJS+ci0NuDeW5AsSnPid3WJW0EtrYUDV4pJ7WjFSqbvYzehbDssj80tV/D9VJofnbTmN SjDOQH/Bz2HYlfJisBbV89y1nkU6y2UwudRLZrvOtOP9ohrGdEMWUBV+r3UzqNCJS9Zx MmkDyXecdZZ1VivquMuebsmxDP3DG59CpnMEErmp8Al+cQS19WYbO0cBeOIp4rIkbL5e 2tKBe57NP0tD36+7Be8jJecEiUWAUJfMU0jen987ZE5/E9smftG/gve7Zh8tJkhk9e84 gXAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bIi9bmCQowIyVz72XckHAPHs/s5c0os/tRfsMOlE/kQ=; fh=7D8bWqELNqJM6KF7zbibUOya8038rGAdDMFXsJMRu8c=; b=a31ZOyZMNR8zMlSbQDDbKSvDFZBC9iqJ2ntC1BAQKdgucliygNkzjD/Q6/k8xKJ+3N G9crBnENW6g0WIVi7M8D7QLK6ddSr/Jf5ABzTjvnA8bzg1wk8x1W44oNPC7B7BQvh7DD 6FbdEr51+xTLEvVxYMvTyR80zXR0K8698TLQ1yIKI0IXLqJft16XZzuEEtvKz12kS87R 4DunQUypPjmK9MCiP5ghFnmir8bSancoZJawMGcl/PM0Jd3MJlFswrOooACpm4UgdWuP 4FR7A+Cw03623Pu2UI0Xem9bnRp+SO7dPIOEFilZw5lenbrUBWzJvN2pdu6iEbMtp19y z2CQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h/hFxV0V"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-179473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f304b3csi133761656d6.555.2024.05.14.22.46.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 22:46:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="h/hFxV0V"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-179473-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179473-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 30F691C20D11 for ; Wed, 15 May 2024 05:46:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2218643144; Wed, 15 May 2024 05:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="h/hFxV0V" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8903A3C47C; Wed, 15 May 2024 05:44:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715751897; cv=none; b=JvwUNz6kN1Uzv4dUt2LWjWge6y9sc0lR+vIomSRn0pRRhYBZd7PLGzdaje4Q+IgymG1R+QMc0h3++NZizNbFESFfG9+OXAZPDWvW8bPEwZw2IuXgdwk3FVyjObJ6YEMfCp5cRVv+mOUvO2CernfJypmvYmO7zCT/F398lUqVDhY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715751897; c=relaxed/simple; bh=uBLumifDriseoh4xe0DvJei5EAwfabS8LAawzprkI1w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aroJAL/+YusxtlpWxQtIGakxAJqsdsmzxkrVBLFre9GxnT7M+vMlcNqWUJzcI1K4OhKcYh+Gu/lY3Rd1sJqrnAFWfJjn0ai9r8Fx5DhvGeeJ6muRWXOuN1eU8RNzPehLCcbHVygz+xgWaf25pxnDvi8aj12cKgYsrfPWnCIPjaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=h/hFxV0V; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715751895; x=1747287895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uBLumifDriseoh4xe0DvJei5EAwfabS8LAawzprkI1w=; b=h/hFxV0Vzwny4F4SJicHGP3g1BzZh6GhQmQ/NZGULuMgExb8PPgQkkNu WFhEzTEyY6ieIR8EyfuLbIR88Nbp7xkmuNErpP2XgHlgPvanRg5HRHFwf WFJIvHj4JMpkflMN2sIr5cXZaOCzy4Zcd8MExhAOmrtd9oc+rYdkw+c4J 1GjdePiI312XRS2iCOWXQJCc+Mqd6GsqYlEXzm7GEcWFWB/byUp8ycxCe X0PxsdR5jA46vOTUm/+LEIoN5JFc42HIPaF476D7eO0i3LPEdkMGEc45t cg6FSsAmu0jHSfV2fb7RIeCHDyLVSebBtAxhhSMfZck4/0n65gNMDIdIz w==; X-CSE-ConnectionGUID: f7oHBITJSMGGro0942bUYw== X-CSE-MsgGUID: OG7rPTEwSVu1RIz7FeCQfQ== X-IronPort-AV: E=McAfee;i="6600,9927,11073"; a="29298050" X-IronPort-AV: E=Sophos;i="6.08,160,1712646000"; d="scan'208";a="29298050" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2024 22:44:52 -0700 X-CSE-ConnectionGUID: /lrm9gq1TeSFjXKTPiMy7A== X-CSE-MsgGUID: egOcnlqBTn+ofJC0gd8vUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,160,1712646000"; d="scan'208";a="35469219" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by fmviesa003.fm.intel.com with ESMTP; 14 May 2024 22:44:52 -0700 From: weilin.wang@intel.com To: weilin.wang@intel.com, Namhyung Kim , Ian Rogers , Arnaldo Carvalho de Melo , Peter Zijlstra , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers Subject: [RFC PATCH v8 7/7] perf stat: Skip read retire_lat counters and plugin retire_lat data from sampled data Date: Wed, 15 May 2024 01:44:29 -0400 Message-ID: <20240515054443.2824147-8-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240515054443.2824147-1-weilin.wang@intel.com> References: <20240515054443.2824147-1-weilin.wang@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Weilin Wang In current :R parsing implementation, the parser would recognize events with retire_latency modifier and insert them into the evlist like a normal event. Ideally, we need to avoid counting these events. In this commit, at the stage of metric calculation, the code uses sampled retire latency value instead of counted event value. Signed-off-by: Weilin Wang --- tools/perf/arch/x86/util/evlist.c | 6 ++++++ tools/perf/util/evsel.h | 5 +++++ tools/perf/util/stat-display.c | 5 +++++ tools/perf/util/stat-shadow.c | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/x86/util/evlist.c b/tools/perf/arch/x86/util/evlist.c index b1ce0c52d88d..cebdd483149e 100644 --- a/tools/perf/arch/x86/util/evlist.c +++ b/tools/perf/arch/x86/util/evlist.c @@ -89,6 +89,12 @@ int arch_evlist__cmp(const struct evsel *lhs, const struct evsel *rhs) return 1; } + /* Retire latency event should not be group leader*/ + if (lhs->retire_lat && !rhs->retire_lat) + return 1; + if (!lhs->retire_lat && rhs->retire_lat) + return -1; + /* Default ordering by insertion index. */ return lhs->core.idx - rhs->core.idx; } diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index bd8e84954e34..aaf572317e92 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -303,6 +303,11 @@ static inline bool evsel__is_tool(const struct evsel *evsel) return evsel->tool_event != PERF_TOOL_NONE; } +static inline bool evsel__is_retire_lat(const struct evsel *evsel) +{ + return evsel->retire_lat; +} + const char *evsel__group_name(struct evsel *evsel); int evsel__group_desc(struct evsel *evsel, char *buf, size_t size); diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index b9c3978cc99c..499fe0ddca93 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -1013,6 +1013,9 @@ static bool should_skip_zero_counter(struct perf_stat_config *config, /* Tool events have the software PMU but are only gathered on 1. */ if (evsel__is_tool(counter)) return true; + /* Retire latency events are read from sampling data. */ + if (evsel__is_retire_lat(counter)) + return true; /* * Skip value 0 when it's an uncore event and the given aggr id @@ -1653,6 +1656,8 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf } else { print_metric_begin(config, evlist, &os, /*aggr_idx=*/0); evlist__for_each_entry(evlist, counter) { + if (evsel__is_retire_lat(counter)) + continue; print_counter(config, counter, &os); } print_metric_end(config, &os); diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index b97d23bfeac1..45e0b21a4724 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -384,7 +384,7 @@ static int prepare_metric(const struct metric_expr *mexp, double val; int source_count = 0; - if (metric_events[i]->retire_lat) + if (evsel__is_retire_lat(metric_events[i])) continue; if (evsel__is_tool(metric_events[i])) { -- 2.43.0