* [PATCH v1] perf test: Avoid system wide when not privileged
@ 2023-09-30 6:02 Ian Rogers
2023-10-03 4:46 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2023-09-30 6:02 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel
Switch the test program to sleep that makes more sense for system wide
events. Only enable system wide when root or not paranoid. This avoids
failures under some testing conditions like ARM cloud.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/stat_all_metricgroups.sh | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
index cb35e488809a..f3e305649e2c 100755
--- a/tools/perf/tests/shell/stat_all_metricgroups.sh
+++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
@@ -4,9 +4,21 @@
set -e
-for m in $(perf list --raw-dump metricgroups); do
+function ParanoidAndNotRoot()
+{
+ [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
+}
+
+system_wide_flag="-a"
+if ParanoidAndNotRoot 0
+then
+ system_wide_flag=""
+fi
+
+for m in $(perf list --raw-dump metricgroups)
+do
echo "Testing $m"
- perf stat -M "$m" -a true
+ perf stat -M "$m" $system_wide_flag sleep 0.01
done
exit 0
--
2.42.0.582.g8ccd20d70d-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] perf test: Avoid system wide when not privileged
2023-09-30 6:02 [PATCH v1] perf test: Avoid system wide when not privileged Ian Rogers
@ 2023-10-03 4:46 ` Namhyung Kim
2023-10-03 5:09 ` Ian Rogers
0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2023-10-03 4:46 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
linux-perf-users, linux-kernel
Hi Ian,
On Fri, Sep 29, 2023 at 11:02 PM Ian Rogers <irogers@google.com> wrote:
>
> Switch the test program to sleep that makes more sense for system wide
> events. Only enable system wide when root or not paranoid. This avoids
> failures under some testing conditions like ARM cloud.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
While I'm ok with the change, I wonder why it doesn't have the same
code structure as in the stat_all_metrics.sh which checks the actual result.
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/perf/tests/shell/stat_all_metricgroups.sh | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
> index cb35e488809a..f3e305649e2c 100755
> --- a/tools/perf/tests/shell/stat_all_metricgroups.sh
> +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
> @@ -4,9 +4,21 @@
>
> set -e
>
> -for m in $(perf list --raw-dump metricgroups); do
> +function ParanoidAndNotRoot()
> +{
> + [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
> +}
> +
> +system_wide_flag="-a"
> +if ParanoidAndNotRoot 0
> +then
> + system_wide_flag=""
> +fi
> +
> +for m in $(perf list --raw-dump metricgroups)
> +do
> echo "Testing $m"
> - perf stat -M "$m" -a true
> + perf stat -M "$m" $system_wide_flag sleep 0.01
> done
>
> exit 0
> --
> 2.42.0.582.g8ccd20d70d-goog
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] perf test: Avoid system wide when not privileged
2023-10-03 4:46 ` Namhyung Kim
@ 2023-10-03 5:09 ` Ian Rogers
2023-10-09 5:24 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2023-10-03 5:09 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
linux-perf-users, linux-kernel
On Mon, Oct 2, 2023 at 9:47 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> Hi Ian,
>
> On Fri, Sep 29, 2023 at 11:02 PM Ian Rogers <irogers@google.com> wrote:
> >
> > Switch the test program to sleep that makes more sense for system wide
> > events. Only enable system wide when root or not paranoid. This avoids
> > failures under some testing conditions like ARM cloud.
> >
> > Signed-off-by: Ian Rogers <irogers@google.com>
>
> While I'm ok with the change, I wonder why it doesn't have the same
> code structure as in the stat_all_metrics.sh which checks the actual result.
>
> Acked-by: Namhyung Kim <namhyung@kernel.org>
The metric group isn't printed when we print the metrics within it.
This could be changed.
Thanks,
Ian
> Thanks,
> Namhyung
>
> > ---
> > tools/perf/tests/shell/stat_all_metricgroups.sh | 16 ++++++++++++++--
> > 1 file changed, 14 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/tests/shell/stat_all_metricgroups.sh b/tools/perf/tests/shell/stat_all_metricgroups.sh
> > index cb35e488809a..f3e305649e2c 100755
> > --- a/tools/perf/tests/shell/stat_all_metricgroups.sh
> > +++ b/tools/perf/tests/shell/stat_all_metricgroups.sh
> > @@ -4,9 +4,21 @@
> >
> > set -e
> >
> > -for m in $(perf list --raw-dump metricgroups); do
> > +function ParanoidAndNotRoot()
> > +{
> > + [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
> > +}
> > +
> > +system_wide_flag="-a"
> > +if ParanoidAndNotRoot 0
> > +then
> > + system_wide_flag=""
> > +fi
> > +
> > +for m in $(perf list --raw-dump metricgroups)
> > +do
> > echo "Testing $m"
> > - perf stat -M "$m" -a true
> > + perf stat -M "$m" $system_wide_flag sleep 0.01
> > done
> >
> > exit 0
> > --
> > 2.42.0.582.g8ccd20d70d-goog
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] perf test: Avoid system wide when not privileged
2023-10-03 5:09 ` Ian Rogers
@ 2023-10-09 5:24 ` Namhyung Kim
0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2023-10-09 5:24 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
linux-perf-users, linux-kernel
On Mon, Oct 2, 2023 at 10:10 PM Ian Rogers <irogers@google.com> wrote:
>
> On Mon, Oct 2, 2023 at 9:47 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > Hi Ian,
> >
> > On Fri, Sep 29, 2023 at 11:02 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > Switch the test program to sleep that makes more sense for system wide
> > > events. Only enable system wide when root or not paranoid. This avoids
> > > failures under some testing conditions like ARM cloud.
> > >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> >
> > While I'm ok with the change, I wonder why it doesn't have the same
> > code structure as in the stat_all_metrics.sh which checks the actual result.
> >
> > Acked-by: Namhyung Kim <namhyung@kernel.org>
>
> The metric group isn't printed when we print the metrics within it.
> This could be changed.
Ok, we can change it later. Applied to perf-tools-next, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-09 5:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-30 6:02 [PATCH v1] perf test: Avoid system wide when not privileged Ian Rogers
2023-10-03 4:46 ` Namhyung Kim
2023-10-03 5:09 ` Ian Rogers
2023-10-09 5:24 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®