From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 4/4] perf test: Add trace record and replay test
Date: Fri, 28 Feb 2025 20:02:52 -0800 [thread overview]
Message-ID: <20250301040252.1586750-5-namhyung@kernel.org> (raw)
In-Reply-To: <20250301040252.1586750-1-namhyung@kernel.org>
It just check trace record and replay could display correct output.
It uses 'sleep' process and sees there's a clock_nanosleep syscall.
$ sudo perf test -vv replay
108: perf trace record and replay:
--- start ---
test child forked, pid 1563219
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.077 MB /tmp/temporary_file.w1ApA (242 samples) ]
0.686 (1000.068 ms): sleep/1563226 clock_nanosleep(rqtp: 0x7ffc20ffee10, rmtp: 0x7ffc20ffee50) = 0
---- end(0) ----
108: perf trace record and replay : Ok
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/tests/shell/trace_record_replay.sh | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100755 tools/perf/tests/shell/trace_record_replay.sh
diff --git a/tools/perf/tests/shell/trace_record_replay.sh b/tools/perf/tests/shell/trace_record_replay.sh
new file mode 100755
index 0000000000000000..f948a84072b7a9b1
--- /dev/null
+++ b/tools/perf/tests/shell/trace_record_replay.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+# perf trace record and replay
+# SPDX-License-Identifier: GPL-2.0
+
+# Check that perf trace works with record and replay
+
+# shellcheck source=lib/probe.sh
+. "$(dirname $0)"/lib/probe.sh
+
+skip_if_no_perf_trace || exit 2
+[ "$(id -u)" == 0 ] || exit 2
+
+file=$(mktemp /tmp/temporary_file.XXXXX)
+
+perf trace record -o ${file} sleep 1 || exit 1
+if ! perf trace -i ${file} 2>&1 | grep nanosleep; then
+ echo "Failed: cannot find *nanosleep syscall"
+ exit 1
+fi
+
+rm -f ${file}
--
2.48.1.711.g2feabab25a-goog
prev parent reply other threads:[~2025-03-01 4:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-01 4:02 [PATCH 0/4] perf test: Assorted fixes and updates Namhyung Kim
2025-03-01 4:02 ` [PATCH 1/4] perf test: Add --metric-only to perf stat output tests Namhyung Kim
2025-03-01 4:02 ` [PATCH 2/4] perf test: Skip perf probe tests when running as non-root Namhyung Kim
2025-03-05 17:45 ` Arnaldo Carvalho de Melo
2025-03-05 17:52 ` Namhyung Kim
2025-03-01 4:02 ` [PATCH 3/4] perf test: Skip perf trace " Namhyung Kim
2025-03-05 17:46 ` Arnaldo Carvalho de Melo
2025-03-01 4:02 ` Namhyung Kim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250301040252.1586750-5-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).