Skip to content

Commit ed6c166

Browse files
kliang2acmel
authored andcommitted
perf diff: Do not overwrite valid build id
Fixes a perf diff regression issue which was introduced by commit 5baecbc ("perf symbols: we can now read separate debug-info files based on a build ID") The binary name could be same when perf diff different binaries. Build id is used to distinguish between them. However, the previous patch assumes the same binary name has same build id. So it overwrites the build id according to the binary name, regardless of whether the build id is set or not. Check the has_build_id in dso__load. If the build id is already set, use it. Before the fix: $ perf diff 1.perf.data 2.perf.data # Event 'cycles' # # Baseline Delta Shared Object Symbol # ........ ....... ................ ............................. # 99.83% -99.80% tchain_edit [.] f2 0.12% +99.81% tchain_edit [.] f3 0.02% -0.01% [ixgbe] [k] ixgbe_read_reg After the fix: $ perf diff 1.perf.data 2.perf.data # Event 'cycles' # # Baseline Delta Shared Object Symbol # ........ ....... ................ ............................. # 99.83% +0.10% tchain_edit [.] f3 0.12% -0.08% tchain_edit [.] f2 Signed-off-by: Kan Liang <kan.liang@intel.com> Cc: Andi Kleen <andi@firstfloor.org> CC: Dima Kogan <dima@secretsauce.net> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Fixes: 5baecbc ("perf symbols: we can now read separate debug-info files based on a build ID") Link: http://lkml.kernel.org/r/1481642984-13593-1-git-send-email-kan.liang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent edee44b commit ed6c166

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎tools/perf/util/symbol.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,8 @@ int dso__load(struct dso *dso, struct map *map)
14591459
* Read the build id if possible. This is required for
14601460
* DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
14611461
*/
1462-
if (is_regular_file(dso->long_name) &&
1462+
if (!dso->has_build_id &&
1463+
is_regular_file(dso->long_name) &&
14631464
filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
14641465
dso__set_build_id(dso, build_id);
14651466

0 commit comments

Comments
 (0)