diff --git a/util/analyze-contention-log.sh b/util/analyze-contention-log.sh index 6ad58e489b..b8cd6d0f77 100755 --- a/util/analyze-contention-log.sh +++ b/util/analyze-contention-log.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -eu # Copyright 2025 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). @@ -37,7 +37,7 @@ awk ' BEGIN {RS = ""; FS = "\n"} {file_num++; print > ("stacktrace" file_num ".txt")}' ./$LOGFILEBASE popd > /dev/null -rm $TEMPDIR/individual_files/$LOGFILEBASE +rm -f $TEMPDIR/individual_files/$LOGFILEBASE # # Make some associative arrays to track our stats @@ -48,7 +48,7 @@ declare -A latency_counts echo "Gathering latencies" FILECOUNT=$(ls $TEMPDIR/individual_files/stacktrace*.* | wc -l) -let currentidx=0 +currentidx=0 # # Look at every stack trace, get and record its latency, and hash value @@ -61,8 +61,8 @@ do #now compute its sha1sum SHA1SUM=$(sha1sum $i | awk '{print $1}') filenames["$SHA1SUM"]=$i - let CUR_LATENCY=0 - let LATENCY_COUNT=0 + CUR_LATENCY=0 + LATENCY_COUNT=0 # # If we already have a latency total for this hash value @@ -71,8 +71,8 @@ do # if [[ -v total_latency["$SHA1SUM"] ]] then - let CUR_LATENCY=${total_latency["$SHA1SUM"]} - let LATENCY_COUNT=${latency_counts["$SHA1SUM"]} + CUR_LATENCY=${total_latency["$SHA1SUM"]} + LATENCY_COUNT=${latency_counts["$SHA1SUM"]} fi # @@ -82,7 +82,7 @@ do total_latency["$SHA1SUM"]=$(dc -e "$CUR_LATENCY $LATENCY + p") latency_counts["$SHA1SUM"]=$(dc -e "$LATENCY_COUNT 1 + p") echo -e -n "FILE $currentidx/$FILECOUNT \r" - let currentidx=$currentidx+1 + currentidx=$((currentidx + 1)) done #