lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH0uvogpQDt-=wP1LYNuyqGfSdPN897WKiP53DqXSQPxGtK2fg@mail.gmail.com>
Date: Fri, 28 Mar 2025 18:48:26 -0700
From: Howard Chu <howardchu95@...il.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>, Ian Rogers <irogers@...gle.com>, 
	Kan Liang <kan.liang@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, 
	Adrian Hunter <adrian.hunter@...el.com>, Peter Zijlstra <peterz@...radead.org>, 
	Ingo Molnar <mingo@...nel.org>, LKML <linux-kernel@...r.kernel.org>, 
	linux-perf-users@...r.kernel.org, Song Liu <song@...nel.org>, bpf@...r.kernel.org
Subject: Re: [PATCH v4 2/2] perf test: Add perf trace summary test

Hello,

On Tue, Mar 25, 2025 at 9:40 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
>   $ sudo ./perf test -vv 'trace summary'
>   109: perf trace summary:
>   --- start ---
>   test child forked, pid 3501572
>   testing: perf trace -s -- true
>   testing: perf trace -S -- true
>   testing: perf trace -s --summary-mode=thread -- true
>   testing: perf trace -S --summary-mode=total -- true
>   testing: perf trace -as --summary-mode=thread --no-bpf-summary -- true
>   testing: perf trace -as --summary-mode=total --no-bpf-summary -- true
>   testing: perf trace -as --summary-mode=thread --bpf-summary -- true
>   testing: perf trace -as --summary-mode=total --bpf-summary -- true
>   testing: perf trace -aS --summary-mode=total --bpf-summary -- true
>   ---- end(0) ----
>   109: perf trace summary                                              : Ok
>
> Cc: Howard Chu <howardchu95@...il.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/tests/shell/trace_summary.sh | 65 +++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
>  create mode 100755 tools/perf/tests/shell/trace_summary.sh
>
> diff --git a/tools/perf/tests/shell/trace_summary.sh b/tools/perf/tests/shell/trace_summary.sh
> new file mode 100755
> index 0000000000000000..4d98cb212dd9de0b
> --- /dev/null
> +++ b/tools/perf/tests/shell/trace_summary.sh
> @@ -0,0 +1,65 @@
> +#!/bin/sh
> +# perf trace summary
> +# SPDX-License-Identifier: GPL-2.0
> +
> +# Check that perf trace works with various summary mode
> +
> +# shellcheck source=lib/probe.sh
> +. "$(dirname $0)"/lib/probe.sh
> +
> +skip_if_no_perf_trace || exit 2
> +[ "$(id -u)" = 0 ] || exit 2
> +
> +OUTPUT=$(mktemp /tmp/perf_trace_test.XXXXX)
> +
> +test_perf_trace() {
> +    args=$1
> +    workload="true"
> +    search="^\s*(open|read|close).*[0-9]+%$"
> +
> +    echo "testing: perf trace ${args} -- ${workload}"
> +    perf trace ${args} -- ${workload} >${OUTPUT} 2>&1
> +    if [ $? -ne 0 ]; then
> +        echo "Error: perf trace ${args} failed unexpectedly"
> +        cat ${OUTPUT}
> +        rm -f ${OUTPUT}
> +        exit 1
> +    fi
> +
> +    count=$(grep -E -c -m 3 "${search}" ${OUTPUT})
> +    if [ "${count}" != "3" ]; then
> +       echo "Error: cannot find enough pattern ${search} in the output"
> +       cat ${OUTPUT}
> +       rm -f ${OUTPUT}
> +       exit 1
> +    fi
> +}
> +
> +# summary only for a process
> +test_perf_trace "-s"
> +
> +# normal output with summary at the end
> +test_perf_trace "-S"
> +
> +# summary only with an explicit summary mode
> +test_perf_trace "-s --summary-mode=thread"
> +
> +# summary with normal output - total summary mode
> +test_perf_trace "-S --summary-mode=total"
> +
> +# summary only for system wide - per-thread summary
> +test_perf_trace "-as --summary-mode=thread --no-bpf-summary"
> +
> +# summary only for system wide - total summary mode
> +test_perf_trace "-as --summary-mode=total --no-bpf-summary"
> +
> +# summary only for system wide - per-thread summary with BPF
> +test_perf_trace "-as --summary-mode=thread --bpf-summary"
> +
> +# summary only for system wide - total summary mode with BPF
> +test_perf_trace "-as --summary-mode=total --bpf-summary"
> +
> +# summary with normal output for system wide - total summary mode with BPF
> +test_perf_trace "-aS --summary-mode=total --bpf-summary"
> +
> +rm -f ${OUTPUT}
> --
> 2.49.0.395.g12beb8f557-goog
>

Didn't quite get the combinatorial logic but it sure covers a lot :)

Reviewed-by: Howard Chu <howardchu95@...il.com>

Thanks,
Howard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ