1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: trace_marker trigger - test histogram with synthetic event against kernel event 4# flags: 5 6do_reset() { 7 reset_trigger 8 echo > set_event 9 echo > synthetic_events 10 clear_trace 11} 12 13fail() { #msg 14 do_reset 15 echo $1 16 exit_fail 17} 18 19if [ ! -f set_event ]; then 20 echo "event tracing is not supported" 21 exit_unsupported 22fi 23 24if [ ! -f synthetic_events ]; then 25 echo "synthetic events not supported" 26 exit_unsupported 27fi 28 29if [ ! -d events/ftrace/print ]; then 30 echo "event trace_marker is not supported" 31 exit_unsupported 32fi 33 34if [ ! -d events/sched/sched_waking ]; then 35 echo "event sched_waking is not supported" 36 exit_unsupported 37fi 38 39if [ ! -f events/ftrace/print/trigger ]; then 40 echo "event trigger is not supported" 41 exit_unsupported 42fi 43 44if [ ! -f events/ftrace/print/hist ]; then 45 echo "hist trigger is not supported" 46 exit_unsupported 47fi 48 49do_reset 50 51echo "Test histogram kernel event to trace_marker latency histogram trigger" 52 53echo 'latency u64 lat' > synthetic_events 54echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger 55echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger 56echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger 57sleep 1 58echo "hello" > trace_marker 59 60grep 'hitcount: *1$' events/ftrace/print/hist > /dev/null || \ 61 fail "hist trigger did not trigger correct times on trace_marker" 62 63grep 'hitcount: *1$' events/synthetic/latency/hist > /dev/null || \ 64 fail "hist trigger did not trigger " 65 66do_reset 67 68exit 0 69