1*fd283ab1SHou Tao#!/bin/bash 2*fd283ab1SHou Tao# SPDX-License-Identifier: GPL-2.0 3*fd283ab1SHou Tao 4*fd283ab1SHou Taosource ./benchs/run_common.sh 5*fd283ab1SHou Tao 6*fd283ab1SHou Taoset -eufo pipefail 7*fd283ab1SHou Tao 8*fd283ab1SHou Taohtab_mem() 9*fd283ab1SHou Tao{ 10*fd283ab1SHou Tao echo -n "per-prod-op: " 11*fd283ab1SHou Tao echo -n "$*" | sed -E "s/.* per-prod-op\s+([0-9]+\.[0-9]+ ± [0-9]+\.[0-9]+k\/s).*/\1/" 12*fd283ab1SHou Tao echo -n -e ", avg mem: " 13*fd283ab1SHou Tao echo -n "$*" | sed -E "s/.* memory usage\s+([0-9]+\.[0-9]+ ± [0-9]+\.[0-9]+MiB).*/\1/" 14*fd283ab1SHou Tao echo -n ", peak mem: " 15*fd283ab1SHou Tao echo "$*" | sed -E "s/.* peak memory usage\s+([0-9]+\.[0-9]+MiB).*/\1/" 16*fd283ab1SHou Tao} 17*fd283ab1SHou Tao 18*fd283ab1SHou Taosummarize_htab_mem() 19*fd283ab1SHou Tao{ 20*fd283ab1SHou Tao local bench="$1" 21*fd283ab1SHou Tao local summary=$(echo $2 | tail -n1) 22*fd283ab1SHou Tao 23*fd283ab1SHou Tao printf "%-20s %s\n" "$bench" "$(htab_mem $summary)" 24*fd283ab1SHou Tao} 25*fd283ab1SHou Tao 26*fd283ab1SHou Taohtab_mem_bench() 27*fd283ab1SHou Tao{ 28*fd283ab1SHou Tao local name 29*fd283ab1SHou Tao 30*fd283ab1SHou Tao for name in overwrite batch_add_batch_del add_del_on_diff_cpu 31*fd283ab1SHou Tao do 32*fd283ab1SHou Tao summarize_htab_mem "$name" "$($RUN_BENCH htab-mem --use-case $name -p8 "$@")" 33*fd283ab1SHou Tao done 34*fd283ab1SHou Tao} 35*fd283ab1SHou Tao 36*fd283ab1SHou Taoheader "preallocated" 37*fd283ab1SHou Taohtab_mem_bench "--preallocated" 38*fd283ab1SHou Tao 39*fd283ab1SHou Taoheader "normal bpf ma" 40*fd283ab1SHou Taohtab_mem_bench 41