From 75f8e25aed9ddeb589b46661b4b88fd05250e0a7 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Wed, 19 Aug 2015 22:12:20 +0200 Subject: [PATCH] Added a script to measure the size of the sample programs --- scripts/create-size-graph.sh | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 scripts/create-size-graph.sh diff --git a/scripts/create-size-graph.sh b/scripts/create-size-graph.sh new file mode 100755 index 00000000..ed37e863 --- /dev/null +++ b/scripts/create-size-graph.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -eu + +OUTPUT="$(pwd)/sizes.csv" + +echo "Tag;Date;Parser;Generator" > $OUTPUT + +cd $(dirname $(dirname $0)) + +git tag | while read TAG +do + + git checkout -q tags/$TAG + + DATE=$(git log -1 --date=short --pretty=format:%cd) + PARSER_SIZE=$(arduino --verify examples/JsonParserExample/JsonParserExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/') + + if [ -e 'examples/JsonGeneratorExample/JsonGeneratorExample.ino' ]; then + GENERATOR_SIZE=$(arduino --verify examples/JsonGeneratorExample/JsonGeneratorExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/') + else + GENERATOR_SIZE="" + fi + + echo $TAG + if [ ! -z "$PARSER_SIZE" ] + then + echo "JsonParserExample = $PARSER_SIZE bytes" + else + echo "JsonParserExample compilation failed." + fi + + if [ ! -z "$GENERATOR_SIZE" ] + then + echo "JsonGeneratorExample = $GENERATOR_SIZE bytes" + else + echo "JsonGeneratorExample compilation failed." + fi + + echo "$TAG;$DATE;$PARSER_SIZE;$GENERATOR_SIZE" >> $OUTPUT + +done