trigger-field-variable-support.tc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. # description: event trigger - test field variable support
  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 field variable support"
  25. echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events
  26. echo 'hist:keys=comm:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger
  27. echo 'hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger
  28. echo 'hist:keys=pid,prio,comm:vals=lat:sort=pid,prio' > events/synthetic/wakeup_latency/trigger
  29. ping localhost -c 3
  30. if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
  31. fail "Failed to create inter-event histogram"
  32. fi
  33. if ! grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
  34. fail "Failed to create histogram with field variable"
  35. fi
  36. echo '!hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger
  37. if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
  38. fail "Failed to remove histogram with field variable"
  39. fi
  40. do_reset
  41. exit 0