8 echo "Usage: $0 [ -N pattern_name ] [ -n pattern_count ] PATTERN TRACE_PARENT_DIR"
11 #Get a textdump command
12 # if RUNLTTV is defined try to use it
13 # if LTTV variable is defined try to use it
14 # try to find lttv in the path
15 # try to find runlttv in std paths (devel/lttv/runlttv and ust/../lttv/runlttv
17 if [ ! -d "$RUNLTTV" -a -x "$RUNLTTV" ]; then
18 LTTV_TEXTDUMP_CMD
="$RUNLTTV -m text "
21 elif [ -d "$RUNLTTV" -a -x "$RUNLTTV/runlttv" ]; then
22 LTTV_TEXTDUMP_CMD
="$RUNLTTV/runlttv -m text "
25 elif [ ! -d "$LTTV" -a -x "$LTTV" ]; then
26 LTTV_TEXTDUMP_CMD
="$LTTV -m textDump "
27 LTTV_TRACE_PREFIX
="-t"
29 elif [ -d "$LTTV" -a -x "$LTTV/lttv" ]; then
30 LTTV_TEXTDUMP_CMD
="$LTTV/lttv -m textDump "
31 LTTV_TRACE_PREFIX
="-t"
33 elif [ -x "$(which lttv.real)" ]; then
34 LTTV_TEXTDUMP_CMD
="$(which lttv.real) -m textDump ";
35 LTTV_TRACE_PREFIX
="-t"
37 elif [ -x "~/devel/lttv/runlttv" ]; then
38 LTTV_TEXTDUMP_CMD
="~/devel/lttv/runlttv -m text ";
41 elif [ -x "$(dirname `readlink -f $0`)/../../lttv/runlttv" ]; then
42 LTTV_TEXTDUMP_CMD
="$(dirname `readlink -f $0`)/../../lttv/runlttv -m text "
46 echo "$0: No lttv found. Edit \$RUNLTTV to point to your lttv source directory or \$LTTV to you lttv executable." 1>&2
51 while getopts ":n:N:" options
; do
53 n
) expected_count
=$OPTARG;;
63 shift $
(($OPTIND - 1))
66 if [ -z "$pattern" ]; then
67 error
"no pattern specified"
73 error
"no trace directory specified"
77 traces
=$
(find "$2" -mindepth 1 -maxdepth 1 -type d
)
78 lttv_trace_cmd
=$LTTV_TEXTDUMP_CMD
79 for trace
in $traces; do
80 lttv_trace_cmd
="$lttv_trace_cmd $LTTV_TRACE_PREFIX $trace"
82 echo -n "Analyzing trace ($name): "
84 cnt
=$
($lttv_trace_cmd |
grep "$pattern" |
wc -l)
85 if [ -z "$expected_count" ]; then
86 if [ "$cnt" -eq "0" ]; then
88 echo "Did not find at least one instance of this event ($cnt)"
95 if [ "$cnt" -ne "$expected_count" ]; then
97 echo "Expected: $expected_count"
This page took 0.031189 seconds and 4 git commands to generate.