0001
0002
0003
0004
0005
0006 fail() {
0007 echo $1
0008 exit_fail
0009 }
0010
0011 echo "Test create synthetic event"
0012
0013 echo 'wakeup_latency u64 lat pid_t pid char comm[16]' > synthetic_events
0014 if [ ! -d events/synthetic/wakeup_latency ]; then
0015 fail "Failed to create wakeup_latency synthetic event"
0016 fi
0017
0018 echo "Test create histogram for synthetic event"
0019 echo "Test histogram variables,simple expression support and onmatch-onmax action"
0020
0021 echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger
0022 echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_wakeup).wakeup_latency($wakeup_lat,next_pid,next_comm):onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
0023 echo 'hist:keys=comm,pid,lat:wakeup_lat=lat:sort=lat' > events/synthetic/wakeup_latency/trigger
0024
0025 ping $LOCALHOST -c 5
0026 if [ ! grep -q "ping" events/synthetic/wakeup_latency/hist -o ! grep -q "max:" events/sched/sched_switch/hist]; then
0027 fail "Failed to create onmatch-onmax action inter-event histogram"
0028 fi
0029
0030 exit 0