diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-09-11 10:33:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-09-11 10:58:26 +0100 |
commit | 30b739898a14533138128a4dc3f44a5c21b61ab7 (patch) | |
tree | 037cef3fd151e7721920610375932c049d160a8b | |
parent | caef60ad67f419dac73b40e9cf6859e9191ac164 (diff) |
core: Track build time inside git config
Use the repo's git config to track the running average of how long it
takes to rebuild the project (to localise and improve the runtime
estimation).
-rwxr-xr-x | ezbench.sh | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -18,7 +18,6 @@ LC_NUMERIC="C" #Default values rounds=3 -avgBuildTime=30 makeCommand="make -j8 install" lastNCommits= uptoCommit="HEAD" @@ -119,12 +118,6 @@ while getopts "h?p:n:N:H:r:b:B:m:T:l" opt; do done shift $((OPTIND-1)) -# Set the average compilation time to 0 when we are not compiling -if [ -z "$makeCommand" ] -then - avgBuildTime=0 -fi - # redirect the output to both a log file and stdout logsFolder="$ezBenchDir/logs/${name:-$(date +"%Y-%m-%d-%T")}" [ -d $logsFolder ] || mkdir -p $logsFolder || exit 1 @@ -250,6 +243,14 @@ if [ -n "$missing_tests" ]; then exit 1 fi +# Set the average compilation time to 0 when we are not compiling +if [ -z "$makeCommand" ] +then + avgBuildTime=0 +else + avgBuildTime=$(git config --get ezbench.average-build-time 2>/dev/null || echo 30) +fi + # Estimate the execution time if [ -z "$commitList" ]; then commitList=$(git rev-list --abbrev-commit --reverse -n ${lastNCommits} ${uptoCommit}) @@ -281,7 +282,9 @@ function compile { # Compile the commit and check for failure. If it failed, go to the next commit. compile_logs=$logsFolder/${commit}_compile_log + compile_start=$(date +%s) eval $makeCommand > $compile_logs 2>&1 + compile_end=$(date +%s) if [ $? -ne 0 ] then echo " ERROR: Compilation failed, log saved in $compile_logs" @@ -290,6 +293,10 @@ function compile { continue fi + # Update our build time estimator + avgBuildTime=$(bc <<< "0.75*$avgBuildTime + 0.25*($compile_end - $compile_start)") + git config --replace-all ezbench.average-build-time $(printf "%.0f" $avgBuildTime) + # Call the user-defined post-compile hook callIfDefined compile_post_hook |