diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2014-04-30 18:03:55 -0700 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-05-01 10:27:51 -0700 |
| commit | 0a6b0ec981a40e4d0991223e2cbb97d0997eb752 (patch) | |
| tree | 7e29d8ffde2ca0c6dcd5f0b44dcbe95a821fbf1c /utils | |
| parent | 7cd7c03222a76cd51d2e677bce784a6ec0abcb63 (diff) | |
utils: Move misc. scripts to utils
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/compare_runs | 70 | ||||
| -rwxr-xr-x | utils/json2csv | 21 | ||||
| -rwxr-xr-x | utils/run_benchmark | 91 | ||||
| -rwxr-xr-x | utils/system_description.sh | 73 |
4 files changed, 255 insertions, 0 deletions
diff --git a/utils/compare_runs b/utils/compare_runs new file mode 100755 index 0000000..68e29e2 --- /dev/null +++ b/utils/compare_runs @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import sys +import json +from os.path import (basename, dirname) + +run_ids = [] +data = {} +for json_file in sys.argv[1:]: + with open(json_file) as file: + run_id = basename(dirname(json_file)) + run_ids.append(run_id) + data[run_id] = json.load(file) + +results = {} +for run_id in run_ids: + for item in data[run_id]: + lib = item[u'test case'].split('-')[0] + testcase = item[u'test case'].split('-')[1] + avg_time = item[u'average run time (s)'] + if testcase not in results.keys(): + results[testcase] = {} + if run_id not in results[testcase].keys(): + results[testcase][run_id] = {} + results[testcase][run_id][lib] = avg_time + +# First header +print("%-12s " %('')), +for run_id in run_ids: + label = run_id.split('-')[1].upper() + print(" ==== %-16s ==== " %(label)), +print("\n"), + +# Second header +print("%-12s " % 'test case'), +for run_id in run_ids: + for lib in ['cairo', 'skia']: + print(" %-6s " %(lib)), + print(" %8s %s" %('ca:sk', ' ')), +if len(run_ids) == 2: + print(" %8s %8s" %('ca:ca', 'sk:sk')), +print("\n"), + +testcases = results.keys() +testcases.sort() +for testcase in testcases: + print("%-12s " %(testcase)), + for run_id in run_ids: + cairo_value = results[testcase][run_id]['cairo'] + skia_value = results[testcase][run_id]['skia'] + improvement = 100*(cairo_value - skia_value)/cairo_value + print(" %8f %8f %7.1f%% " %(cairo_value, skia_value, improvement)), + + if len(run_ids) == 2: + ca0 = results[testcase][run_ids[0]]['cairo'] + ca1 = results[testcase][run_ids[1]]['cairo'] + sk0 = results[testcase][run_ids[0]]['skia'] + sk1 = results[testcase][run_ids[1]]['skia'] + if ca0 == 0: + ca_ca_improvement = 0 + else: + ca_ca_improvement = 100*(ca0 - ca1)/ca0 + if sk0 == 0: + sk_sk_improvement = 0 + else: + sk_sk_improvement = 100*(sk0 - sk1)/sk0 + print(" %7.1f%% %7.1f%%" %(ca_ca_improvement, sk_sk_improvement)), + + print("\n"), + diff --git a/utils/json2csv b/utils/json2csv new file mode 100755 index 0000000..1b49dd3 --- /dev/null +++ b/utils/json2csv @@ -0,0 +1,21 @@ +#!/usr/bin/python + +import sys +import csv +import json + +json_file = sys.argv[1] +if len(sys.argv) > 2: + csv_file = sys.argv[2] +else: + csv_file = "results.csv" + +with open(json_file) as file: + data = json.load(file) + +with open(csv_file, "w") as file: + csv_file = csv.writer(file) + for item in data: + csv_file.writerow([item['test case'], item['size'], + item['iterations'], item['minimum run time (s)'], + item['average run time (s)']]) diff --git a/utils/run_benchmark b/utils/run_benchmark new file mode 100755 index 0000000..78a129f --- /dev/null +++ b/utils/run_benchmark @@ -0,0 +1,91 @@ +#!/bin/bash + +iterations=100 +size=256 + +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} ${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 + ./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 + +echo "No MSAA" >> ${results_dir}/comparison.txt +export CAIRO_GL_COMPOSITOR= +surfaces=$(${CASKBENCH} -l) +for surface in ${surfaces}; do + run_caskbench "${results_dir}/${host}-${surface}" "${surface}" +done +./compare_runs "${results_dir}/${host}-image/results.json" "${results_dir}/${host}-egl/results.json" \ + >> ${results_dir}/comparison.txt +echo >> ${results_dir}/comparison.txt + +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}-msaa" "${surface}" "--enable-egl-sample-buffers" +done +./compare_runs "${results_dir}/${host}-image-msaa/results.json" "${results_dir}/${host}-egl-msaa/results.json" \ + >> ${results_dir}/comparison.txt +echo >> ${results_dir}/comparison.txt + diff --git a/utils/system_description.sh b/utils/system_description.sh new file mode 100755 index 0000000..23f3de4 --- /dev/null +++ b/utils/system_description.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +export DISPLAY=:0 + +. /etc/lsb-release + +cpu=$(grep ^model\ name /proc/cpuinfo | head -n1 | cut -d: -f2) +xserver_version=$(/usr/bin/Xorg -version |& grep ^xorg-server | cut -d' ' -f2) +mesa_version=$(glxinfo | grep "OpenGL version") +xpci=$(xpci) +kernel=$(uname -r) +platform=$(uname -po) + +cat <<EOF +System +------------------------------------------------------------------------ +cpu: ${cpu} +platform: ${platform} +distribution: ${DISTRIB_DESCRIPTION} +linux kernel: ${kernel} +xserver: ${xserver_version} +mesa: ${mesa_version} +video: ${xpci} +------------------------------------------------------------------------ + +EOF + +# TODO: Detect this +cat <<EOF +Caskbench +------------------------------------------------------------------------ +description: TBD +respository: https://github.com/SRA-SiliconValley/caskbench +version: $(git log | head -n 1 | cut -d' ' -f2) +config: Default +patches: None +build-type: Release + +EOF + +# TODO: Detect this +cat <<EOF +Cairo +------------------------------------------------------------------------ +description: filters-wip branch of the cairogles fork +repository: https://github.com/SRA-SiliconValley/cairogles +version: 1a15478f9398ac5d0afbae977e548079bfc9d43a +config: All defaults, with + --enable-egl --enable-gles3 +patches: None +build-type: Release +------------------------------------------------------------------------ + +EOF + +# TODO: Detect this +cat <<EOF +Skia +------------------------------------------------------------------------ +description: Manually installed skia-sra from SRA-SiliconValley +repository: https://github.com/SRA-SiliconValley/skia +version: a850b9f1e9da4dbf0956543ae7f843d0d0883919 +config: -Dskia_build_for_tizen=1 \\ + -Duse_system_libjpeg=1 \\ + -Duse_system_libpng=1 \\ + -Dskia_shared_lib=1 \\ + -Dskia_arch_width=64 \\ + -Dskia_arch_type=x86 +build-type: Release +------------------------------------------------------------------------ + +EOF + |