tracing/selftest: Add test to test hist trigger between kernel event and trace_marker

Add a test that tests a trigger that is initiated by a kernel event
(sched_waking) and compared to a write to the trace_marker.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Steven Rostedt (VMware) 2018-05-14 15:47:07 -04:00
parent c349d4af86
commit a7dfdbef94

View File

@ -0,0 +1,68 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: trace_marker trigger - test histogram with synthetic event against kernel event
# flags:
do_reset() {
reset_trigger
echo > set_event
echo > synthetic_events
clear_trace
}
fail() { #msg
do_reset
echo $1
exit_fail
}
if [ ! -f set_event ]; then
echo "event tracing is not supported"
exit_unsupported
fi
if [ ! -f synthetic_events ]; then
echo "synthetic events not supported"
exit_unsupported
fi
if [ ! -d events/ftrace/print ]; then
echo "event trace_marker is not supported"
exit_unsupported
fi
if [ ! -d events/sched/sched_waking ]; then
echo "event sched_waking is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/trigger ]; then
echo "event trigger is not supported"
exit_unsupported
fi
if [ ! -f events/ftrace/print/hist ]; then
echo "hist trigger is not supported"
exit_unsupported
fi
do_reset
echo "Test histogram kernel event to trace_marker latency histogram trigger"
echo 'latency u64 lat' > synthetic_events
echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger
echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger
echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger
sleep 1
echo "hello" > trace_marker
grep 'hitcount: *1$' events/ftrace/print/hist > /dev/null || \
fail "hist trigger did not trigger correct times on trace_marker"
grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \
fail "hist trigger did not trigger "
do_reset
exit 0