From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
James Clark <james.clark@linaro.org>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Clark Williams <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH v1 02/17] perf tests sched: Exercise the sched views and options
Date: Tue, 24 Nov 2026 15:45:49 -0300 [thread overview]
Message-ID: <20261124184604.24983-3-acme@kernel.org> (raw)
In-Reply-To: <20261124184604.24983-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The test pipes the map, latency and timehist output to grep, which
stops reading at the first match, so the command is killed by
SIGPIPE before it produces the rest of its output. It also passes
--no-inherit, a no-op since perf sched record always records CPU
wide and inherit is cleared for CPU wide targets.
Capture the output first, drop --no-inherit and add the map,
latency and timehist options along with schedstat record, report and
diff coverage.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/shell/sched.sh | 154 +++++++++++++++++++++++---------
1 file changed, 111 insertions(+), 43 deletions(-)
diff --git a/tools/perf/tests/shell/sched.sh b/tools/perf/tests/shell/sched.sh
index 113df962a51c878f..e1aa8570b21f4ad9 100755
--- a/tools/perf/tests/shell/sched.sh
+++ b/tools/perf/tests/shell/sched.sh
@@ -11,12 +11,17 @@ fi
err=0
perfdata=$(mktemp /tmp/__perf_test_sched.perf.data.XXXXX)
+statsdata=$(mktemp /tmp/__perf_test_sched.stats.XXXXX)
+schedout=$(mktemp /tmp/__perf_test_sched.out.XXXXX)
PID1=0
PID2=0
cleanup() {
rm -f "${perfdata}"
rm -f "${perfdata}".old
+ rm -f "${statsdata}"
+ rm -f "${statsdata}".old
+ rm -f "${schedout}"
trap - EXIT TERM INT
}
@@ -56,90 +61,153 @@ cleanup_noploops() {
kill "$PID1" "$PID2" || true
}
+run_sched() {
+ local desc="$1" expect="$2"
+
+ shift 2
+ echo "Sched ${desc}"
+ if ! perf sched "$@" > "${schedout}" 2>&1
+ then
+ echo "Sched ${desc} [Failed: perf sched failed]"
+ cat "${schedout}"
+ err=1
+ return
+ fi
+ if [ -n "${expect}" ] && ! grep -q "${expect}" "${schedout}"
+ then
+ echo "Sched ${desc} [Failed: missing '${expect}']"
+ cat "${schedout}"
+ err=1
+ return
+ fi
+ echo "Sched ${desc} [Success]"
+}
+
test_sched_record() {
echo "Sched record"
start_noploops
- perf sched record --no-inherit -o "${perfdata}" sleep 1
+ if ! perf sched record -o "${perfdata}" sleep 1
+ then
+ echo "Sched record [Failed: perf sched record failed]"
+ err=1
+ fi
cleanup_noploops
}
test_sched_latency() {
- echo "Sched latency"
-
- if ! perf sched latency -i "${perfdata}" | grep -q perf-noploop
- then
- echo "Sched latency [Failed missing output]"
- err=1
- fi
+ run_sched "latency" "perf-noploop" latency -i "${perfdata}"
}
test_sched_latency_histogram() {
- echo "Sched latency histogram"
+ run_sched "latency histogram" "Latency Distribution Histogram" \
+ latency -H -i "${perfdata}"
+ run_sched "latency linear histogram" "Latency Distribution Histogram" \
+ latency --histogram --hist-mode linear -i "${perfdata}"
+}
- if ! perf sched latency -H -i "${perfdata}" | grep -q "Latency Distribution Histogram"
- then
- echo "Sched latency histogram [Failed missing log histogram]"
- err=1
- fi
+test_sched_latency_options() {
+ run_sched "latency sort" "perf-noploop" latency -s max -i "${perfdata}"
+ run_sched "latency per pid" "perf-noploop" latency -p -i "${perfdata}"
+ run_sched "latency cpu filter" "" latency -C 0 -i "${perfdata}"
+ run_sched "latency time filter" "perf-noploop" latency --time 0, -i "${perfdata}"
+}
- if ! perf sched latency --histogram --hist-mode linear -i "${perfdata}" | grep -q "Latency Distribution Histogram"
- then
- echo "Sched latency histogram [Failed missing linear histogram]"
- err=1
- fi
+test_sched_script() {
+ run_sched "script" "perf-noploop" script -i "${perfdata}"
}
-test_sched_latency_time() {
- echo "Sched latency time filter"
+test_sched_map() {
+ run_sched "map" "perf-noploop" map -i "${perfdata}"
+}
- if ! perf sched latency --time 0, -i "${perfdata}" | grep -q perf-noploop
- then
- echo "Sched latency time filter [Failed missing output]"
- err=1
- fi
+test_sched_map_options() {
+ run_sched "map compact" "" map --compact -i "${perfdata}"
+ run_sched "map color" "" map --color-pids "${PID1}" --color-cpus 0 \
+ --cpus 0 -i "${perfdata}"
+ run_sched "map task name" "" map --task-name perf-noploop -i "${perfdata}"
+ run_sched "map fuzzy name" "" map --task-name noploop --fuzzy-name \
+ -i "${perfdata}"
}
-test_sched_script() {
- echo "Sched script"
+test_sched_timehist() {
+ run_sched "timehist" "perf-noploop" timehist -i "${perfdata}"
+}
+
+test_sched_timehist_options() {
+ run_sched "timehist summary" "Runtime summary" timehist --summary -i "${perfdata}"
+ run_sched "timehist wakeups" "awakened:" timehist -w -i "${perfdata}"
+ run_sched "timehist migrations" "migrated:" timehist -M -i "${perfdata}"
+ run_sched "timehist idle" "Idle-time summary" timehist -I --summary -i "${perfdata}"
+ run_sched "timehist state" "sch delay" \
+ timehist --state --show-prio -V -P -i "${perfdata}"
+ run_sched "timehist call graph" "" timehist -g --max-stack 3 -i "${perfdata}"
+ run_sched "timehist pid filter" "" timehist -p "${PID1}" -i "${perfdata}"
+ run_sched "timehist prio filter" "" timehist --show-prio --prio 0 -i "${perfdata}"
+ run_sched "timehist with summary" "perf-noploop" timehist -S -i "${perfdata}"
+}
+
+test_sched_stats_live() {
+ echo "Sched stats live"
- if ! perf sched script -i "${perfdata}" | grep -q perf-noploop
+ ret=0
+ timeout -s INT -k 5 3 perf sched stats > "${schedout}" 2>&1 || ret=$?
+ if [ "${ret}" != 0 ] && [ "${ret}" != 124 ]
then
- echo "Sched script [Failed missing output]"
+ echo "Sched stats live [Failed: perf sched stats failed]"
+ cat "${schedout}"
err=1
+ return
fi
-}
-test_sched_map() {
- echo "Sched map"
-
- if ! perf sched map -i "${perfdata}" | grep -q perf-noploop
+ if ! grep -q "Description" "${schedout}"
then
- echo "Sched map [Failed missing output]"
+ echo "Sched stats live [Failed missing output]"
err=1
+ return
fi
+ echo "Sched stats live [Success]"
}
-test_sched_timehist() {
- echo "Sched timehist"
-
- if ! perf sched timehist -i "${perfdata}" | grep -q perf-noploop
+test_sched_stats_record() {
+ if ! perf sched stats record -o "${statsdata}" sleep 1
+ then
+ echo "Sched stats record [Failed: perf sched stats record failed]"
+ err=1
+ return
+ fi
+ if [ ! -s "${statsdata}" ]
then
- echo "Sched timehist [Failed missing output]"
+ echo "Sched stats record [Failed: no data file]"
err=1
+ return
fi
+ echo "Sched stats record [Success]"
+}
+
+test_sched_stats_report() {
+ run_sched "stats report" "Description" stats report -i "${statsdata}" -C 0 -v
+}
+
+test_sched_stats_diff() {
+ run_sched "stats diff" "" stats diff "${statsdata}" "${statsdata}"
}
test_sched_record
test_sched_latency
test_sched_latency_histogram
-test_sched_latency_time
+test_sched_latency_options
test_sched_script
test_sched_map
+test_sched_map_options
test_sched_timehist
+test_sched_timehist_options
+test_sched_stats_live
+test_sched_stats_record
+test_sched_stats_report
+test_sched_stats_diff
cleanup
exit $err
-
--
2.56.0
next prev parent reply other threads:[~2026-11-24 18:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 18:45 [PATCH v1 00/17] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 01/17] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-11-24 18:45 ` Arnaldo Carvalho de Melo [this message]
2026-11-24 18:45 ` [PATCH v1 03/17] perf tests help: Add a basic perf help test Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 04/17] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 05/17] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 06/17] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 07/17] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 08/17] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 09/17] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 10/17] perf tests record: Exercise more record options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 11/17] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-11-24 18:45 ` [PATCH v1 12/17] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 13/17] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 14/17] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 15/17] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 16/17] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-11-24 18:46 ` [PATCH v1 17/17] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
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=20261124184604.24983-3-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/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