Skip to content

Commit 99e17fd

Browse files
committed
fix: ci run benchmark exit code
1 parent 5d8c6b1 commit 99e17fd

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ci/monitor_memory.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ echo "Timestamp,Used_MB,Free_MB,Total_MB" > "$OUTPUT_FILE"
2727
# Function to get system memory usage based on OS
2828
get_memory_usage() {
2929
TIMESTAMP=$(date +%s)
30-
30+
3131
if [[ "$OS" == "macos" ]]; then
3232
# macOS memory stats using vm_stat
3333
VM_STAT=$(vm_stat)
3434
PAGE_SIZE=$(sysctl -n hw.pagesize)
3535
TOTAL_MEM=$(sysctl -n hw.memsize)
3636
TOTAL_MB=$(echo "scale=2; $TOTAL_MEM / 1048576" | bc)
37-
37+
3838
PAGE_FREE=$(echo "$VM_STAT" | grep "Pages free:" | awk '{print $3}' | sed 's/\.//')
3939
PAGE_ACTIVE=$(echo "$VM_STAT" | grep "Pages active:" | awk '{print $3}' | sed 's/\.//')
4040
PAGE_INACTIVE=$(echo "$VM_STAT" | grep "Pages inactive:" | awk '{print $3}' | sed 's/\.//')
4141
PAGE_SPECULATIVE=$(echo "$VM_STAT" | grep "Pages speculative:" | awk '{print $3}' | sed 's/\.//')
4242
PAGE_WIRED=$(echo "$VM_STAT" | grep "Pages wired down:" | awk '{print $4}' | sed 's/\.//')
43-
43+
4444
USED_PAGES=$(($PAGE_ACTIVE + $PAGE_WIRED))
4545
USED_MB=$(echo "scale=2; ($USED_PAGES * $PAGE_SIZE) / 1048576" | bc)
46-
46+
4747
FREE_PAGES=$(($PAGE_FREE + $PAGE_INACTIVE + $PAGE_SPECULATIVE))
4848
FREE_MB=$(echo "scale=2; ($FREE_PAGES * $PAGE_SIZE) / 1048576" | bc)
4949
else
@@ -53,7 +53,7 @@ get_memory_usage() {
5353
USED_MB=$(echo "$MEM_INFO" | awk '{print $3}')
5454
FREE_MB=$(echo "$MEM_INFO" | awk '{print $4}')
5555
fi
56-
56+
5757
echo "$TIMESTAMP,$USED_MB,$FREE_MB,$TOTAL_MB" >> "$OUTPUT_FILE"
5858
}
5959

@@ -98,7 +98,7 @@ stats "${OUTPUT_FILE}" skip 1 using 1 prefix "ts_" nooutput
9898
if (ts_records > 0) {
9999
# Calculate the starting timestamp to use as time zero
100100
first_ts = ts_min
101-
101+
102102
# Plot the data with relative time
103103
plot "${OUTPUT_FILE}" using (\$1-first_ts):2 with lines lw 2 title "Used Memory", \\
104104
"${OUTPUT_FILE}" using (\$1-first_ts):3 with lines lw 2 title "Free Memory"
@@ -115,4 +115,6 @@ rm plot_script.gnu
115115

116116
echo "Memory usage graph saved as memory_usage.png"
117117
echo "Raw data saved as $OUTPUT_FILE"
118-
echo "Script exited with code $SCRIPT_EXIT_CODE"
118+
echo "Script exited with code $SCRIPT_EXIT_CODE"
119+
120+
exit $SCRIPT_EXIT_CODE

0 commit comments

Comments
 (0)