[PATCH 08/31] perf c2c report: Add span header over cacheline data
From: Jiri OlsaForcing 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 HitmTotal Lcl Rmt # . .. ... ... ... ... ... # 0 0x7f083010 0 84 10.53%880 1 0x922a93154200 032.63%220 2 0x922a93154500 042.63%220 After: #--- Cacheline --Total Tot - LLC Load Hitm - # Index Address Node records HitmTotal Lcl Rmt # . .. ... ... ... ... ... # 0 0x7f083010 0 84 10.53%880 1 0x922a93154200 032.63%220 2 0x922a93154500 042.63%220 Before: #- HITM - -- Store Refs --Data address # Num Rmt Lcl L1 Hit L1 Miss Offset Node Pid # . ... ... ... ... .. ... # - 008 322 0x7f083010 - 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 # . ... ... ... ... .. ... # - 008 322 0x7f083010 - 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 Cc: Alexander Shishkin Cc: David Ahern Cc: Joe Mario Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180309101442.9224-9-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 63 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 45c047fdd7ac..a6336e4e2850 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1252,7 +1252,7 @@ cl_idx_empty_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, } static struct c2c_dimension dim_dcacheline = { - .header = HEADER_LOW("Cacheline"), + .header = HEADER_SPAN("--- Cacheline ", "Address", 1), .name = "dcacheline", .cmp= dcacheline_cmp, .entry = dcacheline_entry, @@ -1267,10 +1267,10 @@ static struct c2c_dimension dim_dcacheline_node = { .width = 4, }; -static struct c2c_header header_offset_tui = HEADER_LOW("Off"); +static struct c2c_header header_offset_tui = HEADER_SPAN("-", "Off", 1); static struct c2c_dimension dim_offset = { - .header = HEADER_BOTH("Data address", "Offset"), + .header = HEADER_SPAN("--- Data address -", "Offset", 1), .name = "offset", .cmp= offset_cmp, .entry = offset_entry, @@ -2453,14 +2453,64 @@ static void perf_c2c_display(struct perf_session *session) } #endif /* HAVE_SLANG_SUPPORT */ -static void ui_quirks(void) +static char *fill_line(const char *orig, int len) { + int i, j, olen = strlen(orig); + char *buf; + + buf = zalloc(len + 1); + if (!buf) + return NULL; + + j = len / 2 - olen / 2; + + for (i = 0; i < j - 1; i++) + buf[i] = '-'; + + buf[i++] = ' '; + + strcpy(buf + i, orig); + + i += olen; + + buf[i++] = ' '; + + for (; i < len; i++) + buf[i] = '-'; + + return buf; +} + +static int ui_quirks(void) +{ + const char *nodestr = "Data address"; + char *buf; + if (!c2c.use_stdio) {
[PATCH 08/31] perf c2c report: Add span header over cacheline data
From: Jiri Olsa 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 HitmTotal Lcl Rmt # . .. ... ... ... ... ... # 0 0x7f083010 0 84 10.53%880 1 0x922a93154200 032.63%220 2 0x922a93154500 042.63%220 After: #--- Cacheline --Total Tot - LLC Load Hitm - # Index Address Node records HitmTotal Lcl Rmt # . .. ... ... ... ... ... # 0 0x7f083010 0 84 10.53%880 1 0x922a93154200 032.63%220 2 0x922a93154500 042.63%220 Before: #- HITM - -- Store Refs --Data address # Num Rmt Lcl L1 Hit L1 Miss Offset Node Pid # . ... ... ... ... .. ... # - 008 322 0x7f083010 - 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 # . ... ... ... ... .. ... # - 008 322 0x7f083010 - 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 Cc: Alexander Shishkin Cc: David Ahern Cc: Joe Mario Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20180309101442.9224-9-jo...@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-c2c.c | 63 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 45c047fdd7ac..a6336e4e2850 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -1252,7 +1252,7 @@ cl_idx_empty_entry(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, } static struct c2c_dimension dim_dcacheline = { - .header = HEADER_LOW("Cacheline"), + .header = HEADER_SPAN("--- Cacheline ", "Address", 1), .name = "dcacheline", .cmp= dcacheline_cmp, .entry = dcacheline_entry, @@ -1267,10 +1267,10 @@ static struct c2c_dimension dim_dcacheline_node = { .width = 4, }; -static struct c2c_header header_offset_tui = HEADER_LOW("Off"); +static struct c2c_header header_offset_tui = HEADER_SPAN("-", "Off", 1); static struct c2c_dimension dim_offset = { - .header = HEADER_BOTH("Data address", "Offset"), + .header = HEADER_SPAN("--- Data address -", "Offset", 1), .name = "offset", .cmp= offset_cmp, .entry = offset_entry, @@ -2453,14 +2453,64 @@ static void perf_c2c_display(struct perf_session *session) } #endif /* HAVE_SLANG_SUPPORT */ -static void ui_quirks(void) +static char *fill_line(const char *orig, int len) { + int i, j, olen = strlen(orig); + char *buf; + + buf = zalloc(len + 1); + if (!buf) + return NULL; + + j = len / 2 - olen / 2; + + for (i = 0; i < j - 1; i++) + buf[i] = '-'; + + buf[i++] = ' '; + + strcpy(buf + i, orig); + + i += olen; + + buf[i++] = ' '; + + for (; i < len; i++) + buf[i] = '-'; + + return buf; +} + +static int ui_quirks(void) +{ + const char *nodestr = "Data address"; + char *buf; + if (!c2c.use_stdio) { dim_offset.width = 5; dim_offset.header = header_offset_tui; + nodestr = "CL"; } dim_percent_hitm.header =