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

perf c2c report: Add span header over cacheline data

Forcing the NUMA node output to be grouped with the "Cacheline" column
in both "Shared Data Cache Line Table" and "Shared Cache Line
Distribution Pareto" tables.

Before:
# Total Tot ----- LLC Load Hitm -----
# Index Cacheline Node records Hitm Total Lcl Rmt
# ..... .................. .... ....... ....... ....... ....... .......
#
0 0x7f0830100000 0 84 10.53% 8 8 0
1 0xffff922a93154200 0 3 2.63% 2 2 0
2 0xffff922a93154500 0 4 2.63% 2 2 0

After:
# ------- Cacheline ------ Total Tot ----- LLC Load Hitm -----
# Index Address Node records Hitm Total Lcl Rmt
# ..... .................. .... ....... ....... ....... ....... .......
#
0 0x7f0830100000 0 84 10.53% 8 8 0
1 0xffff922a93154200 0 3 2.63% 2 2 0
2 0xffff922a93154500 0 4 2.63% 2 2 0

Before:
# ----- HITM ----- -- Store Refs -- Data address
# Num Rmt Lcl L1 Hit L1 Miss Offset Node Pid
# ..... ....... ....... ....... ....... .................. .... .......
#
-------------------------------------------------------------
0 0 8 32 2 0x7f0830100000
-------------------------------------------------------------
0.00% 75.00% 21.88% 0.00% 0x18 0 1791
0.00% 12.50% 37.50% 0.00% 0x18 0 1791
0.00% 0.00% 34.38% 0.00% 0x18 0 1791

After:
# ----- HITM ----- -- Store Refs -- ----- Data address -----
# Num Rmt Lcl L1 Hit L1 Miss Offset Node Pid
# ..... ....... ....... ....... ....... .................. .... .......
#
-------------------------------------------------------------
0 0 8 32 2 0x7f0830100000
-------------------------------------------------------------
0.00% 75.00% 21.88% 0.00% 0x18 0 1791
0.00% 12.50% 37.50% 0.00% 0x18 0 1791
0.00% 0.00% 34.38% 0.00% 0x18 0 1791

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-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
d0802b1e 7f834c2e

+58 -5
+58 -5
tools/perf/builtin-c2c.c
··· 1252 1252 } 1253 1253 1254 1254 static struct c2c_dimension dim_dcacheline = { 1255 - .header = HEADER_LOW("Cacheline"), 1255 + .header = HEADER_SPAN("--- Cacheline ----", "Address", 1), 1256 1256 .name = "dcacheline", 1257 1257 .cmp = dcacheline_cmp, 1258 1258 .entry = dcacheline_entry, ··· 1267 1267 .width = 4, 1268 1268 }; 1269 1269 1270 - static struct c2c_header header_offset_tui = HEADER_LOW("Off"); 1270 + static struct c2c_header header_offset_tui = HEADER_SPAN("-----", "Off", 1); 1271 1271 1272 1272 static struct c2c_dimension dim_offset = { 1273 - .header = HEADER_BOTH("Data address", "Offset"), 1273 + .header = HEADER_SPAN("--- Data address -", "Offset", 1), 1274 1274 .name = "offset", 1275 1275 .cmp = offset_cmp, 1276 1276 .entry = offset_entry, ··· 2453 2453 } 2454 2454 #endif /* HAVE_SLANG_SUPPORT */ 2455 2455 2456 - static void ui_quirks(void) 2456 + static char *fill_line(const char *orig, int len) 2457 2457 { 2458 + int i, j, olen = strlen(orig); 2459 + char *buf; 2460 + 2461 + buf = zalloc(len + 1); 2462 + if (!buf) 2463 + return NULL; 2464 + 2465 + j = len / 2 - olen / 2; 2466 + 2467 + for (i = 0; i < j - 1; i++) 2468 + buf[i] = '-'; 2469 + 2470 + buf[i++] = ' '; 2471 + 2472 + strcpy(buf + i, orig); 2473 + 2474 + i += olen; 2475 + 2476 + buf[i++] = ' '; 2477 + 2478 + for (; i < len; i++) 2479 + buf[i] = '-'; 2480 + 2481 + return buf; 2482 + } 2483 + 2484 + static int ui_quirks(void) 2485 + { 2486 + const char *nodestr = "Data address"; 2487 + char *buf; 2488 + 2458 2489 if (!c2c.use_stdio) { 2459 2490 dim_offset.width = 5; 2460 2491 dim_offset.header = header_offset_tui; 2492 + nodestr = "CL"; 2461 2493 } 2462 2494 2463 2495 dim_percent_hitm.header = percent_hitm_header[c2c.display]; 2496 + 2497 + /* Fix the zero line for dcacheline column. */ 2498 + buf = fill_line("Cacheline", dim_dcacheline.width + 2499 + dim_dcacheline_node.width + 2); 2500 + if (!buf) 2501 + return -ENOMEM; 2502 + 2503 + dim_dcacheline.header.line[0].text = buf; 2504 + 2505 + /* Fix the zero line for offset column. */ 2506 + buf = fill_line(nodestr, dim_offset.width + 2507 + dim_offset_node.width + 2); 2508 + if (!buf) 2509 + return -ENOMEM; 2510 + 2511 + dim_offset.header.line[0].text = buf; 2512 + 2513 + return 0; 2464 2514 } 2465 2515 2466 2516 #define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent" ··· 2810 2760 2811 2761 ui_progress__finish(); 2812 2762 2813 - ui_quirks(); 2763 + if (ui_quirks()) { 2764 + pr_err("failed to setup UI\n"); 2765 + goto out_mem2node; 2766 + } 2814 2767 2815 2768 perf_c2c_display(session); 2816 2769