[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240425223406.471120-2-irogers@google.com>
Date: Thu, 25 Apr 2024 15:34:04 -0700
From: Ian Rogers <irogers@...gle.com>
To: weilin.wang@...el.com, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>, Ze Gao <zegao2021@...il.com>,
Leo Yan <leo.yan@...ux.dev>, Ravi Bangoria <ravi.bangoria@....com>,
Dmitrii Dolgov <9erthalion6@...il.com>, Song Liu <song@...nel.org>,
James Clark <james.clark@....com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH v1 1/3] perf evsel: Don't open tool events
Tool events are set up as software dummy events. Don't open them to
save some work and a file descriptor. The evsel's fds are initialized
to -1, so it suffices to just early return.
---
tools/perf/util/evsel.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3536404e9447..2743d40665ff 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -2005,6 +2005,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,
int pid = -1, err, old_errno;
enum rlimit_action set_rlimit = NO_CHANGE;
+ if (evsel__is_tool(evsel)) {
+ /* Tool events are set up as dummy but don't need opening. */
+ return 0;
+ }
+
err = __evsel__prepare_open(evsel, cpus, threads);
if (err)
return err;
--
2.44.0.769.g3c40516874-goog
Powered by blists - more mailing lists