perf evlist: We need to poll all event file descriptors
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 8 Sep 2014 15:55:12 +0000 (12:55 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 25 Sep 2014 19:46:54 +0000 (16:46 -0300)
Because we want to notice when they get POLLHUP'ed, so that we can
figure out when all threads exited in a workload being monitored.

We can't just monitor the fds that were mmaped, we need to notice when
all the fds that were PERF_EVENT_IOC_SET_OUTPUT'ed too, because the mmap
stays even after the fd that originally was used to do the mmap call
went away, its only when all the set-output fds for a mmap are gone that
the mmap is.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20140908151016.GH17728@krava.brq.redhat.com
Link: http://lkml.kernel.org/n/tip-24omlq5asrfg4uo3muuzn2bl@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evlist.c

index 502cd11ab17e52ae219d9b4df71882280fee0c82..6b13bfa7ac2ccdf7ac95458ff88866b5cd7ed077 100644 (file)
@@ -717,8 +717,6 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
                evlist->mmap[idx].base = NULL;
                return -1;
        }
-
-       perf_evlist__add_pollfd(evlist, fd);
        return 0;
 }
 
@@ -745,6 +743,8 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
                                return -1;
                }
 
+               perf_evlist__add_pollfd(evlist, fd);
+
                if ((evsel->attr.read_format & PERF_FORMAT_ID) &&
                    perf_evlist__id_add_fd(evlist, evsel, cpu, thread, fd) < 0)
                        return -1;
This page took 0.035881 seconds and 5 git commands to generate.