Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b4b82bc authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Show event fd in debug output



It is useful for debug to see file descriptors for each event.

Before:

  $ perf stat -vvv -e cycles,cache-misses ls
  ...
  sys_perf_event_open: pid 12146  cpu -1  group_fd -1  flags 0x8
  ...
  sys_perf_event_open: pid 12146  cpu -1  group_fd 3  flags 0x8
  sys_perf_event_open failed, error -13

Now:

  $ perf stat -vvv -e cycles,cache-misses ls
  ...
  sys_perf_event_open: pid 12858  cpu -1  group_fd -1  flags 0x8 = 3
  ...
  sys_perf_event_open: pid 12858  cpu -1  group_fd 3  flags 0x8
  sys_perf_event_open failed, error -13

Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1479764011-10732-2-git-send-email-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c52d9e4e
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1481,7 +1481,7 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,


			group_fd = get_group_fd(evsel, cpu, thread);
			group_fd = get_group_fd(evsel, cpu, thread);
retry_open:
retry_open:
			pr_debug2("sys_perf_event_open: pid %d  cpu %d  group_fd %d  flags %#lx\n",
			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(evsel, cpu, thread) = sys_perf_event_open(&evsel->attr,
@@ -1490,11 +1490,13 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
								     group_fd, flags);
								     group_fd, flags);
			if (FD(evsel, cpu, thread) < 0) {
			if (FD(evsel, cpu, thread) < 0) {
				err = -errno;
				err = -errno;
				pr_debug2("sys_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));

			if (evsel->bpf_fd >= 0) {
			if (evsel->bpf_fd >= 0) {
				int evt_fd = FD(evsel, cpu, thread);
				int evt_fd = FD(evsel, cpu, thread);
				int bpf_fd = evsel->bpf_fd;
				int bpf_fd = evsel->bpf_fd;