2022-12-20 20:09:39 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
prog_NAME=$(basename "${0}")
|
|
|
|
|
|
|
|
warn()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: WARN: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
info()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: INFO: $*"
|
|
|
|
}
|
|
|
|
|
|
|
|
err()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
}
|
|
|
|
|
|
|
|
die()
|
|
|
|
{
|
|
|
|
echo "${prog_NAME}: ERROR: $*" 1>&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2022-12-20 20:09:39 +00:00
|
|
|
PERFJOB_DIR="$1"
|
|
|
|
CACHE_DIR="$2"
|
|
|
|
DB="$3"
|
|
|
|
JOB="$4"
|
|
|
|
LATEST_UUID="$5"
|
|
|
|
|
|
|
|
DIMS=1920,1080
|
|
|
|
COLS=5,7,8 #resp-time, throughput, concurrent
|
|
|
|
#< Note: gnuplot can select the final columns
|
|
|
|
|
|
|
|
DAT="${PERFJOB_DIR}/tmp.dat"
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
#> Note: ordering desc for plot ordering left->right
|
2022-12-20 20:09:39 +00:00
|
|
|
get_jobs_build-uuids () {
|
|
|
|
sqlite3 "$DB" "select b.uuid from build as b \
|
|
|
|
join job as j on j.id = b.job\
|
2023-01-11 17:48:34 +00:00
|
|
|
where j.name = '$JOB' \
|
2023-01-12 15:58:26 +00:00
|
|
|
order by b.id desc"
|
2022-12-20 20:09:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_bin_hash () {
|
|
|
|
UUID="$1"
|
|
|
|
sqlite3 "$DB" "SELECT lower(hex(ba.sha256)) FROM build AS b
|
|
|
|
JOIN build_artifact AS ba ON ba.id = b.main_binary
|
|
|
|
WHERE uuid = '$UUID'"
|
|
|
|
}
|
|
|
|
|
|
|
|
N=0
|
|
|
|
|
2023-01-12 14:36:19 +00:00
|
|
|
while read -r UUID; do
|
2022-12-20 20:09:39 +00:00
|
|
|
|
|
|
|
BIN_SHA256=$(get_bin_hash "$UUID")
|
2023-01-11 17:48:34 +00:00
|
|
|
CSV="${PERFJOB_DIR}/${BIN_SHA256}/siege_test01.csv"
|
2022-12-20 20:09:39 +00:00
|
|
|
|
2022-12-20 20:26:22 +00:00
|
|
|
if [ ! -f "$CSV" ]; then
|
2023-01-12 15:58:26 +00:00
|
|
|
info "Skipping build with uuid '$UUID'. Test-data doesn't exist: '$CSV'"
|
2022-12-20 20:26:22 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
if [ $N = 0 ]; then
|
|
|
|
echo -n "# Build UUID - " > "$DAT"
|
2022-12-21 10:52:01 +00:00
|
|
|
cat "$CSV" | head -n1 | cut -d, -f"$COLS" \
|
|
|
|
| sed 's/,//g' \
|
|
|
|
| sed 's/ \+//' \
|
|
|
|
| sed 's/\( \+\)/ -\1/g' \
|
2023-01-12 15:58:26 +00:00
|
|
|
>> "$DAT"
|
2022-12-20 20:09:39 +00:00
|
|
|
fi
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
#goto validate csv file, and on invalid: append error-data instead
|
|
|
|
|
|
|
|
info appending line from "$CSV" of uuid "$UUID"
|
2022-12-20 20:18:56 +00:00
|
|
|
|
|
|
|
echo -n "$UUID " >> "$DAT"
|
2022-12-20 20:09:39 +00:00
|
|
|
cat "$CSV" | tail +2 | cut -d, -f"$COLS" \
|
|
|
|
| sed 's/,//g' \
|
2022-12-21 10:52:01 +00:00
|
|
|
| sed 's/ \+//' \
|
|
|
|
>> "$DAT"
|
2022-12-20 20:18:56 +00:00
|
|
|
|
2022-12-20 20:09:39 +00:00
|
|
|
N=$(($N + 1))
|
|
|
|
|
|
|
|
done < <(get_jobs_build-uuids)
|
|
|
|
|
|
|
|
PLOT_VERSION=1
|
|
|
|
PLOT_NAME=throughput
|
2023-01-11 17:48:34 +00:00
|
|
|
OUT_DIR="${CACHE_DIR}/perftest/${JOB}/${PLOT_NAME}_${PLOT_VERSION}"
|
|
|
|
if [ ! -e "$OUT_DIR" ]; then
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
|
|
fi
|
|
|
|
OUT_IMG="${OUT_DIR}/${LATEST_UUID}.png"
|
2022-12-20 20:09:39 +00:00
|
|
|
|
2023-01-11 17:48:34 +00:00
|
|
|
gnuplot >"$OUT_IMG" <<EOF
|
2022-12-20 20:09:39 +00:00
|
|
|
set terminal png size $DIMS
|
|
|
|
set output '$OUT_IMG'
|
2022-12-20 20:27:25 +00:00
|
|
|
set title '$PLOT_NAME'
|
2022-12-20 20:09:39 +00:00
|
|
|
set style data histograms
|
2022-12-20 20:20:59 +00:00
|
|
|
plot '$DAT' using 3:xtic(1)
|
2022-12-20 20:09:39 +00:00
|
|
|
EOF
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
#rm "$DAT"
|