Skip to content

Commit eff7100

Browse files
committed
Script for timing large snapshot
Not sure if we wanna merge this, but I'll push a draft PR to share my hacky script. Somewhat on-topic for... Ref: https://issues.redhat.com/browse/EC-976
1 parent a2e1084 commit eff7100

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

hack/large-snapshot-times.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SNAPSHOT=./large.yaml
5+
PUBLIC_KEY=./key-rhel-osci.pub
6+
POLICY_CONFIGURATION=github.com/enterprise-contract/config//redhat
7+
8+
#VERSIONS_TO_TEST=(
9+
# v0.6.94
10+
# v0.6.129
11+
# v0.6.138
12+
# v0.6.142
13+
#)
14+
15+
#VERSIONS_TO_TEST=(v0.6.94)
16+
VERSIONS_TO_TEST=(main)
17+
18+
#WORKERS=5
19+
WORKERS=20
20+
21+
GOOS=$(go env GOOS)
22+
GOARCH=$(go env GOARCH)
23+
EC=./dist/ec_${GOOS}_${GOARCH}
24+
25+
TIME=/usr/bin/time
26+
TIME_FORMAT='User CPU time: %U\nSystem CPU time: %S\nElapsed time: %e\nPeak memory usage: %M kb'
27+
28+
for ref in ${VERSIONS_TO_TEST[@]}; do
29+
EC_REF=${EC}_${ref}
30+
31+
if [[ ! -x "$EC_REF" ]]; then
32+
git reset --hard "${ref}"
33+
make ${EC}
34+
cp ${EC} ${EC_REF}
35+
cp ${EC}.sha256 ${EC_REF}.sha256
36+
fi
37+
38+
title="Ref ${ref}"
39+
echo "$title"
40+
echo "$title" | tr '[:print:]' '='
41+
42+
git log --format="Commit: %h %s%nDate: %cd" -n 1 ${ref}
43+
echo "Started: $(date)"
44+
45+
${TIME} --format "${TIME_FORMAT}" \
46+
${EC_REF} validate image \
47+
--images large.yaml \
48+
--public-key key-rhel-osci.pub \
49+
--policy ${POLICY_CONFIGURATION} \
50+
--ignore-rekor \
51+
--output json=/dev/null \
52+
--output yaml=/dev/null \
53+
--show-successes \
54+
--timeout 60m \
55+
--workers ${WORKERS} \
56+
--info \
57+
2>&1 | tee "out-$ref.log"
58+
59+
echo ""
60+
61+
done

0 commit comments

Comments
 (0)