#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you 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.

SVN_A_NAME="1.7.0"
SVN_B_NAME="trunk"

# benchmark script and parameters...
benchmark="$PWD/benchmark.py"

db="$PWD/${SVNBENCH_DEBUG}benchmark.db"

chartsdir="$PWD/charts"

mkdir -p "$chartsdir/.busy"

if [ ! -e "$chartsdir/README" ]; then
  cat > "$chartsdir/README" <<END
These charts are generated by svn benchmark suite1.
http://svn.apache.org/repos/asf/subversion/trunk/tools/dev/benchmarks/suite1

*DISCLAIMER* - This tests only file://-URL access on a GNU/Linux VM.
This is intended to measure changes in performance of the local working
copy layer, *only*. These results are *not* generally true for everyone.
END
fi

for levelspread in "" 5x5 1x100 100x1; do
  if [ -z "$levelspread" ]; then
    lsarg=""
    lstitle=""
  else
    lsarg=",$levelspread"
    lstitle=", WC dir levels x spread = $levelspread"
  fi
  N=12
  "$benchmark" -f "$db" chart compare \
     ${SVN_A_NAME}$lsarg ${SVN_B_NAME}@last${N}$lsarg \
     -o "$chartsdir/.busy/compare_${SVN_A_NAME}_${SVN_B_NAME}@last${N}$lsarg.svg" \
     -t "svn client benchmarks, file:// access *only*$lstitle"
done

mv "$chartsdir/.busy/"*.svg "$chartsdir/"
rmdir "$chartsdir/.busy"

