summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/veristat.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-11-02 22:53:01 -0700
committerAlexei Starovoitov <ast@kernel.org>2022-11-03 21:54:13 -0700
commit77534401d69c2a35d2a53e599fafb5f0f604e45d (patch)
tree02f0ed2610cd169896c3febe2794ea148e31434d /tools/testing/selftests/bpf/veristat.c
parent1bb4ec815015609c9458d5ffeb5c8cc95b7d44d6 (diff)
downloadlinux-77534401d69c2a35d2a53e599fafb5f0f604e45d.tar.gz
linux-77534401d69c2a35d2a53e599fafb5f0f604e45d.tar.bz2
linux-77534401d69c2a35d2a53e599fafb5f0f604e45d.zip
selftests/bpf: make veristat emit all stats in CSV mode by default
Make veristat distinguish between table and CSV output formats and use different default set of stats (columns) that are emitted. While for human-readable table output it doesn't make sense to output all known stats, it is very useful for CSV mode to record all possible data, so that it can later be queried and filtered in replay or comparison mode. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20221103055304.2904589-8-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/veristat.c')
-rw-r--r--tools/testing/selftests/bpf/veristat.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
index 37e512d233a7..ec1a8ba7791c 100644
--- a/tools/testing/selftests/bpf/veristat.c
+++ b/tools/testing/selftests/bpf/veristat.c
@@ -501,6 +501,15 @@ static const struct stat_specs default_output_spec = {
},
};
+static const struct stat_specs default_csv_output_spec = {
+ .spec_cnt = 9,
+ .ids = {
+ FILE_NAME, PROG_NAME, VERDICT, DURATION,
+ TOTAL_INSNS, TOTAL_STATES, PEAK_STATES,
+ MAX_STATES_PER_INSN, MARK_READ_MAX_LEN,
+ },
+};
+
static const struct stat_specs default_sort_spec = {
.spec_cnt = 2,
.ids = {
@@ -1561,8 +1570,12 @@ int main(int argc, char **argv)
if (env.verbose && env.log_level == 0)
env.log_level = 1;
- if (env.output_spec.spec_cnt == 0)
- env.output_spec = default_output_spec;
+ if (env.output_spec.spec_cnt == 0) {
+ if (env.out_fmt == RESFMT_CSV)
+ env.output_spec = default_csv_output_spec;
+ else
+ env.output_spec = default_output_spec;
+ }
if (env.sort_spec.spec_cnt == 0)
env.sort_spec = default_sort_spec;