[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a6ba0ea8-f070-9f79-f018-f638ff677c7c@arm.com>
Date: Tue, 15 Mar 2022 14:32:56 +0000
From: German Gomez <german.gomez@....com>
To: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org
Cc: Jiri Olsa <jolsa@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
James Clark <james.clark@....com>, acme@...nel.org
Subject: Re: [PATCH] perf test arm64: Test unwinding using fame-pointer (fp)
mode
On 01/03/2022 13:34, German Gomez wrote:
> Add a shell script to check that the call-graphs generated using frame
> pointers (--call-graph fp) are complete and not missing leaf functions:
>
> [...]
>
> +cat << EOF > $TEST_PROGRAM_SOURCE
> +int a = 0;
> +void leaf(void) {
> + for (;;)
> + a += a;
> +}
> +void parent(void) {
> + leaf();
> +}
> +int main(void) {
> + parent();
> + return 0;
> +}
> +EOF
> +
> +echo " + Compiling test program ($TEST_PROGRAM)..."
> +CFLAGS="-O0 -fno-inline -fno-omit-frame-pointer"
This fails when the test program is compiled with gcc-7, due to missing -g flag.
I will re-spin with this fixed.
> +cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1
> +
> +# Add a 1 second delay to skip samples that are not in the leaf() function
> +perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 -- $TEST_PROGRAM 2> /dev/null &
> +PID=$!
> +echo " + Recording (PID=$PID)..."
> +sleep 2
> +echo " + Stopping perf-record..."
> +kill $PID
> +wait $PID
> +
> +# example perf-script output:
> +#
> +# program
> +# 728 leaf
> +# 753 parent
> +# 76c main
> +# ...
> +
> +perf script -i $PERF_DATA -F comm,ip,sym | head -n4
> +perf script -i $PERF_DATA -F comm,ip,sym | head -n4 |
> + awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" ||
> + sym[1] != "parent" ||
> + sym[2] != "main") exit 1 }'
Powered by blists - more mailing lists