}
static struct c2c_dimension dim_dcacheline = {
- .header = HEADER_LOW("Cacheline"),
+ .header = HEADER_SPAN("--- Cacheline ----", "Address", 1),
.name = "dcacheline",
.cmp = dcacheline_cmp,
.entry = dcacheline_entry,
.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,
}
#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 = percent_hitm_header[c2c.display];
+
+ /* Fix the zero line for dcacheline column. */
+ buf = fill_line("Cacheline", dim_dcacheline.width +
+ dim_dcacheline_node.width + 2);
+ if (!buf)
+ return -ENOMEM;
+
+ dim_dcacheline.header.line[0].text = buf;
+
+ /* Fix the zero line for offset column. */
+ buf = fill_line(nodestr, dim_offset.width +
+ dim_offset_node.width + 2);
+ if (!buf)
+ return -ENOMEM;
+
+ dim_offset.header.line[0].text = buf;
+
+ return 0;
}
#define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function,percent"
ui_progress__finish();
- ui_quirks();
+ if (ui_quirks()) {
+ pr_err("failed to setup UI\n");
+ goto out_mem2node;
+ }
perf_c2c_display(session);