Re: [PATCH 3/6] perf test: Test record with --threads option

From: Adrian Hunter
Date: Wed Sep 07 2022 - 09:33:56 EST


On 7/09/22 09:46, Namhyung Kim wrote:
> To verify per-thread mode is working with multi-thread recording.
> Use two software events for testing to check event set-output handling.
> Also update the cleanup routine because threads recording produces data
> in a directory.
>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/tests/shell/record.sh | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
> index cea3c7b7e2cd..3331fb092654 100755
> --- a/tools/perf/tests/shell/record.sh
> +++ b/tools/perf/tests/shell/record.sh
> @@ -11,8 +11,8 @@ testsym="test_loop"
> testopt="-D 3"
>
> cleanup() {
> - rm -f ${perfdata}
> - rm -f ${perfdata}.old
> + rm -rf ${perfdata}
> + rm -rf ${perfdata}.old
>
> if [ "${testprog}" != "true" ]; then
> rm -f ${testprog}
> @@ -90,6 +90,19 @@ test_per_thread() {
> err=1
> return
> fi
> + if ! perf record -e cpu-clock,cs --per-thread --threads=core ${testopt} \
> + -o ${perfdata} ${testprog} 2> /dev/null

This does not seem to be possible, because it gives the error:

--per-thread option is mutually exclusive to parallel streaming mode.
Failed to initialize parallel data streaming masks

> + then
> + echo "Per-thread record with --threads [Failed]"
> + err=1
> + return
> + fi
> + if ! perf report -i ${perfdata} -q | egrep -q ${testsym}
> + then
> + echo "Per-thread record with --threads [Failed missing output]"
> + err=1
> + return
> + fi
> echo "Basic --per-thread mode test [Success]"
> }
>