Skip to content

Commit d47d876

Browse files
captain5050namhyung
authored andcommitted
perf callchain: Make display use of branch_type_stat const
Display code doesn't modify the branch_type_stat so switch uses to const. This is done to aid refactoring struct callchain_list where current the branch_type_stat is embedded even if not used. Signed-off-by: Ian Rogers <irogers@google.com> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: German Gomez <german.gomez@arm.com> Cc: James Clark <james.clark@arm.com> Cc: Nick Terrell <terrelln@fb.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Changbin Du <changbin.du@huawei.com> Cc: liuwenyu <liuwenyu7@huawei.com> Cc: Yang Jihong <yangjihong1@huawei.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Song Liu <song@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Liam Howlett <liam.howlett@oracle.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Link: https://lore.kernel.org/r/20231024222353.3024098-9-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent 67a3ebf commit d47d876

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

tools/perf/util/branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const char *get_branch_type(struct branch_entry *e)
109109
return branch_type_name(e->flags.type);
110110
}
111111

112-
void branch_type_stat_display(FILE *fp, struct branch_type_stat *st)
112+
void branch_type_stat_display(FILE *fp, const struct branch_type_stat *st)
113113
{
114114
u64 total = 0;
115115
int i;
@@ -171,7 +171,7 @@ static int count_str_scnprintf(int idx, const char *str, char *bf, int size)
171171
return scnprintf(bf, size, "%s%s", (idx) ? " " : " (", str);
172172
}
173173

174-
int branch_type_str(struct branch_type_stat *st, char *bf, int size)
174+
int branch_type_str(const struct branch_type_stat *st, char *bf, int size)
175175
{
176176
int i, j = 0, printed = 0;
177177
u64 total = 0;

tools/perf/util/branch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ void branch_type_count(struct branch_type_stat *st, struct branch_flags *flags,
8686
const char *branch_type_name(int type);
8787
const char *branch_new_type_name(int new_type);
8888
const char *get_branch_type(struct branch_entry *e);
89-
void branch_type_stat_display(FILE *fp, struct branch_type_stat *st);
90-
int branch_type_str(struct branch_type_stat *st, char *bf, int bfsize);
89+
void branch_type_stat_display(FILE *fp, const struct branch_type_stat *st);
90+
int branch_type_str(const struct branch_type_stat *st, char *bf, int bfsize);
9191

9292
const char *branch_spec_desc(int spec);
9393

tools/perf/util/callchain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ static int count_float_printf(int idx, const char *str, float value,
13391339
static int branch_to_str(char *bf, int bfsize,
13401340
u64 branch_count, u64 predicted_count,
13411341
u64 abort_count,
1342-
struct branch_type_stat *brtype_stat)
1342+
const struct branch_type_stat *brtype_stat)
13431343
{
13441344
int printed, i = 0;
13451345

@@ -1403,7 +1403,7 @@ static int counts_str_build(char *bf, int bfsize,
14031403
u64 abort_count, u64 cycles_count,
14041404
u64 iter_count, u64 iter_cycles,
14051405
u64 from_count,
1406-
struct branch_type_stat *brtype_stat)
1406+
const struct branch_type_stat *brtype_stat)
14071407
{
14081408
int printed;
14091409

@@ -1430,7 +1430,7 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize,
14301430
u64 abort_count, u64 cycles_count,
14311431
u64 iter_count, u64 iter_cycles,
14321432
u64 from_count,
1433-
struct branch_type_stat *brtype_stat)
1433+
const struct branch_type_stat *brtype_stat)
14341434
{
14351435
char str[256];
14361436

0 commit comments

Comments
 (0)