1#!/bin/sh 2# description: event trigger - test inter-event histogram trigger onmatch action 3 4fail() { #msg 5 echo $1 6 exit_fail 7} 8 9if [ ! -f set_event ]; then 10 echo "event tracing is not supported" 11 exit_unsupported 12fi 13 14if [ ! -f synthetic_events ]; then 15 echo "synthetic event is not supported" 16 exit_unsupported 17fi 18 19echo "Test create synthetic event" 20 21echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events 22if [ ! -d events/synthetic/wakeup_latency ]; then 23 fail "Failed to create wakeup_latency synthetic event" 24fi 25 26echo "Test create histogram for synthetic event" 27echo "Test histogram variables,simple expression support and onmatch action" 28 29echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger 30echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger 31echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger 32 33ping $LOCALHOST -c 5 34if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then 35 fail "Failed to create onmatch action inter-event histogram" 36fi 37 38exit 0 39