[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7ciTRRA8haOM4K_EKj019VuD-+fwxnDdokqYD9W=gHwkdg@mail.gmail.com>
Date: Mon, 19 Jul 2021 12:28:40 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>
Subject: Re: [PATCH 5/5] perf tools: Add pipe_test.sh to verify pipe operations
Hi Jiri,
On Sun, Jul 18, 2021 at 2:38 PM Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Tue, Jul 13, 2021 at 05:34:42PM -0700, Namhyung Kim wrote:
>
> SNIP
>
> > diff --git a/tools/perf/tests/shell/pipe_test.sh b/tools/perf/tests/shell/pipe_test.sh
> > new file mode 100755
> > index 000000000000..b6a89c6896c3
> > --- /dev/null
> > +++ b/tools/perf/tests/shell/pipe_test.sh
> > @@ -0,0 +1,69 @@
> > +#!/bin/sh
> > +# perf pipe recording and injection test
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +# skip if there's no compiler
> > +if ! [ -x "$(command -v cc)" ]; then
> > + echo "failed: no compiler, install gcc"
> > + exit 2
> > +fi
> > +
> > +file=$(mktemp /tmp/test.file.XXXXXX)
> > +data=$(mktemp /tmp/perf.data.XXXXXX)
> > +
> > +cat <<EOF | cc -o ${file} -x c -
> > +#include <signal.h>
> > +#include <stdlib.h>
> > +#include <unistd.h>
> > +
> > +volatile int done;
> > +
> > +void sigalrm(int sig) {
> > + done = 1;
> > +}
> > +
> > +__attribute__((noinline)) void noploop(void) {
> > + while (!done)
> > + continue;
> > +}
> > +
> > +int main(int argc, char *argv[]) {
> > + int sec = 1;
> > +
> > + if (argc > 1)
> > + sec = atoi(argv[1]);
> > +
> > + signal(SIGALRM, sigalrm);
> > + alarm(sec);
> > +
> > + noploop();
> > + return 0;
> > +}
> > +EOF
> > +
> > +
> > +if ! perf record -e cycles:u -o - ${file} | perf report -i - --task | grep test.file; then
>
> hi
> cycles:u will fail in virtual machine, could you use
> cpu-clock instead or skip the test?
You're right! I'll update to use task-clock.
Thanks,
Namhyung
Powered by blists - more mailing lists