Change in osmo-tetra[master]: add script for testing performance and number of correctly decoded fr...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Jul 31 06:58:11 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10261 )

Change subject: add script for testing performance and number of correctly decoded frames
......................................................................

add script for testing performance and number of correctly decoded frames

Change-Id: I6d8030969eed4519520745207591ce4731939201
---
M src/.gitignore
A src/tetra-rx-tests.sh
2 files changed, 83 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/.gitignore b/src/.gitignore
index 8451771..a72cffe 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -7,3 +7,4 @@
 float_to_bits
 crc_test
 tunctl
+tests_data/*
diff --git a/src/tetra-rx-tests.sh b/src/tetra-rx-tests.sh
new file mode 100755
index 0000000..f84a1ad
--- /dev/null
+++ b/src/tetra-rx-tests.sh
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+if [ $# -lt 1 ]; then
+	echo "$0"
+	echo "Runs tetra-rx on bit files provided as args, prints the number of correct frames"
+	echo " and the time it took and compares it to previous runs."
+	echo ""
+	echo "Extra options:"
+	echo "	-n <experiment name> (default: git head id) (no spaces and \"-\" please)"
+	echo "	-o overwrite previous measurement"
+	echo "	-t parameters for tetra-rx"
+	echo ""
+	echo "Examples:"
+	echo "$0 path/to/file.bits"
+	echo "$0 -n \"something changed\" path/to/file.bits path/to/file2.bits"
+	exit 1
+fi
+
+if ! command -v bc > /dev/null; then
+	echo "Please install \"bc\""
+fi
+
+TESTS_DIR="tests_data/"
+mkdir -p "$TESTS_DIR"
+
+n=`git rev-parse HEAD`
+o=0
+t=" "
+while getopts ":n:ot:" opt; do
+	case $opt in
+	n)
+		n="$OPTARG"
+		;;
+	o)
+		o=1
+		;;
+	t)
+		t="$OPTARG"
+		;;
+	\?)
+		echo "Unknown option $OPTARG" >&2
+		exit 1
+		;;
+	:)
+		echo "-$OPTARG requires argument" >&2
+		exit 1
+		;;
+	esac
+done
+
+shift $(( $OPTIND - 1 ))
+
+tmpdir=`mktemp -d /tmp/tetraXXX`
+
+for f in $@; do
+	corrects=`"time" -o "$tmpdir/time" ./tetra-rx "$f" $t 2>/dev/null | grep -E "^CRC COMP: 0x.+ OK" | wc -l`
+	tt=`grep user "$tmpdir/time" | head -n 1 | cut -d u -f 1`
+	echo "$f: $corrects frames, $tt s"
+	hash=`sha256sum "$f" | cut -c 1-20`
+	fnb="$TESTS_DIR/rx-$hash-"
+	for meas in "$fnb"*; do
+		if ! [ -s "$meas" ]; then
+			continue
+		fi
+		tag=`echo "$meas" | rev | cut -d - -f 1 | rev`
+		if [ "$tag" = "$n" ]; then
+			continue
+		fi
+		pf=`cat "$meas" | cut -d " " -f 1`
+		pt=`cat "$meas" | cut -d " " -f 2`
+		deltaf=`echo "scale=7; $corrects/$pf" | bc -l`
+		deltat=`echo "scale=3; $tt/$pt" | bc -l`
+		echo "... ${deltaf}x frames than $tag"
+		echo "... ${deltat}x time than $tag"
+	done
+	fn="$fnb$n"
+	if [ "$o" -eq 1 -o ! -s "$fn" ]; then
+		echo "$corrects $tt" > "$fn"
+	fi
+done
+
+rm -r "$tmpdir"

-- 
To view, visit https://gerrit.osmocom.org/10261
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-tetra
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I6d8030969eed4519520745207591ce4731939201
Gerrit-Change-Number: 10261
Gerrit-PatchSet: 1
Gerrit-Owner: Jan Hrach <jenda.2vf9h at hrach.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180731/8f1f662a/attachment.htm>


More information about the gerrit-log mailing list