Debian Codegraph @

devel-tools/cpu-bench-with-trace

raw
1 #! /usr/bin/env bash
2 #
3 # This runs a number of Bro configurations on trace $2. It
4 # starts with the bare config and then
5 # kept adding the scripts load from init-default.bro and local.bro one
6 # by one, measuring user time for each run (i.e., the measurements are
7 # cumulative).
8
9 if [ "$2" == "" ]; then
10 echo "usage: `basename $0` <brodir> <trace>"
11 exit 1
12 fi
13
14 bro=$1
15 trace=$2
16 tmp=/tmp/bench.$$.bro
17
18 export BROPATH=`$bro/build/bro-path-dev`
19
20 cat </dev/null >$tmp
21
22 cat $bro/scripts/base/init-default.bro $bro/scripts/site/local.bro | grep '^ *@load' | while read line; do
23 echo $line >>$tmp
24 script=`echo $line | awk '{print $2}' | sed 's#/#.#g'`
25 output="bench.output.$script.log"
26
27 ( time -p $bro/build/src/bro -b -r $trace $tmp ) >$output 2>&1
28 user=`cat $output | grep user | awk '{print $2}'`
29 printf "%40s %s\n" $script $user
30 done
31
32 rm -f $tmp
33
34
35