From 53e3572a5aadcdd13a12d7f6b2083a4cf0fd65fc Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 21 Jan 2015 00:31:51 +0100 Subject: [PATCH] benches: introduces bench_markdown script Signed-off-by: Alexandre Terrasa --- benchmarks/markdown/bench_markdown.sh | 87 +++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 benchmarks/markdown/bench_markdown.sh diff --git a/benchmarks/markdown/bench_markdown.sh b/benchmarks/markdown/bench_markdown.sh new file mode 100755 index 0000000..639ffdd --- /dev/null +++ b/benchmarks/markdown/bench_markdown.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Licensed 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. + +# Shell script to bench nitmd over different kind of document. + +source ../bench_common.sh +source ../bench_plot.sh + +## CONFIGURATION OPTIONS ## + +# Default number of times a command must be run with bench_command +# Can be overrided with 'the option -n' +count=2 + +### HELPER FUNCTIONS ## + +function die() +{ + echo >&2 "error: $*" + died=1 +} + +## HANDLE OPTIONS ## + +function usage() +{ + echo "run_bench: [options]* benchname" + echo " -v: verbose mode" + echo " -n count: number of execution for each bar (default: $count)" + echo " --dry: Do not run the commands, just reuse the data and generate the graph" + echo " -h: this help" +} + +stop=false +while [ "$stop" = false ]; do + case "$1" in + -v) verbose=true; shift;; + -h) usage; exit;; + -n) count="$2"; shift; shift;; + --dry) dry_run=true; shift;; + *) stop=true + esac +done + +## GEN BENCHES +cd benches; make; cd .. + +## COMPILE ENGINES +cd engines; make; cd .. + +NOTSKIPED="$*" + +if test -z "$NOTSKIPED"; then + usage + echo "List of available benches:" + echo "* all: run all the benches" +fi + +## EFFECTIVE BENCHS ## +outdir="./out" +engdir="./engines" +bncdir="./benches/out" +mkdir -p $outdir + +s=50 + +if test "$#" -gt 0; then + plot $outdir/bench_markdown.gnu +fi + +if test -n "$died"; then + echo "Some commands failed" + exit 1 +fi +exit 0 -- 1.7.9.5