-
Notifications
You must be signed in to change notification settings - Fork 107
240 lines (210 loc) · 8.95 KB
/
Copy pathperformance.yml
File metadata and controls
240 lines (210 loc) · 8.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Weekly Performance
on:
push:
branches:
- develop
workflow_dispatch:
inputs:
name:
description: "Manual trigger"
schedule:
- cron: '12 13 * * 0'
permissions:
contents: write
jobs:
performance:
name: Performance
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install CMake and prerequisites
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl python3-pip valgrind
python3 -m pip install --upgrade pip
python3 -m pip install msparser
# CMake 3.31.8
CMAKE_VER=3.31.8
curl -L "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz" -o cmake-${CMAKE_VER}.tgz
sudo tar -C /opt -xzf cmake-${CMAKE_VER}.tgz
echo "/opt/cmake-${CMAKE_VER}-linux-x86_64/bin" >> "$GITHUB_PATH"
- name: Run tests
shell: bash
run: |
./test/memory/memory_test.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: performance-results
path: |
build/complete_profile.csv
build/core_profile.csv
build/stack.csv
build/profiles_bss.csv
build/profiles_data.csv
build/profiles_text.csv
if-no-files-found: error
save-metrics-and-plots:
name: Save Metrics and Generate Plots
runs-on: ubuntu-24.04
needs: performance
steps:
- name: Set branch name
run: echo "BR=memory/performance" >> $GITHUB_ENV # Use this branch to store performance results
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: ${{ env.BR }}
- name: Install Python and prerequisites
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
python3 -m pip install --upgrade pip
python3 -m pip install matplotlib
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: performance-results
path: results
- name: Save results into memory
shell: bash
run: |
set -euxo pipefail
git config user.name "github-actions"
git config user.email "github-actions@github.com"
python3 ci/metrics/save_results.py \
--input results/complete_profile.csv \
--output ci/metrics/memory/complete_profile_timeseries.csv
python3 ci/metrics/save_results.py \
--input results/core_profile.csv \
--output ci/metrics/memory/core_profile_timeseries.csv
python3 ci/metrics/save_results.py \
--input results/stack.csv \
--output ci/metrics/memory/stack_timeseries.csv
python3 ci/metrics/save_results.py \
--input results/profiles_bss.csv \
--output ci/metrics/memory/profiles_bss_timeseries.csv
python3 ci/metrics/save_results.py \
--input results/profiles_data.csv \
--output ci/metrics/memory/profiles_data_timeseries.csv
python3 ci/metrics/save_results.py \
--input results/profiles_text.csv \
--output ci/metrics/memory/profiles_text_timeseries.csv
git add ci/metrics/memory/*_timeseries.csv
git diff --cached --quiet || git commit -m "metrics: append run ${GITHUB_RUN_NUMBER} (${GITHUB_SHA::8})"
git push origin "${{ env.BR }}"
- name: Generate plots
shell: bash
run: |
set -euxo pipefail
LAST_N=52
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/complete_profile_timeseries.csv \
--output ci/metrics/plots/complete_profile_plot.svg \
--title "Complete Profile" \
--ylabel "Bytes" \
--last "$LAST_N"
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/core_profile_timeseries.csv \
--output ci/metrics/plots/core_profile_plot.svg \
--title "Core Profile" \
--ylabel "Bytes" \
--last "$LAST_N"
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/stack_timeseries.csv \
--output ci/metrics/plots/stack_plot.svg \
--title "Simple App Stack Usage" \
--ylabel "Bytes" \
--last "$LAST_N"
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/profiles_bss_timeseries.csv \
--output ci/metrics/plots/profiles_bss_plot.svg \
--title "Increase of .bss memory by enabling profiles" \
--ylabel "Bytes" \
--last "$LAST_N"
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/profiles_data_timeseries.csv \
--output ci/metrics/plots/profiles_data_plot.svg \
--title "Increase of .data memory by enabling profiles" \
--ylabel "Bytes" \
--last "$LAST_N"
python3 ci/metrics/generate_plot.py \
--input ci/metrics/memory/profiles_text_timeseries.csv \
--output ci/metrics/plots/profiles_text_plot.svg \
--title "Increase of .text memory by enabling profiles" \
--ylabel "Bytes" \
--last "$LAST_N"
git add ci/metrics/plots/*.svg
git diff --cached --quiet || git commit -m "metrics: update plots (${GITHUB_RUN_NUMBER})"
git push origin "${{ env.BR }}"
- name: Upload plots
uses: actions/upload-artifact@v4
with:
name: performance-plots
path: ci/metrics/plots/*.svg
if-no-files-found: warn
- name: Add plots to summary
if: always()
shell: bash
run: |
set -euo pipefail
BASE="https://raw.githubusercontent.com/${GITHUB_REPOSITORY}/memory/performance/ci/metrics/plots"
CB="?r=${GITHUB_RUN_NUMBER}"
{
echo "## 📊 Performance Metrics (last 52 runs)"
echo
echo "The workflow triggering this run can be found in the default branch."
echo "The python scripts and the data used to generate these plots can be found in the [memory/performance](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/memory/performance) branch."
echo "The scripts and data can be modified without affecting develop nor master branches."
echo "The \`memory/performance\` branch is unprotected and can be pushed to in case any manual modifications are needed."
echo
echo "### Complete Profile"
echo "<img src=\"${BASE}/complete_profile_plot.svg${CB}\" alt=\"Complete Profile\" width=\"720\"/>"
echo
echo "### Core Profile"
echo "<img src=\"${BASE}/core_profile_plot.svg${CB}\" alt=\"Core Profile\" width=\"720\"/>"
echo
echo "### Simple App Stack Usage"
echo "<img src=\"${BASE}/stack_plot.svg${CB}\" alt=\"Stack\" width=\"720\"/>"
echo
echo "### Increase of .bss memory by enabling profiles"
echo "<img src=\"${BASE}/profiles_bss_plot.svg${CB}\" alt=\"bss\" width=\"720\"/>"
echo
echo "### Increase of .data memory by enabling profiles"
echo "<img src=\"${BASE}/profiles_data_plot.svg${CB}\" alt=\"data\" width=\"720\"/>"
echo
echo "### Increase of .text memory by enabling profiles"
echo "<img src=\"${BASE}/profiles_text_plot.svg${CB}\" alt=\"text\" width=\"720\"/>"
} >> "$GITHUB_STEP_SUMMARY"
analyze-metrics:
name: Analyze Metrics
runs-on: ubuntu-24.04
needs: save-metrics-and-plots
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
ref: memory/performance
- name: Analyze results
shell: bash
run: |
set -euo pipefail
{
echo "## Analyze Memory Metrics"
echo
echo "⚠️ Failure of this job should be treated as a warning. It can be safely ignored if there are intentional changes that affect memory usage."
} >> "$GITHUB_STEP_SUMMARY"
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/complete_profile_timeseries.csv
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/core_profile_timeseries.csv
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/stack_timeseries.csv
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_bss_timeseries.csv
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_data_timeseries.csv
python3 ci/metrics/check_last_result.py --input ci/metrics/memory/profiles_text_timeseries.csv