diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2014-07-14 06:02:38 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-16 16:57:35 -0400 |
commit | 5173fbb8a11b2857aeec9e5f4e9568d4e1b84dbd (patch) | |
tree | 158651f25c5a800d08fcf6e9e98b53ae6d08fa93 | |
parent | 4d40b051b1ac41ecbc818deed27750b4c1697520 (diff) |
perf buildid-cache: Apply force option to copying kcore
Currently a copy of kcore is not made if there is one already with the
same modules at the same addresses.
Change this to make a copy anyway if the force (-f) option is also used.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1405332185-4050-15-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-buildid-cache.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/builtin-buildid-cache.c b/tools/perf/builtin-buildid-cache.c index b22dbb16f877..2a2c78f80876 100644 --- a/tools/perf/builtin-buildid-cache.c +++ b/tools/perf/builtin-buildid-cache.c | |||
@@ -125,7 +125,8 @@ static int build_id_cache__kcore_existing(const char *from_dir, char *to_dir, | |||
125 | return ret; | 125 | return ret; |
126 | } | 126 | } |
127 | 127 | ||
128 | static int build_id_cache__add_kcore(const char *filename, const char *debugdir) | 128 | static int build_id_cache__add_kcore(const char *filename, const char *debugdir, |
129 | bool force) | ||
129 | { | 130 | { |
130 | char dir[32], sbuildid[BUILD_ID_SIZE * 2 + 1]; | 131 | char dir[32], sbuildid[BUILD_ID_SIZE * 2 + 1]; |
131 | char from_dir[PATH_MAX], to_dir[PATH_MAX]; | 132 | char from_dir[PATH_MAX], to_dir[PATH_MAX]; |
@@ -144,7 +145,8 @@ static int build_id_cache__add_kcore(const char *filename, const char *debugdir) | |||
144 | scnprintf(to_dir, sizeof(to_dir), "%s/[kernel.kcore]/%s", | 145 | scnprintf(to_dir, sizeof(to_dir), "%s/[kernel.kcore]/%s", |
145 | debugdir, sbuildid); | 146 | debugdir, sbuildid); |
146 | 147 | ||
147 | if (!build_id_cache__kcore_existing(from_dir, to_dir, sizeof(to_dir))) { | 148 | if (!force && |
149 | !build_id_cache__kcore_existing(from_dir, to_dir, sizeof(to_dir))) { | ||
148 | pr_debug("same kcore found in %s\n", to_dir); | 150 | pr_debug("same kcore found in %s\n", to_dir); |
149 | return 0; | 151 | return 0; |
150 | } | 152 | } |
@@ -389,7 +391,7 @@ int cmd_buildid_cache(int argc, const char **argv, | |||
389 | } | 391 | } |
390 | 392 | ||
391 | if (kcore_filename && | 393 | if (kcore_filename && |
392 | build_id_cache__add_kcore(kcore_filename, debugdir)) | 394 | build_id_cache__add_kcore(kcore_filename, debugdir, force)) |
393 | pr_warning("Couldn't add %s\n", kcore_filename); | 395 | pr_warning("Couldn't add %s\n", kcore_filename); |
394 | 396 | ||
395 | return ret; | 397 | return ret; |