On Mon, May 30, 2022 at 1:27 PM Dave Marchevsky <davemarchevsky@xxxxxx> wrote: > > The report_progress and report_final functions in bench.c do similar > calculation of mean and stddev, but each of these rewrites the entire > calculation. Add helpers which calculate mean and stddev for simple > fields of struct bench_res, or in the case of total_ops, sum of two > fields, and move all extant calculations of mean and stddev to use > the helpers. > > Also add some macros for unit conversion constants to improve > readability. > > Signed-off-by: Dave Marchevsky <davemarchevsky@xxxxxx> > --- > tools/testing/selftests/bpf/bench.c | 156 +++++++++++++++++----------- > 1 file changed, 95 insertions(+), 61 deletions(-) > please drop this patch, it doesn't look like an improvement > diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c > index 32399554f89b..0383bcd0e009 100644 > --- a/tools/testing/selftests/bpf/bench.c > +++ b/tools/testing/selftests/bpf/bench.c > @@ -28,6 +28,62 @@ static int libbpf_print_fn(enum libbpf_print_level level, > return vfprintf(stderr, format, args); > } > [...]