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

perf c2c report: Add cacheline address count column

Adding the 'PA cnt' column grouped under data cacheline address.

It shows how many times the physical addresses changed for the hist
entry. It does not show the number of different physical addresses for
entry, because we don't store those. We only track the number of times
we got different address than we currently hold, which is not expensive
and gives similar info.

$ perf c2c report --stdio

# ----------- Cacheline ---------- Total Tot ----- LLC Load Hitm -----
# Index Address Node PA cnt records Hitm Total Lcl Rmt
# ..... .................. .... ...... ....... ....... ....... ....... .......
#
0 0xffff9ad56dca0a80 0 9 10 7.69% 2 2 0
1 0xffff9ad56dce0a80 0 9 9 7.69% 2 2 0
2 0xffff9ad37659ad80 0 1 2 3.85% 1 1 0

...

# ----- HITM ----- -- Store Refs -- --------- Data address ---------
# Num Rmt Lcl L1 Hit L1 Miss Offset Node PA cnt Pid
# ..... ....... ....... ....... ....... .................. .... ...... .......
#
-------------------------------------------------------------
0 0 2 3 0 0xffff9ad56dca0a80
-------------------------------------------------------------
0.00% 0.00% 33.33% 0.00% 0x0 0 1 2510
0.00% 0.00% 33.33% 0.00% 0x4 0 1 2476
0.00% 0.00% 33.33% 0.00% 0x20 0 1 0
0.00% 100.00% 0.00% 0.00% 0x38 0 1 0

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180309101442.9224-10-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
03d9fcb7 d0802b1e

+29 -6
+29 -6
tools/perf/builtin-c2c.c
··· 507 507 return scnprintf(hpp->buf, hpp->size, "%*s", width, c2c_he->nodestr); 508 508 } 509 509 510 + static int 511 + dcacheline_node_count(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, 512 + struct hist_entry *he) 513 + { 514 + struct c2c_hist_entry *c2c_he; 515 + int width = c2c_width(fmt, hpp, he->hists); 516 + 517 + c2c_he = container_of(he, struct c2c_hist_entry, he); 518 + return scnprintf(hpp->buf, hpp->size, "%*lu", width, c2c_he->paddr_cnt); 519 + } 520 + 510 521 static int offset_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, 511 522 struct hist_entry *he) 512 523 { ··· 1263 1252 } 1264 1253 1265 1254 static struct c2c_dimension dim_dcacheline = { 1266 - .header = HEADER_SPAN("--- Cacheline ----", "Address", 1), 1255 + .header = HEADER_SPAN("--- Cacheline ----", "Address", 2), 1267 1256 .name = "dcacheline", 1268 1257 .cmp = dcacheline_cmp, 1269 1258 .entry = dcacheline_entry, ··· 1278 1267 .width = 4, 1279 1268 }; 1280 1269 1281 - static struct c2c_header header_offset_tui = HEADER_SPAN("-----", "Off", 1); 1270 + static struct c2c_dimension dim_dcacheline_count = { 1271 + .header = HEADER_LOW("PA cnt"), 1272 + .name = "dcacheline_count", 1273 + .cmp = empty_cmp, 1274 + .entry = dcacheline_node_count, 1275 + .width = 6, 1276 + }; 1277 + 1278 + static struct c2c_header header_offset_tui = HEADER_SPAN("-----", "Off", 2); 1282 1279 1283 1280 static struct c2c_dimension dim_offset = { 1284 - .header = HEADER_SPAN("--- Data address -", "Offset", 1), 1281 + .header = HEADER_SPAN("--- Data address -", "Offset", 2), 1285 1282 .name = "offset", 1286 1283 .cmp = offset_cmp, 1287 1284 .entry = offset_entry, ··· 1624 1605 static struct c2c_dimension *dimensions[] = { 1625 1606 &dim_dcacheline, 1626 1607 &dim_dcacheline_node, 1608 + &dim_dcacheline_count, 1627 1609 &dim_offset, 1628 1610 &dim_offset_node, 1629 1611 &dim_iaddr, ··· 2516 2496 2517 2497 /* Fix the zero line for dcacheline column. */ 2518 2498 buf = fill_line("Cacheline", dim_dcacheline.width + 2519 - dim_dcacheline_node.width + 2); 2499 + dim_dcacheline_node.width + 2500 + dim_dcacheline_count.width + 4); 2520 2501 if (!buf) 2521 2502 return -ENOMEM; 2522 2503 ··· 2525 2504 2526 2505 /* Fix the zero line for offset column. */ 2527 2506 buf = fill_line(nodestr, dim_offset.width + 2528 - dim_offset_node.width + 2); 2507 + dim_offset_node.width + 2508 + dim_dcacheline_count.width + 4); 2529 2509 if (!buf) 2530 2510 return -ENOMEM; 2531 2511 ··· 2648 2626 "percent_lcl_hitm," 2649 2627 "percent_stores_l1hit," 2650 2628 "percent_stores_l1miss," 2651 - "offset,offset_node,", 2629 + "offset,offset_node,dcacheline_count,", 2652 2630 add_pid ? "pid," : "", 2653 2631 add_tid ? "tid," : "", 2654 2632 add_iaddr ? "iaddr," : "", ··· 2811 2789 "cl_idx," 2812 2790 "dcacheline," 2813 2791 "dcacheline_node," 2792 + "dcacheline_count," 2814 2793 "tot_recs," 2815 2794 "percent_hitm," 2816 2795 "tot_hitm,lcl_hitm,rmt_hitm,"