#! /bin/zsh
## other files:
## ~/public_html/hs-linux/src/times.el [1]
## ~/public_html/hs-linux/docs/report/report.tex [2]
## ~/public_html/hs-linux/src/compile_lisp
## ~/public_html/hs-linux/src/forever
## ~/scripts/a-level
source ${0:h}/be-paths # ./be-paths
monitor-experiment () { watch -t -n 0.1 "cat $EXPERIMENT_STATUS_FILE" }
## this crunches the tick readings into stats using [1]
## see: "the Linux and C++ clocks" in [2]
do-tick-stats () {
emacs -Q \
--insert $1 \
--script $SRC_PATH/times.el \
--eval "(tick-stats (* 1000000 $2))"
}
## for the -l switch to work
## hs must have root as owner
## and the SUID bit set (gulp)
## i.e.: sudo chown root hs
## sudo chmod +s hs
## it also works to use sudo here
## but if so do sudo warm-up
## so not to type the password
## thus affecting the experiment outcome
HS_OUTPUT=hs_output.log
run-hs () { $SRC_PATH/hs -s $1 -r -l -f > $RESULTS_PATH/$1/$HS_OUTPUT }
run-hs-p () { $SRC_PATH/hs -s $1 -r -l -f -P > $RESULTS_PATH/$1/$HS_OUTPUT }
# run hs with SCHED_FIFO -
# see "Linux real time schedulers" in [2]
# for this to work without sudo:
# sudo chmod +s /usr/bin/chrt
# (this hasn't been used in the experiments so far)
run-hs-rt () { chrt --fifo 99 ./hs $@ }
run-all-experiments () {
run-contention-experiment # ~/.zsh/be-contention-experiment
run-memory-experiment # ~/.zsh/be-memory-experiment
run-task-system-experiment # ~/.zsh/be-system-experiment
run-linux-process-experiment # ~/.zsh/be-process-experiment
run-audio-experiment 10 # ~/.zsh/be-audio-experiment
}