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
|
2023-01-17 12:12:55 +00:00
|
|
|
COLS=5,6,7,8 #resp-time, transaction-rate, throughput, concurrent
|
2022-12-20 20:09:39 +00:00
|
|
|
#< 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-17 10:45:25 +00:00
|
|
|
order by b.start_d asc, b.start_ps asc"
|
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"
|
2023-01-17 10:19:41 +00:00
|
|
|
UUID_CUT=$(echo "$UUID" | cut -d- -f1)
|
2022-12-20 20:18:56 +00:00
|
|
|
|
2023-01-17 10:19:41 +00:00
|
|
|
echo -n "$UUID_CUT " >> "$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
|
2023-01-17 10:55:30 +00:00
|
|
|
PLOT_NAME="throughput"
|
|
|
|
PLOT_TITLE="Throughput for 30 concurrent threads"
|
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-17 10:19:41 +00:00
|
|
|
info generating plot: "$OUT_IMG"
|
2023-01-11 17:48:34 +00:00
|
|
|
gnuplot >"$OUT_IMG" <<EOF
|
2023-01-17 10:19:41 +00:00
|
|
|
set terminal png size $DIMS background rgb "gray40"
|
2022-12-20 20:09:39 +00:00
|
|
|
set output '$OUT_IMG'
|
2023-01-17 10:55:30 +00:00
|
|
|
set title '$PLOT_TITLE'
|
2022-12-20 20:09:39 +00:00
|
|
|
set style data histograms
|
2023-01-17 10:19:41 +00:00
|
|
|
set style histogram clustered gap 2
|
|
|
|
set style fill solid 1.0 border lt -1
|
2023-01-17 12:12:55 +00:00
|
|
|
set xlabel "build UUID"
|
2023-01-17 10:55:30 +00:00
|
|
|
set ylabel "Avg. bytes/sec"
|
2023-01-17 12:12:55 +00:00
|
|
|
plot '$DAT' using 4:xtic(1)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
PLOT_VERSION=1
|
|
|
|
PLOT_NAME="transaction_rate"
|
|
|
|
PLOT_TITLE="Transaction rate for 30 concurrent threads"
|
|
|
|
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"
|
|
|
|
|
|
|
|
info generating plot: "$OUT_IMG"
|
|
|
|
gnuplot >"$OUT_IMG" <<EOF
|
|
|
|
set terminal png size $DIMS background rgb "gray40"
|
|
|
|
set output '$OUT_IMG'
|
|
|
|
set title '$PLOT_TITLE'
|
|
|
|
set style data histograms
|
|
|
|
set style histogram clustered gap 2
|
|
|
|
set style fill solid 1.0 border lt -1
|
|
|
|
set xlabel "build UUID"
|
|
|
|
set ylabel "Avg. transactions/sec"
|
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-17 12:12:55 +00:00
|
|
|
PLOT_VERSION=1
|
|
|
|
PLOT_NAME="response_time"
|
|
|
|
PLOT_TITLE="Response time for 30 concurrent threads"
|
|
|
|
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"
|
|
|
|
|
|
|
|
info generating plot: "$OUT_IMG"
|
|
|
|
gnuplot >"$OUT_IMG" <<EOF
|
|
|
|
set terminal png size $DIMS background rgb "gray40"
|
|
|
|
set output '$OUT_IMG'
|
|
|
|
set title '$PLOT_TITLE'
|
|
|
|
set style data histograms
|
|
|
|
set style histogram clustered gap 2
|
|
|
|
set style fill solid 1.0 border lt -1
|
|
|
|
set xlabel "build UUID"
|
|
|
|
set ylabel "Avg. response-time/req in ms"
|
|
|
|
plot '$DAT' using 2:xtic(1)
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
2023-01-12 15:58:26 +00:00
|
|
|
#rm "$DAT"
|
2023-01-17 10:19:41 +00:00
|
|
|
|
|
|
|
info done
|