trigger-onmatch-onmax-action-hist.tc 1.5 KB

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