trigger-onmax-action-hist.tc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. # description: event trigger - test inter-event histogram trigger 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 onmax action"
  30. echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="ping"' >> events/sched/sched_waking/trigger
  31. echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_comm,prev_pid,prev_prio,prev_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
  32. ping localhost -c 3
  33. if ! grep -q "max:" events/sched/sched_switch/hist; then
  34. fail "Failed to create onmax action inter-event histogram"
  35. fi
  36. do_reset
  37. exit 0