From 5ebc744511c404c4d5a5ba879b601f9738a9c462 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Thu, 14 Aug 2014 17:25:20 +0400 Subject: [PATCH] Logging performance and memory benchmarks to git notes during precommit testing. --- Makefile | 3 +++ tools/perf.sh | 2 +- tools/pull.sh | 18 ++++++++++++++++++ tools/push.sh | 42 ++++++++++++++++++++++++++++++------------ tools/rss_measure.sh | 2 ++ 5 files changed, 54 insertions(+), 13 deletions(-) create mode 100755 tools/pull.sh diff --git a/Makefile b/Makefile index 276d76405..f7c13960b 100644 --- a/Makefile +++ b/Makefile @@ -94,6 +94,9 @@ PRECOMMIT_CHECK_TARGETS_LIST= debug.linux.check \ push: ./tools/push.sh @ ./tools/push.sh +pull: ./tools/pull.sh + @ ./tools/pull.sh + precommit: clean @ echo -e "\nBuilding...\n\n" @ $(MAKE) build diff --git a/tools/perf.sh b/tools/perf.sh index 870aa84fa..d3d742797 100755 --- a/tools/perf.sh +++ b/tools/perf.sh @@ -18,4 +18,4 @@ ITERS=$1 ENGINE=$2 BENCHMARK=$3 -( ( for i in `seq 0 1 $ITERS`; do time "$ENGINE" "$BENCHMARK"; done ) 2>&1 ) | grep user | sed 's/[ms]/ /g' | awk '{ s += $2 * 60 + $3; n += 1; } END { print s / n; }' +( ( for i in `seq 1 1 $ITERS`; do time "$ENGINE" "$BENCHMARK"; done ) 2>&1 ) | grep user | sed 's/user[ \t]*\([0-9]*\)m\([0-9.]*\)s/\1 \2/g' | awk '{ s += $1 * 60 + $2; n += 1; } END { print s / n; }' diff --git a/tools/pull.sh b/tools/pull.sh new file mode 100755 index 000000000..d47c67c78 --- /dev/null +++ b/tools/pull.sh @@ -0,0 +1,18 @@ +# Copyright 2014 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash + +git pull --rebase +git fetch origin refs/notes/*:refs/notes/* diff --git a/tools/push.sh b/tools/push.sh index e02844b22..8a5297445 100755 --- a/tools/push.sh +++ b/tools/push.sh @@ -17,6 +17,11 @@ GIT_STATUS_NOT_CLEAN_MSG="Git status of current directory is not clean" GIT_STATUS_CONSIDER_CLEAN_MSG="Consider removing all untracked files, locally commiting all changes and running $0 again" +CPPCHECK_INFO=`cppcheck --version` +VERA_INFO="Vera++ "`vera++ --version` +GCC_INFO=`gcc --version | head -n 1` +BUILD_INFO=`echo -e "$CPPCHECK_INFO\n$VERA_INFO\n$GCC_INFO"` + trap ctrl_c INT function ctrl_c() { @@ -66,6 +71,10 @@ do git checkout $commit_hash >&/dev/null status_code=$? + git notes --ref=test_build_env remove $commit_hash >&/dev/null + git notes --ref=perf remove $commit_hash >&/dev/null + git notes --ref=mem remove $commit_hash >&/dev/null + if [ $status_code -ne 0 ] then echo "git checkout $commit_hash failed" @@ -82,12 +91,30 @@ do status_code=$? if [ $status_code -ne 0 ] then - echo "Pre-commit testing for '$commit_hash' failed" + echo "Pre-commit quality testing for '$commit_hash' failed" echo ok_to_push=0 break fi + + echo "Pre-commit quality testing for '$commit_hash' passed successfully" + echo + echo "Starting pre-commit performance measurement for '$commit_hash'" + echo + + BENCH_ENGINE="./out/release.linux/jerry" + BENCH_SCRIPT="./benchmarks/jerry/loop_arithmetics_1kk.js" + PERF_ITERS="5" + PERF_INFO=`echo -e "$BENCH_SCRIPT:\n\t"``./tools/perf.sh $PERF_ITERS $BENCH_ENGINE $BENCH_SCRIPT`" seconds" + MEM_INFO=`echo -e "$BENCH_SCRIPT:\n"``./tools/rss_measure.sh $BENCH_ENGINE $BENCH_SCRIPT` + + echo "Pre-commit performance measurement for '$commit_hash' completed" + echo + + git notes --ref=test_build_env add -m "$BUILD_INFO" $commit_hash + git notes --ref=perf add -m "$PERF_INFO" $commit_hash + git notes --ref=mem add -m "$MEM_INFO" $commit_hash done git checkout master >&/dev/null @@ -96,16 +123,6 @@ echo echo "Pre-commit testing passed successfully" echo -# echo -# echo "Pre-commit testing passed successfully. Starting performance and memory benchmarking" -# echo - -# ./tools/test_stability.sh $((`echo $commits_to_push | wc -w` + 1)) - -# echo -# echo "Performance and memory benchmarking completed" -# echo - if [ $ok_to_push -eq 1 ] then if [ "`git status --porcelain 2>&1 | wc -l`" == "0" ] @@ -113,7 +130,8 @@ then echo "Pushing..." echo - git push && echo -e "\n\e[0;32m Pushed successfully\e[0m\n" || echo -e "\n\e[1;33m Push failed\e[0m" + git push && echo -e "\n\e[0;32m Pushed successfully\e[0m\n" || echo -e "\n\e[1;33m Push failed\e[0m" && exit 1 + git push origin refs/notes/* || echo -e "\n\e[1;33m Notes push failed\e[0m" && exit 1 exit 0 else echo -e "\e[1;33m $GIT_STATUS_NOT_CLEAN_MSG. $GIT_STATUS_CONSIDER_CLEAN_MSG.\e[0m\n" diff --git a/tools/rss_measure.sh b/tools/rss_measure.sh index ed8cd2d6b..fe88c6b75 100755 --- a/tools/rss_measure.sh +++ b/tools/rss_measure.sh @@ -63,6 +63,8 @@ done FINISH=$(date +%s.%N) EXEC_TIME=$(echo "$FINISH - $START" | bc) +echo + if [ "$RAW_OUTPUT" != "" ]; then echo -e $RSS_OUTPUT;