]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
perf build-id: Add __perf_session__cache_build_ids function
authorJiri Olsa <jolsa@kernel.org>
Thu, 26 Nov 2020 17:00:20 +0000 (18:00 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 27 Nov 2020 11:37:25 +0000 (08:37 -0300)
Adding __perf_session__cache_build_ids function as an interface for
caching sessions build ids with callback function and its data pointer.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@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: Ian Rogers <irogers@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20201126170026.2619053-20-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/build-id.c
tools/perf/util/build-id.h

index 948a7f48d6681a7eb448afe095e0bb19cc25360f..6bf3cc79c5d5d1a7cbc1d669a2438e09cb183633 100644 (file)
@@ -892,7 +892,8 @@ machines__for_each_dso(struct machines *machines, machine__dso_t fn, void *priv)
        return ret ? -1 : 0;
 }
 
-int perf_session__cache_build_ids(struct perf_session *session)
+int __perf_session__cache_build_ids(struct perf_session *session,
+                                   machine__dso_t fn, void *priv)
 {
        if (no_buildid_cache)
                return 0;
@@ -900,7 +901,12 @@ int perf_session__cache_build_ids(struct perf_session *session)
        if (mkdir(buildid_dir, 0755) != 0 && errno != EEXIST)
                return -1;
 
-       return machines__for_each_dso(&session->machines, dso__cache_build_id, NULL) ?  -1 : 0;
+       return machines__for_each_dso(&session->machines, fn, priv) ?  -1 : 0;
+}
+
+int perf_session__cache_build_ids(struct perf_session *session)
+{
+       return __perf_session__cache_build_ids(session, dso__cache_build_id, NULL);
 }
 
 static bool machine__read_build_ids(struct machine *machine, bool with_hits)
index f1a2f67df6e48b8b95c6235be01e1f7b18f522a2..c6f10e3d21523efc21a6889fd66d80959c4bfe83 100644 (file)
@@ -5,6 +5,7 @@
 #define BUILD_ID_SIZE  20
 #define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
 
+#include "machine.h"
 #include "tool.h"
 #include <linux/types.h>
 
@@ -46,6 +47,8 @@ bool perf_session__read_build_ids(struct perf_session *session, bool with_hits);
 int perf_session__write_buildid_table(struct perf_session *session,
                                      struct feat_fd *fd);
 int perf_session__cache_build_ids(struct perf_session *session);
+int __perf_session__cache_build_ids(struct perf_session *session,
+                                   machine__dso_t fn, void *priv);
 
 char *build_id_cache__origname(const char *sbuild_id);
 char *build_id_cache__linkname(const char *sbuild_id, char *bf, size_t size);