Skip to content

Commit 06af4a1

Browse files
committed
feat: Add time & spacetracking stages
1 parent 8aa108e commit 06af4a1

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

action.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ runs:
5353
steps:
5454
- shell: bash
5555
run: |
56-
56+
declare -A times_mapping
57+
declare -A saved_mapping
5758
# ======
5859
# MACROS
5960
# ======
@@ -194,6 +195,8 @@ runs:
194195
SAVED=$((AFTER-BEFORE))
195196
STAGE_STOP_TIME=$(date +%s)
196197
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
198+
times_mapping["mandb"]="${STAGE_ELAPSE_TIME}"
199+
saved_mapping["mandb"]="$(formatByteCount $SAVED)"
197200
printSavedSpace $SAVED "man page indexing intial removals and disabling" ${STAGE_ELAPSE_TIME}
198201
fi
199202
@@ -210,6 +213,8 @@ runs:
210213
SAVED=$((AFTER-BEFORE))
211214
STAGE_STOP_TIME=$(date +%s)
212215
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
216+
times_mapping["android"]="${STAGE_ELAPSE_TIME}"
217+
saved_mapping["android"]="$(formatByteCount $SAVED)"
213218
printSavedSpace $SAVED "Android library" ${STAGE_ELAPSE_TIME}
214219
fi
215220
@@ -226,6 +231,8 @@ runs:
226231
SAVED=$((AFTER-BEFORE))
227232
STAGE_STOP_TIME=$(date +%s)
228233
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
234+
times_mapping["dotnet"]="${STAGE_ELAPSE_TIME}"
235+
saved_mapping["dotnet"]="$(formatByteCount $SAVED)"
229236
printSavedSpace $SAVED ".NET runtime" ${STAGE_ELAPSE_TIME}
230237
fi
231238
@@ -242,6 +249,8 @@ runs:
242249
SAVED=$((AFTER-BEFORE))
243250
STAGE_STOP_TIME=$(date +%s)
244251
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
252+
times_mapping["haskell"]="${STAGE_ELAPSE_TIME}"
253+
saved_mapping["haskell"]="$(formatByteCount $SAVED)"
245254
printSavedSpace $SAVED "Haskell runtime" ${STAGE_ELAPSE_TIME}
246255
fi
247256
@@ -268,6 +277,8 @@ runs:
268277
SAVED=$((AFTER-BEFORE))
269278
STAGE_STOP_TIME=$(date +%s)
270279
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
280+
times_mapping["large-packages"]="${STAGE_ELAPSE_TIME}"
281+
saved_mapping["large-packages"]="$(formatByteCount $SAVED)"
271282
printSavedSpace $SAVED "Large misc. packages" ${STAGE_ELAPSE_TIME}
272283
fi
273284
@@ -283,6 +294,8 @@ runs:
283294
SAVED=$((AFTER-BEFORE))
284295
STAGE_STOP_TIME=$(date +%s)
285296
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
297+
times_mapping["docker-images"]="${STAGE_ELAPSE_TIME}"
298+
saved_mapping["docker-images"]="$(formatByteCount $SAVED)"
286299
printSavedSpace $SAVED "Docker images" ${STAGE_ELAPSE_TIME}
287300
fi
288301
@@ -299,6 +312,8 @@ runs:
299312
SAVED=$((AFTER-BEFORE))
300313
STAGE_STOP_TIME=$(date +%s)
301314
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
315+
times_mapping["tool-cache"]="${STAGE_ELAPSE_TIME}"
316+
saved_mapping["tool-cache"]="$(formatByteCount $SAVED)"
302317
printSavedSpace $SAVED "Tool cache" ${STAGE_ELAPSE_TIME}
303318
fi
304319
@@ -316,6 +331,8 @@ runs:
316331
SAVED=$((AFTER-BEFORE))
317332
STAGE_STOP_TIME=$(date +%s)
318333
STAGE_ELAPSE_TIME=$((STAGE_STOP_TIME - STAGE_START_TIME))
334+
times_mapping["swap-storage"]="${STAGE_ELAPSE_TIME}"
335+
saved_mapping["swap-storage"]="$(formatByteCount $SAVED)"
319336
printSavedSpace $SAVED "Swap storage" ${STAGE_ELAPSE_TIME}
320337
fi
321338
@@ -334,4 +351,16 @@ runs:
334351
echo ""
335352
336353
printSavedSpace $((AVAILABLE_ROOT_END - AVAILABLE_ROOT_INITIAL)) "/dev/root:" $((GLOBAL_STOP_TIME - GLOBAL_START_TIME))
354+
times_mapping["root"]="$((GLOBAL_STOP_TIME - GLOBAL_START_TIME))"
355+
saved_mapping["root"]="$(formatByteCount $((AVAILABLE_ROOT_END - AVAILABLE_ROOT_INITIAL)) )"
337356
printSavedSpace $((AVAILABLE_END - AVAILABLE_INITIAL)) "Overall:" $((GLOBAL_STOP_TIME - GLOBAL_START_TIME))
357+
times_mapping["overall"]="$((GLOBAL_STOP_TIME - GLOBAL_START_TIME))"
358+
saved_mapping["overall"]="$(formatByteCount $((AVAILABLE_END - AVAILABLE_INITIAL)) )"
359+
360+
# Iterate over keys
361+
echo "TIME_REPORT: ================================================================================"
362+
printf "TIME_REPORT: %15s | %-10s seconds |\n" "subsection" "time"
363+
for subsection in "${!times_mapping[@]}"; do
364+
printf "TIME_REPORT: %15s | %-10s seconds | %-12s |\n" "${subsection}" "${times_mapping[$subsection]}" "${saved_mapping[$subsection]}"
365+
done
366+
echo "TIME_REPORT: ================================================================================"

0 commit comments

Comments
 (0)