feat: add authenticated business benchmark suite

This commit is contained in:
wlx committed 2026-08-13 14:22:34 +08:00
1 parent 5293d93a30
commit c25b180021
9 files changed
+652 -19

No files matched your search

+8 -3
View File
@@ -3,19 +3,24 @@ set -Eeuo pipefail
stop_file="${1:?stop file is required}"
interval_seconds="${2:-1}"
phase_file="${3:-}"
if ! [[ "$interval_seconds" =~ ^[1-9][0-9]*$ ]]; then
echo "Sampling interval must be a positive integer." >&2
exit 1
fi
printf '%s\n' 'captured_at,load_1m,mem_available_kib,container,cpu_percent,memory_usage,network_io,block_io,pids'
printf '%s\n' 'captured_at,phase,load_1m,mem_available_kib,container,cpu_percent,memory_usage,network_io,block_io,pids'
while [[ ! -e "$stop_file" ]]; do
captured_at="$(date --iso-8601=seconds)"
phase=""
if [[ -n "$phase_file" && -r "$phase_file" ]]; then
phase="$(tr -cd 'A-Za-z0-9_.-' < "$phase_file")"
phase="${phase:0:120}"
fi
load_1m="$(awk '{print $1}' /proc/loadavg)"
mem_available_kib="$(awk '/^MemAvailable:/ {print $2}' /proc/meminfo)"
docker stats --no-stream \
--format "${captured_at},${load_1m},${mem_available_kib},{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.NetIO}},{{.BlockIO}},{{.PIDs}}" \
|| true
--format "${captured_at},${phase},${load_1m},${mem_available_kib},{{.Name}},{{.CPUPerc}},{{.MemUsage}},{{.NetIO}},{{.BlockIO}},{{.PIDs}}"
sleep "$interval_seconds"
done