mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 19:51:35 +01:00
porting "done"
This commit is contained in:
17
bench-cmd
Executable file
17
bench-cmd
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Benchmark a command as a string and output results
|
||||
# to a file with format:
|
||||
#
|
||||
# cmd <command run>
|
||||
# time <time in seconds to finish>
|
||||
# exit_status <exit status>
|
||||
set -eu
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
|
||||
# Command to benchmark
|
||||
cmd="$1"
|
||||
shift
|
||||
# Where to append write results to. Default: /dev/null.
|
||||
results_file="${1:-/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"
|
||||
Reference in New Issue
Block a user