[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250324223452.208081-5-irogers@google.com>
Date: Mon, 24 Mar 2025 15:34:42 -0700
From: Ian Rogers <irogers@...gle.com>
To: 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>, Weilin Wang <weilin.wang@...el.com>,
James Clark <james.clark@...aro.org>, Xu Yang <xu.yang_2@....com>,
John Garry <john.g.garry@...cle.com>, Howard Chu <howardchu95@...il.com>,
Levi Yun <yeoreum.yun@....com>, Dominique Martinet <asmadeus@...ewreck.org>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v1 04/14] perf intel-tpebs: Move cpumap_buf out of evsel__tpebs_open
The buffer holds the cpumap to pass to the perf record command, so
move it down to the perf record function. Make this function an evsel
function given the need for the evsel for the cpumap.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/perf/util/intel-tpebs.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/tools/perf/util/intel-tpebs.c b/tools/perf/util/intel-tpebs.c
index e218e435c1d7..13d70c6bd44b 100644
--- a/tools/perf/util/intel-tpebs.c
+++ b/tools/perf/util/intel-tpebs.c
@@ -82,12 +82,15 @@ static int get_perf_record_args(const char **record_argv, char buf[],
return 0;
}
-static int start_perf_record(int control_fd[], int ack_fd[],
- const char *cpumap_buf)
+static int evsel__tpebs_start_perf_record(struct evsel *evsel, int control_fd[], int ack_fd[])
{
const char **record_argv;
int ret;
char buf[32];
+ char cpumap_buf[50];
+
+ cpu_map__snprint(evsel->evlist->core.user_requested_cpus, cpumap_buf,
+ sizeof(cpumap_buf));
scnprintf(buf, sizeof(buf), "--control=fd:%d,%d", control_fd[0], ack_fd[1]);
@@ -286,8 +289,6 @@ int evsel__tpebs_open(struct evsel *evsel)
return ret;
if (tpebs_event_size > 0) {
- struct evlist *evsel_list = evsel->evlist;
- char cpumap_buf[50];
struct pollfd pollfd = { .events = POLLIN, };
int control_fd[2], ack_fd[2], len;
char ack_buf[8];
@@ -304,10 +305,7 @@ int evsel__tpebs_open(struct evsel *evsel)
goto out;
}
- cpu_map__snprint(evsel_list->core.user_requested_cpus, cpumap_buf,
- sizeof(cpumap_buf));
-
- ret = start_perf_record(control_fd, ack_fd, cpumap_buf);
+ ret = evsel__tpebs_start_perf_record(evsel, control_fd, ack_fd);
if (ret)
goto out;
--
2.49.0.395.g12beb8f557-goog
Powered by blists - more mailing lists