Skip to content

Commit 05b5a9d

Browse files
German Gomezacmel
authored andcommitted
perf tools: Apply correct label to user/kernel symbols in branch mode
In branch mode, the branch symbols were being displayed with incorrect cpumode labels. So fix this. For example, before: # perf record -b -a -- sleep 1 # perf report -b Overhead Command Source Shared Object Source Symbol Target Symbol 0.08% swapper [kernel.kallsyms] [k] rcu_idle_enter [k] cpuidle_enter_state ==> 0.08% cmd0 [kernel.kallsyms] [.] psi_group_change [.] psi_group_change 0.08% cmd1 [kernel.kallsyms] [k] psi_group_change [k] psi_group_change After: # perf report -b Overhead Command Source Shared Object Source Symbol Target Symbol 0.08% swapper [kernel.kallsyms] [k] rcu_idle_enter [k] cpuidle_enter_state 0.08% cmd0 [kernel.kallsyms] [k] psi_group_change [k] pei_group_change 0.08% cmd1 [kernel.kallsyms] [k] psi_group_change [k] psi_group_change Reviewed-by: James Clark <[email protected]> Signed-off-by: German Gomez <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a2887b9 commit 05b5a9d

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

tools/perf/util/machine.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,6 +2073,7 @@ static void ip__resolve_ams(struct thread *thread,
20732073

20742074
ams->addr = ip;
20752075
ams->al_addr = al.addr;
2076+
ams->al_level = al.level;
20762077
ams->ms.maps = al.maps;
20772078
ams->ms.sym = al.sym;
20782079
ams->ms.map = al.map;
@@ -2092,6 +2093,7 @@ static void ip__resolve_data(struct thread *thread,
20922093

20932094
ams->addr = addr;
20942095
ams->al_addr = al.addr;
2096+
ams->al_level = al.level;
20952097
ams->ms.maps = al.maps;
20962098
ams->ms.sym = al.sym;
20972099
ams->ms.map = al.map;

tools/perf/util/map_symbol.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct addr_map_symbol {
1818
struct map_symbol ms;
1919
u64 addr;
2020
u64 al_addr;
21+
char al_level;
2122
u64 phys_addr;
2223
u64 data_page_size;
2324
};

tools/perf/util/sort.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf,
915915
struct addr_map_symbol *from = &he->branch_info->from;
916916

917917
return _hist_entry__sym_snprintf(&from->ms, from->al_addr,
918-
he->level, bf, size, width);
918+
from->al_level, bf, size, width);
919919
}
920920

921921
return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");
@@ -928,7 +928,7 @@ static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf,
928928
struct addr_map_symbol *to = &he->branch_info->to;
929929

930930
return _hist_entry__sym_snprintf(&to->ms, to->al_addr,
931-
he->level, bf, size, width);
931+
to->al_level, bf, size, width);
932932
}
933933

934934
return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A");

0 commit comments

Comments
 (0)