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