From 64fe18779bd6edf2f71e6be55d4d03cec20e4bce Mon Sep 17 00:00:00 2001 From: Federico Di Pierro Date: Thu, 25 Jul 2024 09:58:27 +0200 Subject: [PATCH] chore(ci): run capture-related perf CI on tmpfs. Signed-off-by: Federico Di Pierro --- .github/actions/composite-perf/action.yml | 10 ++++++++-- .github/workflows/perf.yml | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/actions/composite-perf/action.yml b/.github/actions/composite-perf/action.yml index 60a94ba77f..23607557cb 100644 --- a/.github/actions/composite-perf/action.yml +++ b/.github/actions/composite-perf/action.yml @@ -38,6 +38,8 @@ runs: cd build wget https://download.falco.org/fixtures/trace-files/traces-positive.zip unzip traces-positive.zip + mkdir -p /dev/shm/libs-${{ github.run_id }} + mv traces-positive/falco-event-generator.scap /dev/shm/libs-${{ github.run_id }}/falco-event-generator.scap - name: Run - perf unit tests shell: bash @@ -49,7 +51,7 @@ runs: shell: bash run: | cd build - sudo nice ionice -c 1 -n 0 perf record --call-graph dwarf -o perf_scap.data -q ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap + sudo nice ionice -c 1 -n 0 perf record --call-graph dwarf -o perf_scap.data -q ./libsinsp/examples/sinsp-example -s /dev/shm/libs-${{ github.run_id }}/falco-event-generator.scap - name: Run - heaptrack unit tests shell: bash @@ -61,7 +63,11 @@ runs: shell: bash run: | cd build - sudo nice ionice -c 1 -n 0 heaptrack -o heaptrack_scap.data ./libsinsp/examples/sinsp-example -s traces-positive/falco-event-generator.scap + sudo nice ionice -c 1 -n 0 heaptrack -o heaptrack_scap.data ./libsinsp/examples/sinsp-example -s /dev/shm/libs-${{ github.run_id }}/falco-event-generator.scap + + - name: Cleanup tmpfs + shell: bash + run: rm -rf /dev/shm/libs-${{ github.run_id }}/ - name: Set Outputs id: store-outputs diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index 92b7342570..d52b861978 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -67,12 +67,12 @@ jobs: echo "" >> ./pr/COMMENT echo "# Heap diff from master - unit tests" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT - tail -n6 "heaptrack_tests_diff.txt" >> ./pr/COMMENT + tail -n3 "heaptrack_tests_diff.txt" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT echo "" >> ./pr/COMMENT echo "# Heap diff from master - scap file" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT - tail -n6 "heaptrack_scap_diff.txt" >> ./pr/COMMENT + tail -n3 "heaptrack_scap_diff.txt" >> ./pr/COMMENT echo "\`\`\`" >> ./pr/COMMENT echo Uploading PR info... cat ./pr/COMMENT @@ -111,11 +111,11 @@ jobs: - name: Check >= 1M threshold or new leaked mem - heaptrack unit tests if: always() # Even if other threshold checks failed run: | - tail -n 6 heaptrack_tests_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_tests_diff_above_thresh.txt + tail -n 3 heaptrack_tests_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_tests_diff_above_thresh.txt if [ -s heaptrack_tests_diff_above_thresh.txt ]; then exit 1 fi - tail -n 6 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt + tail -n 3 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt if [ -s heaptrack_scap_diff_above_thresh.txt ]; then exit 2 fi @@ -125,11 +125,11 @@ jobs: - name: Check >= 1M threshold or new leaked mem - heaptrack scap file if: always() # Even if other threshold checks failed run: | - tail -n 6 heaptrack_scap_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_scap_diff_above_thresh.txt + tail -n 3 heaptrack_scap_diff.txt | grep "peak heap memory consumption" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 >= 1048576) print }' &> heaptrack_scap_diff_above_thresh.txt if [ -s heaptrack_scap_diff_above_thresh.txt ]; then exit 1 fi - tail -n 6 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt + tail -n 3 heaptrack_scap_diff.txt | grep "total memory leaked" | awk -F': ' '{print $2 }' | tr '.' ',' | numfmt --from=iec | awk '{if (substr($1,RSTART+RLENGTH)+0 > 0) print }' &> heaptrack_scap_diff_above_thresh.txt if [ -s heaptrack_scap_diff_above_thresh.txt ]; then exit 2 fi