From a2f9b5adb369c12ba055928d1d92914f3441e4b4 Mon Sep 17 00:00:00 2001 From: Sajan Ghimire <122589374+54J4N@users.noreply.github.com> Date: Tue, 13 Jan 2026 09:46:38 +0545 Subject: [PATCH] Improve robustness and fix minor typo - Fix typo in latency error message - Clarify median selection behavior - Improve bandwidth parsing robustness (no behavior change) --- cachelib/cachebench/vizualize/extract_latency.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cachelib/cachebench/vizualize/extract_latency.sh b/cachelib/cachebench/vizualize/extract_latency.sh index 317c164e04..49e1e71237 100644 --- a/cachelib/cachebench/vizualize/extract_latency.sh +++ b/cachelib/cachebench/vizualize/extract_latency.sh @@ -12,6 +12,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Note: +# For an even number of samples, this function returns the lower-middle +# value instead of averaging the two middle values. This is intentional +# for operational latency analysis. input_logfile=$1 @@ -54,7 +58,7 @@ extract_latency() { # check if the file actually produced valid content [[ "$(wc -l < "$out")" -eq "1" ]] && \ - echo "Incorrect log file. No latecny records found" || \ + echo "Incorrect log file. No latency records found" || \ echo "$search latency written to $out" } @@ -74,7 +78,8 @@ extract_bandwidth() { # get the bandwidth grep -e "$search" "$in" | \ tail -1 | \ - awk '{print $10 " " $13}' + awk -F '[ ,]+' '{for(i=1;i<=NF;i++) if($i=="egressBytesPerSec") print $(i+2), $(i+5)}' + } | column -t > "$out" # check if the file actually produced valid content