Skip to content

Commit

Permalink
Working on issue #67 (performance profiling infrastructure): Ensured,…
Browse files Browse the repository at this point in the history
… that /dev/null as rerun script for make-measurements works (even as root). Also added the initialisation of generated rerun scripts.
  • Loading branch information
christoff-buerger committed Sep 20, 2016
1 parent de413f9 commit c71f18c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
32 changes: 24 additions & 8 deletions profiling/make-measurements.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
set -e
set -o pipefail
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
call_dir=`pwd`

################################################################################################################ Parse arguments:
if [ $# -eq 0 ]
Expand Down Expand Up @@ -38,7 +39,7 @@ do
echo "Usage: -c Profiling configuration (mandatory parameter)." >&2
echo " -s Save rerun script (optional parameter)." >&2
echo " Can be used to redo the measurements." >&2
echo " Generated in the 'measurements' directory of the used configuration." >&2
echo " Generated in the 'measurements' directory of the used profiling configuration." >&2
exit 2;;
esac
done
Expand All @@ -57,14 +58,15 @@ fi

measurements_date=`date "+%Y-%m-%d_%H-%M-%S"`
measurements_pipe="$script_dir/$measurements_date.measurements-pipe"
measurements_dir="$script_dir/`dirname "$profiling_configuration"`/measurements"
measurements_dir="`dirname "$profiling_configuration"`/measurements"
measurements_table="$measurements_dir/measurements-table.txt"
valid_parameters=0

if [ -z ${rerun_script+x} ]
then
rerun_script="/dev/null"
else
elif [ ! "$rerun_script" -ef "/dev/null" ]
then
rerun_script_basename="`basename "$rerun_script"`"
if [ "$rerun_script_basename" != "$rerun_script" ]
then
Expand All @@ -84,7 +86,7 @@ fi

my_exit(){
exit_status=$?
if [ $exit_status -gt 0 ] && [ $valid_parameters -eq 0 ] && [ -t 0 ] && [ "$rerun_script" != "/dev/null" ]
if [ $exit_status -gt 0 ] && [ $valid_parameters -eq 0 ] && [ -t 0 ] && [ ! "$rerun_script" -ef "/dev/null" ]
then
rm "$rerun_script"
fi
Expand All @@ -95,23 +97,37 @@ trap 'my_exit' 1 2 3 9 15

mkfifo "$measurements_pipe"
"$script_dir/make-table.bash" -c "$profiling_configuration" -t "$measurements_table" -p "$measurements_pipe" &
if [ ! "$rerun_script" -ef "/dev/null" ]
then
echo -n "" > "$rerun_script"
chmod +x "$rerun_script"
fi


echo "#!/bin/bash" >> "$rerun_script"
echo "set -e" >> "$rerun_script"
echo "set -o pipefail" >> "$rerun_script"
#echo "script_dir=\"\$( cd \"\$( dirname \"\${BASH_SOURCE[0]}\" )\" && pwd )\"" >> "$rerun_script"
#echo "my_exit(){" >> "$rerun_script"
#echo " exit_status=\$?" >> "$rerun_script"
#echo " cd \"\$script_dir\"" >> "$rerun_script"
#echo " exit \$exit_status" >> "$rerun_script"
#echo "}" >> "$rerun_script"
#echo "trap 'my_exit' 1 2 3 9 15" >> "$rerun_script"
echo "cd \"$call_dir\"" >> "$rerun_script"
echo "\"$script_dir/make-measurements.bash\" -c \"$profiling_configuration\" -s /dev/null -- << EOF" >> "$rerun_script"
echo "EOF" >> "$rerun_script"

sleep 1
echo " !!! ABORT: Not implemented yet !!!"
my_exit



################################################################################################################ Read parameters:
declare -a parameter_names
declare -a parameter_values
declare -a parameter_iterations
declare -a parameter_adjustments

echo "************************************************** Configure Parameters **************************************************"
echo "$script_dir/make-measurements.bash << EOF" > "$rerun_script"
exec 3< measurements.configuration
while read -r line <&3
do
Expand Down
2 changes: 1 addition & 1 deletion profiling/make-table.bash
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ do
fi;;
h|?)
echo "Usage: -c Profiling configuration (mandatory parameter)." >&2
echo " -p Named input pipe providing measurement results to log (mandatory parameter)." >&2
echo " -p Input pipe providing measurement results to log (mandatory parameter)." >&2
echo " -t Measurements table used for logging (mandatory parameter)." >&2
echo " Created if not existent. New measurements are appended." >&2
exit 2;;
Expand Down

0 comments on commit c71f18c

Please sign in to comment.