aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2015-08-03 09:54:38 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2015-08-03 09:54:38 -0400
commit033c51950c1c1385292a7b8bbe52d396bc41aaeb (patch)
treeee9b65b506fba80f895c4f2711d000f830ba6cbc
parent13861f451170ff6de60f9cf53b75f5d33a9290fd (diff)
Add ft-trace-overheads wrapper script
A more convenient interface to say "trace all overheads." Update .gitignore while at it...
-rw-r--r--.gitignore4
-rwxr-xr-xft-trace-overheads112
2 files changed, 115 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 1c561b3..2f993ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,9 @@
1.sconsign.dblite 1.sconsign.dblite
2*.o 2*.o
3*.d
3~* 4~*
5*~
4ftcat 6ftcat
5ft2csv 7ft2csv
6ftdump 8ftdump
7 9ftsort
diff --git a/ft-trace-overheads b/ft-trace-overheads
new file mode 100755
index 0000000..f651f50
--- /dev/null
+++ b/ft-trace-overheads
@@ -0,0 +1,112 @@
1#!/bin/bash
2
3PATH_TO_SCRIPT=`dirname $0`
4function find_helper()
5{
6 IN_PATH=`which $1`
7 REL_TO_PATH="$PATH_TO_SCRIPT/$2"
8 if [ -z "$IN_PATH" ] && [ ! -z "$PATH_TO_SCRIPT" ] && [ -x "$PATH_TO_SCRIPT/$1" ]
9 then
10 echo "$PATH_TO_SCRIPT/$1"
11 elif [ -z "$IN_PATH" ] && [ ! -z "$PATH_TO_SCRIPT" ] && [ -x "$REL_TO_PATH/$1" ]
12 then
13 echo "$REL_TO_PATH/$1"
14 else
15 echo "$IN_PATH"
16 fi
17}
18
19function die()
20{
21 echo "[EE] $*"
22 exit 1
23}
24
25[ -z "$FTCAT" ] && FTCAT=`find_helper ftcat ../ft_tools`
26[ -z "$FTCAT" ] && die "Can't find 'ftcat' utility."
27
28if [ "$1" == "-s" ]
29then
30 AUTO=1
31 shift
32fi
33
34PIDS=""
35
36# signal that we're done gathering data and clean up
37on_finish()
38{
39 echo "Ending Trace..."
40 kill $PIDS
41 wait $PIDS
42
43 exit 0
44}
45
46# register shutdown signal handler
47trap 'on_finish' SIGUSR1
48
49
50CPU_FILES=`ls /dev/litmus/ft_cpu_trace* 2>/dev/null`
51MSG_FILES=`ls /dev/litmus/ft_msg_trace* 2>/dev/null`
52
53if [ -z "${CPU_FILES}${MSG_FILES}" ]
54then
55 echo "[EE] Could not find any trace files in /dev/litmus/."
56 echo " Is this a LITMUS^RT kernel?"
57 echo " If so, is CONFIG_SCHED_OVERHEAD_TRACE enabled?"
58 die "No trace files found."
59fi
60
61NAME=$1
62shift
63
64[ -z "${NAME}" ] && die "No name specified. Run as 'ft-trace-overheads <NAME>'."
65
66
67SCHED_EVENTS="SCHED2 SCHED CXS TICK RELEASE"
68
69CPU_EVENTS=
70for x in $SCHED_EVENTS
71do
72 CPU_EVENTS="$CPU_EVENTS ${x}_END ${x}_START"
73done
74CPU_EVENTS="$CPU_EVENTS RELEASE_LATENCY"
75
76IPI_EVENTS="SEND_RESCHED"
77MSG_EVENTS=
78for x in $IPI_EVENTS
79do
80 MSG_EVENTS="$MSG_EVENTS ${x}_END ${x}_START"
81done
82
83NAME=${NAME//[ \/]/-}
84for dev in $CPU_FILES
85do
86 CPU=`basename ${dev} | sed 's/ft_cpu_trace//'`
87 TRACE="overheads_host=`hostname`_trace=${NAME}_cpu=${CPU}.bin"
88 echo "[II] Recording $dev -> $TRACE"
89 $FTCAT $dev $CPU_EVENTS > $TRACE &
90 PIDS="$PIDS $!"
91done
92
93for dev in $MSG_FILES
94do
95 CPU=`basename ${dev} | sed 's/ft_msg_trace//'`
96 TRACE="overheads_host=`hostname`_trace=${NAME}_msg=${CPU}.bin"
97 echo "[II] Recording $dev -> $TRACE"
98 $FTCAT $dev $MSG_EVENTS > $TRACE &
99 PIDS="$PIDS $!"
100done
101
102
103if [[ $AUTO != 1 ]]
104then
105 echo "Press Enter to end tracing..."
106 read
107 on_finish
108else
109 # wait for SIGUSR1 to terminate
110 echo "Waiting for SIGUSR1 to end tracing..."
111 while [ 1 ]; do sleep 10; done
112fi