From d12ff7fb6717f7517b8749ec7af6b2ae39f3c5c8 Mon Sep 17 00:00:00 2001 From: Sergey Yagovtsev Date: Thu, 18 Feb 2016 23:52:28 +0300 Subject: [PATCH] Added test script --- scripts/test.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/test.sh diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..b720d85 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +DISABLED_PROF=./bin/profiler_sample_disable +ENABLED_PROF=./bin/profiler_sample_enable + +DISABLE_FILE=disable.info +ENABLE_FILE=enable.info + +for i in {1..100} +do + $DISABLED_PROF >> $DISABLE_FILE + $ENABLED_PROF >> $ENABLE_FILE +done + +DISABLE_AVERAGE_TIME=`awk '{s+=$1}END{print s/NR}' RS=" " $DISABLE_FILE` +ENABLE_AVERAGE_TIME=`awk '{s+=$1}END{print s/NR}' RS=" " $ENABLE_FILE` + +DT=`echo "$ENABLE_AVERAGE_TIME - $DISABLE_AVERAGE_TIME" | bc -l` +PERCENT=`echo "$DT*100.0/$ENABLE_AVERAGE_TIME" | bc -l` +echo "dT: $DT usec" +echo "percent: $PERCENT%"