Adding source line dimension key wrapper. It is to be displayed in the single cacheline output:
cl_srcline It displays source line related to the code address that accessed cacheline. It's a wrapper to global srcline sort entry. Link: http://lkml.kernel.org/n/tip-cmnzgm37mjz56ozsg4mnb...@git.kernel.org Signed-off-by: Jiri Olsa <jo...@kernel.org> --- tools/perf/builtin-c2c.c | 11 +++++++++++ tools/perf/util/sort.c | 2 +- tools/perf/util/sort.h | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index a4fea832e677..c540917a70c4 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -50,6 +50,8 @@ struct perf_c2c { int cpus_cnt; int *cpu2node; int node_info; + + bool show_src; }; static struct perf_c2c c2c; @@ -1363,6 +1365,11 @@ static struct c2c_dimension dim_cpucnt = { .width = 8, }; +static struct c2c_dimension dim_srcline = { + .name = "cl_srcline", + .se = &sort_srcline, +}; + #undef HEADER_LOW #undef HEADER_BOTH #undef HEADER_SPAN @@ -1406,6 +1413,7 @@ static struct c2c_dimension *dimensions[] = { &dim_mean_lcl, &dim_mean_load, &dim_cpucnt, + &dim_srcline, NULL, }; @@ -1613,6 +1621,9 @@ static int c2c_hists__reinit(struct c2c_hists *c2c_hists, static int filter_cb(struct hist_entry *he __maybe_unused) { + if (c2c.show_src && !he->srcline) + he->srcline = hist_entry__get_srcline(he); + return 0; } diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 452e15a10dd2..df622f4e301e 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -315,7 +315,7 @@ struct sort_entry sort_sym = { /* --sort srcline */ -static char *hist_entry__get_srcline(struct hist_entry *he) +char *hist_entry__get_srcline(struct hist_entry *he) { struct map *map = he->ms.map; diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index d4ef567dcd7b..7aff317fc7c4 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -40,6 +40,7 @@ extern struct sort_entry sort_dso_from; extern struct sort_entry sort_dso_to; extern struct sort_entry sort_sym_from; extern struct sort_entry sort_sym_to; +extern struct sort_entry sort_srcline; extern enum sort_type sort__first_dimension; extern const char default_mem_sort_order[]; @@ -279,4 +280,5 @@ int64_t sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right); int64_t sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right); +char *hist_entry__get_srcline(struct hist_entry *he); #endif /* __PERF_SORT_H */ -- 2.7.4