From a0411a1a0da019d939ac2e8796aa72beed49cfce Mon Sep 17 00:00:00 2001 From: Konstantin Seurer <konstantin.seurer@gmail.com> Date: Sun, 17 Dec 2023 15:23:54 +0100 Subject: [PATCH] fossils: Print replay duration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch prints the replay duration after the "Replaying $db" output. It should be useful for spotting slow fossils. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> --- fossil_replay.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fossil_replay.sh b/fossil_replay.sh index 4731254e..282de81d 100755 --- a/fossil_replay.sh +++ b/fossil_replay.sh @@ -32,17 +32,25 @@ for db in `find -L "$1" -type f -name "*.foz"`; do fi # Append stdout/stderr to file to reduce spam - echo "Replaying $db" + echo -n "Replaying $db" echo "Replaying $db" >> "/tmp/fossil_replay.txt" rm -f "$2".tmp + + start_time_ns=$(date +%s%N) fossilize-replay --enable-pipeline-stats "$2".tmp ${@:3} "$db" 1>&2 2>> "/tmp/fossil_replay.txt" + end_time_ns=$(date +%s%N) # Check for failures if [ ! -e "$2".tmp ]; then rm -f "$2".tmp.__tmp.foz - echo "Replay of $db failed" + echo " failed" grep "pipeline crashed or hung" /tmp/fossil_replay.txt exit 1 + else + duration_ns=$(($end_time_ns-$start_time_ns)) + duration_s=$(($duration_ns/1000000000)) + duration_cs=$(($(($duration_ns/10000000))-$(($duration_s*100)))) + echo " took $duration_s.$(($duration_cs))s" fi # Append to result CSV -- GitLab