hawk-utils-scripts/monitoring/logs/scripts/plot_energy_logs.sh

47 lines
927 B
Bash
Executable file

#!/bin/bash
if [ ! -r $1 ]; then
echo "File $1 is not readable. Exiting."
exit
fi
fn=$1
if [[ $1 == *gz ]]; then
fn="<zcat $fn"
fi
#id=$(echo $1 | sed "s/\(.*-pbs5\).*/\1/")
# drop leading dirs
id=$(echo $1 | rev | cut -d "/" -f1 | rev | sed "s/\(.*-pbs5\).*/\1/")
ts=""
if [[ $# -eq 2 ]]; then
ts=$2
fi
gnuplot --persist <<EOF
fn = "$fn"
ts = "$ts"
set datafile separator ','
stats fn u 1 name "time" nooutput
tmin=time_min
set title " Job ID $id
set title noenhanced
set xlabel "time since jobstart [s]"
set ylabel "power [W]"
set key left top
set grid
do for [t in ts ] {
set arrow from t, graph 0 to t, graph 0.95 nohead
set arrow from t-tmin, graph 0 to t-tmin, graph 0.95 nohead
}
plot fn u (\$1-tmin):3 w l lc "red" t "head", "" u (\$1-tmin):(\$4-\$8):(\$4+\$8) w filledcurves lc "skyblue" fs transparent solid 0.5 t "nodes avg+-stddev", "" u (\$1-tmin):5 w l lc "blue" t "nodes median"
EOF