summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAnand Thakker <anandthakker@users.noreply.github.com>2017-02-28 14:11:35 -0800
committerGitHub <noreply@github.com>2017-02-28 14:11:35 -0800
commit4b81c924cc52e557fcae63725cd07a052ad1f4f7 (patch)
treee53c5d304b3ee5600c4ca90db7a2a80a051aa0da /scripts
parentf8766f704a13d0bff7c04b346fe2653d314684fa (diff)
downloadqtlocation-mapboxgl-4b81c924cc52e557fcae63725cd07a052ad1f4f7.tar.gz
[core] Log Memory.Footprint test results (#8170)
* Log Memory.Footprint test output * On CI, only run Memory.Footprint test with libjemalloc
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/log_memory_benchmarks.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/log_memory_benchmarks.sh b/scripts/log_memory_benchmarks.sh
new file mode 100755
index 0000000000..1f213caa92
--- /dev/null
+++ b/scripts/log_memory_benchmarks.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+set -u
+
+# Logs metrics on memory usage to CloudWatch
+
+GTEST_OUTPUT=$1
+DIMENSIONS=$2
+
+if [ -z "${DIMENSIONS}" ]; then
+ echo "* No dimensions specified for memory benchmarks"
+ exit 1
+fi
+
+function reportAttributeValue {
+ ATTR_NAME=$1
+ ATTR_UNITS=$2
+ ATTR_VALUE=$(cat $GTEST_OUTPUT | grep -o "$ATTR_NAME=\"[^\"]*" | sed "s/$ATTR_NAME=\"//")
+ if [ ${CLOUDWATCH:-} ]; then
+ echo "* Reporting $ATTR_NAME = $ATTR_VALUE $ATTR_UNITS for '${DIMENSIONS}'"
+ aws --region us-east-1 cloudwatch put-metric-data \
+ --namespace "Mapbox/GL" \
+ --metric-name "$ATTR_NAME" \
+ --unit "$ATTR_UNITS" \
+ --value ${ATTR_VALUE} \
+ --dimensions "${DIMENSIONS}"
+ else
+ echo "* Measured $ATTR_NAME = $ATTR_VALUE $ATTR_UNITS for '${DIMENSIONS}'"
+ fi
+}
+
+if [ -f "${GTEST_OUTPUT}" ]; then
+ reportAttributeValue vectorFootprint Bytes
+ reportAttributeValue rasterFootprint Bytes
+else
+ echo "* File '${GTEST_OUTPUT}' does not exist"
+fi