From nobody Fri Dec 19 21:28:59 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 19B771607BA; Wed, 29 May 2024 06:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716965019; cv=none; b=iHF4lYITVBaPpseJMTM6JvkVX/cwIU25KBkrqUCv2itCUWlvk8pJW694j9nKvZdL5cwWLdD4w4GXagHRwxurF7TiPTNDqsQLF0JEhN9HdXgEx5SiRUAtJ4sRjSsS63Sq/Npmv0XTKGe1uU0nwykQYVsZTs3FDhAdayGlhpBVNC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716965019; c=relaxed/simple; bh=D4C6WFVBIrNKMzQpypbEq0h3+qQtDtOXTakBiNHlGUw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YLagGSIIdLr3vF1hGAHJIpcI/4exSvXangwncOblCiFdPDQw6WvXh0mrgvfUfa1Q0vFeH6QwwSD0LOCGp32HwP/90LyzT0tUVHTI2j2rrMAizjkniC3b9ni7mqY2f4CQYhtHBm/fmkPImj/mbAHObY/T90dLlWN3WXdt/IP7lpQ= 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=laznxfcN; arc=none smtp.client-ip=192.198.163.13 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="laznxfcN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716965018; x=1748501018; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D4C6WFVBIrNKMzQpypbEq0h3+qQtDtOXTakBiNHlGUw=; b=laznxfcNmrA3brt2S9ZzYvOaEORb7UyvYKCn6/KmmYgxyP87RxYQT6i0 7MRhalOfuodhdkdEJ27DZv5r+ySGTSfejRE6Wcy0HSonJ3yWSIkqUn+DX IB88r6SfmOLGgZfLGTBL/l0HMBQWaioFJrloWuzVRQ3gsu8pAt8JNMkL3 fvPRJOOgDF25v2BT6OJpyCmmca3q5O56uOcI1XAXkwYVKWfngk6IpKd3J 2Qd6YIOQfGf9q67h2GHEVjJHX5MHF9e+ZXz2UN/ojY/jY1L8Ss9SylE6d qdhAXeOSt/9FUCm4hEI4S24MMjcHajkx3d6Vbhc+itwPKF6JQImTIMxtL A==; X-CSE-ConnectionGUID: QCVxeF1DQfC3pF5a8A5+GQ== X-CSE-MsgGUID: UskdZxaYT6mrUpXv2QLD0g== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="16297997" X-IronPort-AV: E=Sophos;i="6.08,197,1712646000"; d="scan'208";a="16297997" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2024 23:43:36 -0700 X-CSE-ConnectionGUID: Y/yo6mlLTEODHStpp//8Qw== X-CSE-MsgGUID: Ri9XV5ZZQV2X2R+5amdZSg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,197,1712646000"; d="scan'208";a="39759293" Received: from fl31ca102ks0602.deacluster.intel.com (HELO gnr-bkc.deacluster.intel.com) ([10.75.133.163]) by fmviesa005.fm.intel.com with ESMTP; 28 May 2024 23:43:35 -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 v10 4/8] perf stat: Plugin retire_lat value from sampled data to evsel Date: Wed, 29 May 2024 02:43:20 -0400 Message-ID: <20240529064327.4080674-5-weilin.wang@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240529064327.4080674-1-weilin.wang@intel.com> References: <20240529064327.4080674-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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 re= tire latency value processed from the sampled data to count value. This sampled retire latency value will be used for metric calculation and final event co= unt 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/e= vlist.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 stru= ct evsel *rhs) return 1; } =20 + /* 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 4157db30c3e7..e892d69e7839 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" =20 #include =20 @@ -1523,6 +1524,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); } =20 +static int evsel__read_retire_lat(struct evsel *evsel, int cpu_map_idx, in= t thread) +{ + return tpebs_set_evsel(evsel, cpu_map_idx, thread); +} + static void evsel__set_count(struct evsel *counter, int cpu_map_idx, int t= hread, u64 val, u64 ena, u64 run, u64 lost) { @@ -1530,6 +1536,12 @@ static void evsel__set_count(struct evsel *counter, = int cpu_map_idx, int thread, =20 count =3D perf_counts(counter->counts, cpu_map_idx, thread); =20 + 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 =3D val; count->ena =3D ena; count->run =3D run; @@ -1778,6 +1790,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); =20 + 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); =20 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 !=3D PERF_TOOL_NONE; } =20 +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); =20 --=20 2.43.0