perf tests record: Cleanup improvements

Remove the script output file. Add a trap debug message. Minor style
consistency changes.

Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250410173631.1713627-2-irogers@google.com
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Levi Yun <yeoreum.yun@arm.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Tengda Wu <wutengda@huaweicloud.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Weilin Wang <weilin.wang@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Hao Ge <gehao@kylinos.cn>
Cc: James Clark <james.clark@linaro.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Xu Yang <xu.yang_2@nxp.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-perf-users@vger.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers 2025-04-10 10:36:20 -07:00 committed by Arnaldo Carvalho de Melo
parent ccd4b5cdf0
commit be8aefad33

View File

@ -34,13 +34,15 @@ default_fd_limit=$(ulimit -Sn)
min_fd_limit=$(($(getconf _NPROCESSORS_ONLN) * 16))
cleanup() {
rm -rf "${perfdata}"
rm -rf "${perfdata}".old
rm -f "${perfdata}"
rm -f "${perfdata}".old
rm -f "${script_output}"
trap - EXIT TERM INT
}
trap_cleanup() {
echo "Unexpected signal in ${FUNCNAME[1]}"
cleanup
exit 1
}
@ -239,7 +241,7 @@ test_leader_sampling() {
return
fi
index=0
perf script -i "${perfdata}" > $script_output
perf script -i "${perfdata}" > "${script_output}"
while IFS= read -r line
do
# Check if the two instruction counts are equal in each record
@ -252,7 +254,7 @@ test_leader_sampling() {
fi
index=$(($index+1))
prev_cycles=$cycles
done < $script_output
done < "${script_output}"
echo "Basic leader sampling test [Success]"
}