Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp140987lqq; Wed, 12 Jun 2024 20:37:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUlrAMGEC1OlXNb326KuNRs2ANOWRaYTMxvHeiu5m14HhF2ZE3zkttJyr8n/GXXky/K5fA+Kl6Fnw1hCFUpdOLfFNj2TEcvASlF3MSVw== X-Google-Smtp-Source: AGHT+IEYynokLjUuE82QgezOKB99zlC+IalAIbY0PHi5IQp92ij8IO537Z3XEmxC2rkA72TXz0Aq X-Received: by 2002:ac8:5e53:0:b0:43f:f098:9662 with SMTP id d75a77b69052e-4417aa294efmr24513151cf.26.1718249853823; Wed, 12 Jun 2024 20:37:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718249853; cv=pass; d=google.com; s=arc-20160816; b=t0VuLwd3vRdpLxXP4HtR76FteugOQpOeFieRiGTZgDHmoOjDusw0ByL9Iee8XzCeNq BT3yjuY3JapN7lAptHbg98p/ljlSguM6e8/O5s8L4FUMee3P7qKUb9g7l5Fnro/b6SDI q37O2MjJv+L0w7fOziXjYcI68N4BLAzjFN8ricjN78Og706qxhEtoEkf5bnbLMWuvFDv eHJbWGXi7Ma7Dr0MDPAa1ZGo2O85W6TvVdlEWNdyLnLYgo+CNTFDLxLRwFH2Sx2miXwF OVH0vPxWOStVljaWmH7o5f0AVkr/Hx3RhtQ11VizUemkZnmuZBlWrxOfJ8Ga7h8sJCIl Nvwg== 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=ZxcuxWQikBEjRoLCl3XEHbfpwevSBuy5jBtDj0l/occ=; fh=7D8bWqELNqJM6KF7zbibUOya8038rGAdDMFXsJMRu8c=; b=X83UFXLCM9ESYPPUk0I2dRioVkgFfErhIBpt5M05RjiRxftPCBCHvNmz1Cqen3osju H6ui70mt1r4difzcKlf2r+xpKqL5Tryqu3jIoeBZqYwa7Lt/b/cnEmO2gGblaoEWy/Fu 2RgLm2KG1EAfZCj/TvJB1YQWfTdeXIe6y+cj6rmaACC3hAeqC8+TLUwi5sHlI/SMSOZz kwu5KJTI9i9X8hSdYN6jpqbjqkIG13rZu1ADpVfPhtL4Az+71DKKLpKmEyO5rK/7SXEG MLdm5vsMKMkQahRA2oGsewL2NhH6B873Qg5hH0Vqy1F/aC2Ctnaq4Y5Hae8MxUrSe0BK 8Tuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZEFpF/Dy"; 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-212530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212530-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-441f2fe905dsi5707441cf.591.2024.06.12.20.37.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:37:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZEFpF/Dy"; 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-212530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212530-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 7C9161C21EA5 for ; Thu, 13 Jun 2024 03:37:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3A6613698D; Thu, 13 Jun 2024 03:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZEFpF/Dy" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) (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 17312131BAF; Thu, 13 Jun 2024 03:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718249802; cv=none; b=gtDDw7jpCk5cZoBofpiM6tdwxI8Bmdp6Mt3/OmL1Q8umOeOBippsyjoYoE0/4REf3Xx+bFM5psPkW7oGLCRwQyt18nWDEX1zs9xefGYNN/kHaiwQMx5F+gXNL5Fx/WEtLxP0+m5rgtvmiitEVbhOymDl5NvlkZbnoGwVjb+hJLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718249802; c=relaxed/simple; bh=d1Z57xpygWJ1WWeGDjCZfLEIqGYwjdRv4+Zd0U0TuGY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QInnFEuDb/gJY2lR46cTjTjxOgwbpDf4h3Bhx7rQ+GHSemE4pMZT2YekBjxXsCZSOdhz/MVUpzGjcwFZNz06KK5Ukj4TynFVOzJ1OJuhlY6opQspga8eYGxkiBqbJYia8+xe+m+paTSmTZ8JlBX79Q8FVpkvgPINaNCu3ClnBTo= 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=ZEFpF/Dy; arc=none smtp.client-ip=192.198.163.16 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=1718249800; x=1749785800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=d1Z57xpygWJ1WWeGDjCZfLEIqGYwjdRv4+Zd0U0TuGY=; b=ZEFpF/DyYw53ugVpdFDePMNFT4F4yp5L42PkWKXXRFLp60oSv/z780iq zf9le5QkggbybjTGYct+DMrLHxHuz6DoGqRw98pIubnLKkgHATk+1ql6K ZFd3dygvTOAimQ6agPPwK75mcuLmKHOH3HktMQIKvkG6UgjO4Gip7tidC Jjdmtpmi4ZThQFK5q25ASmeusSt13q4LK1/JYIdxZ3ANhrDt65z4eX/O6 Rz5B0MoOjeoLRZKuarYQkBdlq0BDBhnJMsHaKRLUDIe/2hCniBf27mqB7 zSyyNQ9ZncQbExuGdovO8H7gjwbP1kU+1SQX0mvevS4KCcEc5pehfUEdt A==; X-CSE-ConnectionGUID: jkjUXqX7S6ySzRbuaKK2Yg== X-CSE-MsgGUID: lEqc5LWhQ5yAdzW5svA7+w== X-IronPort-AV: E=McAfee;i="6700,10204,11101"; a="12046722" X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="12046722" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2024 20:36:38 -0700 X-CSE-ConnectionGUID: c30APkv6QF2TPKcnET3A7A== X-CSE-MsgGUID: iYHIUPh9TKeftCZHr7rkng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,234,1712646000"; d="scan'208";a="40100357" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by fmviesa009.fm.intel.com with ESMTP; 12 Jun 2024 20:36:37 -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 v13 5/9] perf stat: Plugin retire_lat value from sampled data to evsel Date: Wed, 12 Jun 2024 23:36:25 -0400 Message-ID: <20240613033631.199800-6-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240613033631.199800-1-weilin.wang@intel.com> References: <20240613033631.199800-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 time when a retire_latency evsel is read, set the retire latency value processed from the sampled data to count value. This sampled retire latency value will be used for metric calculation and final event count print out. No special metric calculation and event print out code required for retire_latency events. Signed-off-by: Weilin Wang --- tools/perf/arch/x86/util/evlist.c | 6 ++++++ tools/perf/util/evsel.c | 15 +++++++++++++++ tools/perf/util/evsel.h | 5 +++++ 3 files changed, 26 insertions(+) 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.c b/tools/perf/util/evsel.c index e8e2ad5fc867..a6d8cf4118b1 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -58,6 +58,7 @@ #include #include #include +#include "util/intel-tpebs.h" #include @@ -1532,6 +1533,11 @@ static int evsel__read_one(struct evsel *evsel, int cpu_map_idx, int thread) return perf_evsel__read(&evsel->core, cpu_map_idx, thread, count); } +static int evsel__read_retire_lat(struct evsel *evsel, int cpu_map_idx, int thread) +{ + return tpebs_set_evsel(evsel, cpu_map_idx, thread); +} + static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread, u64 val, u64 ena, u64 run, u64 lost) { @@ -1539,6 +1545,12 @@ static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int thread, count = perf_counts(counter->counts, cpu_map_idx, thread); + if (counter->retire_lat) { + evsel__read_retire_lat(counter, cpu_map_idx, thread); + perf_counts__set_loaded(counter->counts, cpu_map_idx, thread, true); + return; + } + count->val = val; count->ena = ena; count->run = run; @@ -1831,6 +1843,9 @@ int evsel__read_counter(struct evsel *evsel, int cpu_map_idx, int thread) if (evsel__is_tool(evsel)) return evsel__read_tool(evsel, cpu_map_idx, thread); + if (evsel__is_retire_lat(evsel)) + return evsel__read_retire_lat(evsel, cpu_map_idx, thread); + if (evsel->core.attr.read_format & PERF_FORMAT_GROUP) return evsel__read_group(evsel, cpu_map_idx, thread); diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 14f777b9e03e..a5da4b03bb1c 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -311,6 +311,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); -- 2.43.0