• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# description: event trigger - test field variable support
3
4fail() { #msg
5    echo $1
6    exit_fail
7}
8
9if [ ! -f set_event ]; then
10    echo "event tracing is not supported"
11    exit_unsupported
12fi
13
14if [ ! -f synthetic_events ]; then
15    echo "synthetic event is not supported"
16    exit_unsupported
17fi
18
19echo "Test field variable support"
20
21echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthetic_events
22echo 'hist:keys=comm:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger
23echo '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
24echo 'hist:keys=pid,prio,comm:vals=lat:sort=pid,prio' > events/synthetic/wakeup_latency/trigger
25
26ping $LOCALHOST -c 3
27if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then
28    fail "Failed to create inter-event histogram"
29fi
30
31if ! grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
32    fail "Failed to create histogram with field variable"
33fi
34
35echo '!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
36
37if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then
38    fail "Failed to remove histogram with field variable"
39fi
40
41exit 0
42