feat: add zero-cost performance benchmark workflow
This commit is contained in:
1 parent
54851fc191
commit
5293d93a30
17 files changed
+1366
-8
No files matched your search
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
stop_file="${1:?stop file is required}"
|
||||
interval_seconds="${2:-1}"
|
||||
|
||||
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'
|
||||
while [[ ! -e "$stop_file" ]]; do
|
||||
captured_at="$(date --iso-8601=seconds)"
|
||||
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
|
||||
sleep "$interval_seconds"
|
||||
done
|
||||
Reference in new issue
Block a user