Skip to content

Commit 8fb8fe3

Browse files
authored
chronos: Some fixes. (#12995)
- Improve logging to make it easier to derive log-based metrics on GCP. - Compare compile times between replay and ccache and pick the better one.
1 parent 9efdcf3 commit 8fb8fe3

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

infra/experimental/chronos/build_cache_local.sh

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,16 @@ REPLAY_WORKED=
9797
# If this step is successful, then the process can exit as it's ready.
9898
if [[ "$executables_replay" == "$executables_vanilla" ]]
9999
then
100-
echo "Replay worked"
101-
echo "Vanilla compile time: ${B_TIME}"
102-
echo "Replay compile time: ${R_TIME}"
103-
104100
REPLAY_WORKED=1
105101

106102
if [ -z "${RUN_ALL+1}" ]; then
103+
echo "${_PROJECT}: Replay worked."
104+
echo "${_PROJECT}: Compile times: Vanilla=${B_TIME}; Replay=${R_TIME};"
107105
exit 0
108106
fi
109107
else
110-
echo "Replay did not work"
108+
echo "${_PROJECT}: Replay did not work"
109+
R_TIME="N/A"
111110
fi
112111

113112
# Step 8: prepare Dockerfile for ccache
@@ -145,25 +144,22 @@ executables_ccache="$(find ./build/out/${_PROJECT}/ -executable -type f | sort)"
145144
# Step 12: validate the ccache builds are successful
146145
if [[ "$executables_ccache" == "$executables_vanilla" ]]
147146
then
148-
echo "Vanilla compile time: ${B_TIME}"
149-
if [[ "$executables_replay" == "$executables_vanilla" ]]
150-
then
151-
echo "Replay worked"
152-
echo "Replay compile time: ${R_TIME}"
153-
fi
147+
echo "${_PROJECT}: Compile times: Vanilla=${B_TIME}; Replay=${R_TIME}; CCache=${A_TIME};"
154148

155-
echo "Ccache compile time: ${A_TIME}"
149+
if [[ -z "${REPLAY_WORKED}" || ${R_TIME} -gt ${A_TIME} ]]; then
150+
if [ ${R_TIME} -gt ${A_TIME} ]; then
151+
echo "Replay was slower than ccache."
152+
fi
156153

157-
if [ -z "${REPLAY_WORKED}" ]; then
158-
# Replay didn't work, so make the default "cached" image use the ccache one.
154+
# Replay didn't work or was slower, so make the default "cached" image use the ccache one.
159155
docker image tag \
160156
$CCACHE_IMAGE_NAME \
161157
$FINAL_IMAGE_NAME
162158
fi
163159

164160
exit 0
165161
else
166-
echo "Replay and ccaching did not work."
162+
echo "${_PROJECT}: Replay and ccaching did not work."
167163
exit 1
168164
fi
169165

0 commit comments

Comments
 (0)