]> git.baikalelectronics.ru Git - kernel.git/commitdiff
perf machine: Add machine__for_each_dso() function
authorJiri Olsa <jolsa@kernel.org>
Sun, 13 Sep 2020 21:03:08 +0000 (23:03 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Sep 2020 18:47:12 +0000 (15:47 -0300)
Add the machine__for_each_dso() to iterate over all dso objects defined
for the within a machine object. It will be used in the MMAP3 patch
series.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200913210313.1985612-22-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/machine.c
tools/perf/util/machine.h

index 85587de027a51880a647441ca866348867577687..7d4194ffc5b081bb805f259737f64057f5527f68 100644 (file)
@@ -3100,3 +3100,15 @@ char *machine__resolve_kernel_addr(void *vmachine, unsigned long long *addrp, ch
        *addrp = map->unmap_ip(map, sym->start);
        return sym->name;
 }
+
+int machine__for_each_dso(struct machine *machine, machine__dso_t fn, void *priv)
+{
+       struct dso *pos;
+       int err = 0;
+
+       list_for_each_entry(pos, &machine->dsos.head, node) {
+               if (fn(pos, machine, priv))
+                       err = -1;
+       }
+       return err;
+}
index 062c36a8433cec835a53313009d91aab640ec7ec..26368d3c17543bd6607ab7e8e11b64367446ac9a 100644 (file)
@@ -250,6 +250,10 @@ void machines__destroy_kernel_maps(struct machines *machines);
 
 size_t machine__fprintf_vmlinux_path(struct machine *machine, FILE *fp);
 
+typedef int (*machine__dso_t)(struct dso *dso, struct machine *machine, void *priv);
+
+int machine__for_each_dso(struct machine *machine, machine__dso_t fn,
+                         void *priv);
 int machine__for_each_thread(struct machine *machine,
                             int (*fn)(struct thread *thread, void *p),
                             void *priv);