Messages in this thread | | | From | Dmitry Vyukov <> | Date | Thu, 12 May 2022 10:03:01 +0200 | Subject | Re: [PATCH] tools/perf: add breakpoint benchmarks |
| |
On Wed, 11 May 2022 at 20:17, Arnaldo Carvalho de Melo <acme@kernel.org> wrote: > > > > > > Acked-by: Ian Rogers <irogers@google.com> > > > > Thanks, applied. > > But I'll add some error checks, etc, running as !root, in a toolbox in > Fedora Silverblue produces:
Thanks!
> ⬢[acme@toolbox perf]$ perf bench breakpoint all > # Running breakpoint/thread benchmark... > # Created/joined 10 threads with 1 breakpoints and 1 parallelism > Total time: 0.000 [sec] > > 54.600000 usecs/op > 54.600000 usecs/op/cpu > > # Running breakpoint/enable benchmark... > # Enabled/disabled breakpoint 10 time with 0 passive and 0 active threads > Total time: 0.000 [sec] > > 1.100000 usecs/op > > ⬢[acme@toolbox perf]$ > > ⬢[acme@toolbox perf]$ perf bench --repeat=20000 breakpoint enable --passive=224 --active=0 > # Running 'breakpoint/enable' benchmark: > # Enabled/disabled breakpoint 20000 time with 224 passive and 0 active threads > Total time: 8.933 [sec] > > 446.674950 usecs/op > ⬢[acme@toolbox perf]$ > > $ grep -m1 "model name" /proc/cpuinfo > model name : AMD Ryzen 9 5950X 16-Core Processor > > Diff: > > diff --git a/tools/perf/bench/breakpoint.c b/tools/perf/bench/breakpoint.c > index 56936fea246d73c2..d2c074bba06a3d1f 100644 > --- a/tools/perf/bench/breakpoint.c > +++ b/tools/perf/bench/breakpoint.c > @@ -83,6 +83,9 @@ static void *breakpoint_thread(void *arg) > pthread_t *threads; > > threads = calloc(thread_params.nthreads, sizeof(threads[0])); > + if (!threads) > + exit((perror("calloc"), EXIT_FAILURE)); > + > while (__atomic_fetch_sub(repeat, 1, __ATOMIC_RELAXED) > 0) { > done = 0; > for (i = 0; i < thread_params.nthreads; i++) { > @@ -114,6 +117,9 @@ int bench_breakpoint_thread(int argc, const char **argv) > } > breakpoints = calloc(thread_params.nbreakpoints, sizeof(breakpoints[0])); > parallel = calloc(thread_params.nparallel, sizeof(parallel[0])); > + if (!breakpoints || !parallel) > + exit((perror("calloc"), EXIT_FAILURE)); > + > for (i = 0; i < thread_params.nbreakpoints; i++) { > breakpoints[i].fd = breakpoint_setup(&breakpoints[i].watched); > if (breakpoints[i].fd == -1) > @@ -194,6 +200,9 @@ int bench_breakpoint_enable(int argc, const char **argv) > exit((perror("perf_event_open"), EXIT_FAILURE)); > nthreads = enable_params.npassive + enable_params.nactive; > threads = calloc(nthreads, sizeof(threads[0])); > + if (!threads) > + exit((perror("calloc"), EXIT_FAILURE)); > + > for (i = 0; i < nthreads; i++) { > if (pthread_create(&threads[i], NULL, > i < enable_params.npassive ? passive_thread : active_thread, &done))
| |