mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
perf intel-tpebs: Reduce scope of the tpebs_events_size variable
Moved to record argument computation rather than being global. Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Weilin Wang <weilin.wang@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Andreas Färber <afaerber@suse.de> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Falcon <thomas.falcon@intel.com> Link: https://lore.kernel.org/r/20250414174134.3095492-7-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
24fead56eb
commit
728756fffb
|
|
@ -29,7 +29,6 @@
|
|||
#define PERF_DATA "-"
|
||||
|
||||
bool tpebs_recording;
|
||||
static size_t tpebs_event_size;
|
||||
static LIST_HEAD(tpebs_results);
|
||||
static pthread_t tpebs_reader_thread;
|
||||
static struct child_process tpebs_cmd;
|
||||
|
|
@ -86,15 +85,20 @@ static int get_perf_record_args(const char **record_argv, char buf[],
|
|||
static int evsel__tpebs_start_perf_record(struct evsel *evsel, int control_fd[], int ack_fd[])
|
||||
{
|
||||
const char **record_argv;
|
||||
size_t tpebs_event_size = 0;
|
||||
int ret;
|
||||
char buf[32];
|
||||
char cpumap_buf[50];
|
||||
struct tpebs_retire_lat *t;
|
||||
|
||||
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]);
|
||||
|
||||
list_for_each_entry(t, &tpebs_results, nd)
|
||||
tpebs_event_size++;
|
||||
|
||||
record_argv = calloc(12 + 2 * tpebs_event_size, sizeof(char *));
|
||||
if (!record_argv)
|
||||
return -ENOMEM;
|
||||
|
|
@ -226,7 +230,6 @@ static struct tpebs_retire_lat *tpebs_retire_lat__new(struct evsel *evsel)
|
|||
return NULL;
|
||||
}
|
||||
list_add_tail(&result->nd, &tpebs_results);
|
||||
tpebs_event_size++;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -289,7 +292,7 @@ int evsel__tpebs_open(struct evsel *evsel)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (tpebs_event_size > 0) {
|
||||
if (!list_empty(&tpebs_results)) {
|
||||
struct pollfd pollfd = { .events = POLLIN, };
|
||||
int control_fd[2], ack_fd[2], len;
|
||||
char ack_buf[8];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user