Re: [PATCH bpf-next 1/3] selftests/bpf: add CSV output mode for veristat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 20, 2022 at 9:23 AM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote:
>
> Tue Sep 20 2022 05:07:34 GMT+0100 (British Summer Time) ~ Andrii
> Nakryiko <andrii@xxxxxxxxxx>
> > Teach veristat to output results as CSV table for easier programmatic
> > processing. Change what was --output/-o argument to now be --emit/-e.
> > And then use --output-format/-o <fmt> to specify output format.
> > Currently "table" and "csv" is supported, table being default.
> >
> > For CSV output mode veristat is using spec identifiers as column names.
> > E.g., instead of "Total states" veristat uses "total_states" as a CSV
> > header name.
> >
> > Internally veristat recognizes three formats, one of them
> > (RESFMT_TABLE_CALCLEN) is a special format instructing veristat to
> > calculate column widths for table output. This felt a bit cleaner and
> > more uniform than either creating separate functions just for this.
> >
> > Also fix double-free of bpf_object in process_prog, which didn't feel
> > important enough to have a separate patch for.
> >
> > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> > ---
> >  tools/testing/selftests/bpf/veristat.c | 114 ++++++++++++++++---------
> >  1 file changed, 76 insertions(+), 38 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/veristat.c b/tools/testing/selftests/bpf/veristat.c
> > index 39e6dc41e504..317f7736dd59 100644
> > --- a/tools/testing/selftests/bpf/veristat.c
> > +++ b/tools/testing/selftests/bpf/veristat.c
> > @@ -46,10 +46,17 @@ struct stat_specs {
> >       int lens[ALL_STATS_CNT];
> >  };
> >
> > +enum resfmt {
> > +     RESFMT_TABLE,
> > +     RESFMT_TABLE_CALCLEN, /* fake format to pre-calculate table's column widths */
> > +     RESFMT_CSV,
> > +};
> > +
> >  static struct env {
> >       char **filenames;
> >       int filename_cnt;
> >       bool verbose;
> > +     enum resfmt out_fmt;
> >
> >       struct verif_stats *prog_stats;
> >       int prog_stat_cnt;
> > @@ -77,9 +84,10 @@ const char argp_program_doc[] =
> >
> >  static const struct argp_option opts[] = {
> >       { NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
> > -     { "verbose", 'v', NULL, 0, "Verbose mode" },
> > -     { "output", 'o', "SPEC", 0, "Specify output stats" },
> > +     { "vereose", 'v', NULL, 0, "Verbose mode" },
>
> "vereose" -> looks like this line was changed by mistake

yep, fat-fingered, will fix

>



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux