Commit 62d2c08b authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

selftests/bpf: shorten "Total insns/states" column names in veristat

In comparison mode the "Total " part is pretty useless, but takes
a considerable amount of horizontal space. Drop the "Total " parts.

Also make sure that table headers for numerical columns are aligned in
the same fashion as integer values in those columns. This looks better
and is now more obvious with shorter "Insns" and "States" column
headers.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20221103055304.2904589-3-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 9b5e3536
...@@ -405,13 +405,14 @@ static struct stat_def { ...@@ -405,13 +405,14 @@ static struct stat_def {
const char *header; const char *header;
const char *names[4]; const char *names[4];
bool asc_by_default; bool asc_by_default;
bool left_aligned;
} stat_defs[] = { } stat_defs[] = {
[FILE_NAME] = { "File", {"file_name", "filename", "file"}, true /* asc */ }, [FILE_NAME] = { "File", {"file_name", "filename", "file"}, true /* asc */, true /* left */ },
[PROG_NAME] = { "Program", {"prog_name", "progname", "prog"}, true /* asc */ }, [PROG_NAME] = { "Program", {"prog_name", "progname", "prog"}, true /* asc */, true /* left */ },
[VERDICT] = { "Verdict", {"verdict"}, true /* asc: failure, success */ }, [VERDICT] = { "Verdict", {"verdict"}, true /* asc: failure, success */, true /* left */ },
[DURATION] = { "Duration (us)", {"duration", "dur"}, }, [DURATION] = { "Duration (us)", {"duration", "dur"}, },
[TOTAL_INSNS] = { "Total insns", {"total_insns", "insns"}, }, [TOTAL_INSNS] = { "Insns", {"total_insns", "insns"}, },
[TOTAL_STATES] = { "Total states", {"total_states", "states"}, }, [TOTAL_STATES] = { "States", {"total_states", "states"}, },
[PEAK_STATES] = { "Peak states", {"peak_states"}, }, [PEAK_STATES] = { "Peak states", {"peak_states"}, },
[MAX_STATES_PER_INSN] = { "Max states per insn", {"max_states_per_insn"}, }, [MAX_STATES_PER_INSN] = { "Max states per insn", {"max_states_per_insn"}, },
[MARK_READ_MAX_LEN] = { "Max mark read length", {"max_mark_read_len", "mark_read"}, }, [MARK_READ_MAX_LEN] = { "Max mark read length", {"max_mark_read_len", "mark_read"}, },
...@@ -743,6 +744,7 @@ static void output_header_underlines(void) ...@@ -743,6 +744,7 @@ static void output_header_underlines(void)
static void output_headers(enum resfmt fmt) static void output_headers(enum resfmt fmt)
{ {
const char *fmt_str;
int i, len; int i, len;
for (i = 0; i < env.output_spec.spec_cnt; i++) { for (i = 0; i < env.output_spec.spec_cnt; i++) {
...@@ -756,7 +758,8 @@ static void output_headers(enum resfmt fmt) ...@@ -756,7 +758,8 @@ static void output_headers(enum resfmt fmt)
*max_len = len; *max_len = len;
break; break;
case RESFMT_TABLE: case RESFMT_TABLE:
printf("%s%-*s", i == 0 ? "" : COLUMN_SEP, *max_len, stat_defs[id].header); fmt_str = stat_defs[id].left_aligned ? "%s%-*s" : "%s%*s";
printf(fmt_str, i == 0 ? "" : COLUMN_SEP, *max_len, stat_defs[id].header);
if (i == env.output_spec.spec_cnt - 1) if (i == env.output_spec.spec_cnt - 1)
printf("\n"); printf("\n");
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment