Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf c2c report: Add src line sort key

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.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-cmnzgm37mjz56ozsg4mnbgxq@git.kernel.org
[ Remove __maybe_unused from now used 'he' parameter in filter_cb() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
89d9ba8f b6fe2bbc

+14 -2
+12 -1
tools/perf/builtin-c2c.c
··· 50 50 int cpus_cnt; 51 51 int *cpu2node; 52 52 int node_info; 53 + 54 + bool show_src; 53 55 }; 54 56 55 57 static struct perf_c2c c2c; ··· 1365 1363 .width = 8, 1366 1364 }; 1367 1365 1366 + static struct c2c_dimension dim_srcline = { 1367 + .name = "cl_srcline", 1368 + .se = &sort_srcline, 1369 + }; 1370 + 1368 1371 static struct c2c_dimension *dimensions[] = { 1369 1372 &dim_dcacheline, 1370 1373 &dim_offset, ··· 1408 1401 &dim_mean_lcl, 1409 1402 &dim_mean_load, 1410 1403 &dim_cpucnt, 1404 + &dim_srcline, 1411 1405 NULL, 1412 1406 }; 1413 1407 ··· 1614 1606 return hpp_list__parse(&c2c_hists->list, output, sort); 1615 1607 } 1616 1608 1617 - static int filter_cb(struct hist_entry *he __maybe_unused) 1609 + static int filter_cb(struct hist_entry *he) 1618 1610 { 1611 + if (c2c.show_src && !he->srcline) 1612 + he->srcline = hist_entry__get_srcline(he); 1613 + 1619 1614 return 0; 1620 1615 } 1621 1616
+1 -1
tools/perf/util/sort.c
··· 315 315 316 316 /* --sort srcline */ 317 317 318 - static char *hist_entry__get_srcline(struct hist_entry *he) 318 + char *hist_entry__get_srcline(struct hist_entry *he) 319 319 { 320 320 struct map *map = he->ms.map; 321 321
+1
tools/perf/util/sort.h
··· 280 280 sort__daddr_cmp(struct hist_entry *left, struct hist_entry *right); 281 281 int64_t 282 282 sort__dcacheline_cmp(struct hist_entry *left, struct hist_entry *right); 283 + char *hist_entry__get_srcline(struct hist_entry *he); 283 284 #endif /* __PERF_SORT_H */