1#!/bin/sh 2# description: event trigger - test inter-event combined histogram trigger 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 'waking_latency u64 lat pid_t pid' > synthetic_events 22if [ ! -d events/synthetic/waking_latency ]; then 23 fail "Failed to create waking_latency synthetic event" 24fi 25 26echo "Test combined histogram" 27 28echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger 29echo 'hist:keys=pid:waking_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).waking_latency($waking_lat,pid) if comm=="ping"' > events/sched/sched_wakeup/trigger 30echo 'hist:keys=pid,lat:sort=pid,lat' > events/synthetic/waking_latency/trigger 31 32echo 'wakeup_latency u64 lat pid_t pid' >> synthetic_events 33echo 'hist:keys=pid:ts1=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_wakeup/trigger 34echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts1:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid) if next_comm=="ping"' > events/sched/sched_switch/trigger 35 36echo 'waking+wakeup_latency u64 lat; pid_t pid' >> synthetic_events 37echo 'hist:keys=pid,lat:sort=pid,lat:ww_lat=$waking_lat+$wakeup_lat:onmatch(synthetic.wakeup_latency).waking+wakeup_latency($ww_lat,pid)' >> events/synthetic/wakeup_latency/trigger 38echo 'hist:keys=pid,lat:sort=pid,lat' >> events/synthetic/waking+wakeup_latency/trigger 39 40ping $LOCALHOST -c 3 41if ! grep -q "pid:" events/synthetic/waking+wakeup_latency/hist; then 42 fail "Failed to create combined histogram" 43fi 44 45exit 0 46