Newer
Older
#!/bin/bash
#
# Script used to check that the machine is ready for running benchmarks. This
# script assumes that the asv command is in the current PATH
set -eox pipefail
# Ensure asv now machine characteristics
asv machine --yes
echo check that system is ready for benchmark
echo "(use ASV_SKIP_SYSTEM_CHECK=1 to skip it)"
if [ -z "${ASV_SKIP_SYSTEM_CHECK:-}" ]; then
# Check that the machine is ready for benchmark
python -m perf system show
fi
# Ensure all repository are here
if [ ! -d mercurial ]; then
hg clone https://www.mercurial-scm.org/repo/hg mercurial
fi
if [ "$SCMPERF_WARMCACHE" != "skip" ] ; then
# get to the highest revision for future cache warming
if [ -n "$TESTTMP" ]; then
# do a lesser, quicker and quieter version of the setup for tests
(cd mercurial;
unset HGWITHRUSTEXT;
make clean --silent > /dev/null 2>&1;
make local --silent "PURE=--pure --quiet" > /dev/null 2>&1;);
else
hg -R mercurial update --clean -r "max(branch(default))"
(cd mercurial; make local );
fi
fi
repofiles="./default.repos"
if [ -e "./local.repos" ]; then
repofiles="./local.repos"
fi
./script/setup-repos $repofiles ./repos
python ./create_skip_file.py
# We prewarm all caches with the latest know mercurial changeset.
#
# This avoid the `hg debugupdatecache` run happening within the benchmark to
# take too long, leading to benchmark failing from timing out.
#
# However, this is not ideal because more agressive cache warming usually led
# to performance gain. So running caching warming from "later version" can
# artificially speed up timing from "later version".
#
# This is a trade-off. Having a risk of sightly too fast timing in some case
# seems a lesser evil than having many benchmark failing from timeout. The
# status without this pre-warming was not great either because the version used
# for the last cache warming was not controled either.
#
# The main concrete issue with this approach is that even on warm cache `hg
# debugupdatecache` can take some time multiple seconds. given the large number
# of repositories used in scm-perf. This can adds up to a couple of minutes.
if [ "$SCMPERF_WARMCACHE" != "skip" ] ; then
starttime=`date +%s`
for r in repos/*/.hg repos/partial-references/*/.hg; do
r="`dirname $r`"
echo checking caches for: $r
# dropping HGRC to avoid user extension interfering
HGRCPATH= mercurial/hg -R "$r" debugupdatecache
done
endtime=`date +%s`
echo warming cache took `expr $endtime - $starttime` seconds
fi