#!/bin/bash iterations=100 size=256 export DISPLAY=:0 which hostname > /dev/null if [ $? = 0 ]; then host=$(hostname -s) else host=$HOSTNAME fi if [ -z "$host" ]; then echo "Error: Could not determine hostname" exit 1 fi # This script assumes you've built caskbench in a sub-directory # named "build-HOST". It invokes the executable from that build # tree, and stores the results in a directories named # results-NNN/HOST-SURFACE. CASKBENCH="build-${host}/src/caskbench" if [ ! -e ${CASKBENCH} ]; then which caskbench > /dev/null if [ $? = 0 ]; then CASKBENCH=caskbench fi fi if [ -z "$CASKBENCH" ]; then echo "Could not locate caskbench executable" exit 1 fi run_caskbench() { out=$1 surface=$2 options=$3 outjson="${out}/results.json" outtxt="${out}/results.txt" outcsv="${out}/results.csv" rm -f cairo*.png skia*.png mkdir -p ${out} if [ $? != 0 ]; then echo "Error creating ${out}: $?" return 1 fi cp ./index.html ${out}/ echo "== ${surface^^} ==" | tee ${outtxt} ${CASKBENCH} -t ${surface} -i ${iterations} -s ${size} -o ${outjson} \ --enable-output-images ${options} | tee -a ${outtxt} if [ $? == 0 ]; then mv -f cairo*.png skia*.png ${out}/ fi echo | tee -a ${outtxt} # Add csv version of data if [ ! -e ${outjson} ]; then return 1 fi ./utils/json2csv ${outjson} ${outcsv} return 0 } id=0 results_dir=. today=$(date +%Y%m%d) while [ -d "${results_dir}" ]; do id=$(( id + 1 )) results_dir=$(printf "results-${today}-%02d" $id) done surfaces=$(${CASKBENCH} -l) #echo "MSAA (--enable-egl-sample-buffers)" >> ${results_dir}/comparison.txt export CAIRO_GL_COMPOSITOR=msaa for surface in ${surfaces}; do run_caskbench "${results_dir}/${host}-${surface}" "${surface}" done ./utils/compare_runs "${results_dir}/${host}-image/results.json" "${results_dir}/${host}-egl/results.json" \ >> ${results_dir}/comparison.txt echo >> ${results_dir}/comparison.txt