Commit 83c2e4f3 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf evsel: Use variable instead of repeating lengthy FD macro

It's more readable and will ease up following patches.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1481538943-21874-3-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 631ac41b
...@@ -1474,7 +1474,7 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, ...@@ -1474,7 +1474,7 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
for (cpu = 0; cpu < cpus->nr; cpu++) { for (cpu = 0; cpu < cpus->nr; cpu++) {
for (thread = 0; thread < nthreads; thread++) { for (thread = 0; thread < nthreads; thread++) {
int group_fd; int fd, group_fd;
if (!evsel->cgrp && !evsel->system_wide) if (!evsel->cgrp && !evsel->system_wide)
pid = thread_map__pid(threads, thread); pid = thread_map__pid(threads, thread);
...@@ -1484,21 +1484,22 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus, ...@@ -1484,21 +1484,22 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx", pr_debug2("sys_perf_event_open: pid %d cpu %d group_fd %d flags %#lx",
pid, cpus->map[cpu], group_fd, flags); pid, cpus->map[cpu], group_fd, flags);
FD(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr, fd = sys_perf_event_open(&evsel->attr, pid, cpus->map[cpu],
pid, group_fd, flags);
cpus->map[cpu],
group_fd, flags); FD(evsel, cpu, thread) = fd;
if (FD(evsel, cpu, thread) < 0) {
if (fd < 0) {
err = -errno; err = -errno;
pr_debug2("\nsys_perf_event_open failed, error %d\n", pr_debug2("\nsys_perf_event_open failed, error %d\n",
err); err);
goto try_fallback; goto try_fallback;
} }
pr_debug2(" = %d\n", FD(evsel, cpu, thread)); pr_debug2(" = %d\n", fd);
if (evsel->bpf_fd >= 0) { if (evsel->bpf_fd >= 0) {
int evt_fd = FD(evsel, cpu, thread); int evt_fd = fd;
int bpf_fd = evsel->bpf_fd; int bpf_fd = evsel->bpf_fd;
err = ioctl(evt_fd, err = ioctl(evt_fd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment