Files
linux-kernel-module-cheat/common
Ciro Santilli f10ef3a467 bench-all: add build benchmarks and make all benchmarks options
run: fix ./run -gu broken behaviour. Document ./tmu window switch failure.

readme: move travis failed attempt to readme.
2018-04-22 21:09:17 +01:00

60 lines
1.6 KiB
Bash

#!/usr/bin/env bash
common_abspath() (
echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
)
common_bench_cmd() (
# Benchmark a command.
#
# $1: command to benchmark
# $2: where to append write results to. Default: /dev/null.
#
# Result format:
#
# cmd <command run>
# time <time in seconds to finish>
# exit_status <exit status>
cmd="$1"
results_file="${2:-/dev/null}"
printf 'cmd ' >> "$results_file"
env time --append -f 'time %e' --output="$results_file" "${root_dir}/eeval" -a "$cmd" "$results_file"
printf "exit_status $?\n" >> "$results_file"
)
set_common_vars() {
arch="$1"
gem5="${2:-false}"
common_suffix="${3:-}"
buildroot_dir="${root_dir}/buildroot"
arch_dir="$arch"
if [ -n "$common_suffix" ]; then
arch_dir="${arch_dir}-${common_suffix}"
fi
out_arch_dir="${out_dir}/${arch_dir}"
buildroot_out_dir="${out_arch_dir}/buildroot"
build_dir="${buildroot_out_dir}/build"
images_dir="${buildroot_out_dir}/images"
host_dir="${buildroot_out_dir}/host"
gem5_out_dir="${out_arch_dir}/gem5"
m5out_dir="${gem5_out_dir}/m5out"
qemu_out_dir="${out_arch_dir}/qemu"
qemu_trace_txt_file="${qemu_out_dir}/trace.txt"
if "$gem5"; then
common_out_run_dir="$gem5_out_dir"
else
common_out_run_dir="$qemu_out_dir"
fi
}
root_dir="$(pwd)"
out_dir="${root_dir}/out"
common_bench_boot="${out_dir}/bench-boot.txt"
data_dir="${root_dir}/data"
p9_dir="${data_dir}/9p"
readfile_file="${data_dir}/readfile"
common_dir="${out_dir}/common"
f="${data_dir}/cli"
if [ -f "$f" ]; then
. "$f"
fi
# Default arch.
arch=x86_64
gem5=false