Skip to content

Commit dce7887

Browse files
authored
CI: Add cpu / memory usage raw logs (#29395)
1 parent 9ca3757 commit dce7887

File tree

7 files changed

+71
-5
lines changed

7 files changed

+71
-5
lines changed

.github/actions/run-qunit-tests/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ runs:
128128
DISPLAY: ":99"
129129
CHROME_CMD: ${{ env.CHROME_SHELL }}
130130
run: |
131+
node ../../tools/scripts/performance_log.js &
131132
chmod +x ./docker-ci.sh
132133
./docker-ci.sh
133134

.github/workflows/demos_visual_tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ jobs:
4141
run: npm install --no-audit --no-fund
4242

4343
- name: DevExtreme - Build
44-
run: npx nx build devextreme-main
44+
shell: bash
45+
run: |
46+
node ./tools/scripts/performance_log.js &
47+
npx nx build devextreme-main
4548
4649
testcafe:
4750
needs:
@@ -111,7 +114,9 @@ jobs:
111114
# DISABLE_DEMO_TEST_SETTINGS: ignore # Uncomment to ignore the `ignore` field
112115
# DISABLE_DEMO_TEST_SETTINGS: comparison-options # Uncomment to ignore the `comparison-options` field
113116
CI_ENV: true # The `ignore` field in the visualtestrc.json should be disabled when running test locally
114-
run: npx nx test-testcafe
117+
run: |
118+
node ../../tools/scripts/performance_log.js &
119+
npx nx test-testcafe
115120
116121
- name: Show accessibility warnings
117122
if: matrix.STRATEGY == 'accessibility'

.github/workflows/demos_visual_tests_frameworks.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ jobs:
369369

370370
- name: Run TestCafe tests
371371
working-directory: apps/demos
372+
shell: bash
372373
env:
373374
CHANGEDFILEINFOSPATH: changed-files.json
374375
BROWSERS: chrome:headless --disable-partial-raster --disable-skia-runtime-opts --run-all-compositor-stages-before-draw --disable-new-content-rendering-timeout --disable-threaded-animation --disable-threaded-scrolling --disable-checker-imaging --disable-image-animation-resync --use-gl="swiftshader" --disable-features=PaintHolding --js-flags=--random-seed=2147483647 --font-render-hinting=none --disable-font-subpixel-positioning
@@ -381,7 +382,9 @@ jobs:
381382
# DISABLE_DEMO_TEST_SETTINGS: ignore # Uncomment to ignore the `ignore` field
382383
# DISABLE_DEMO_TEST_SETTINGS: comparison-options # Uncomment to ignore the `comparison-options` field
383384
CI_ENV: true # The `ignore` field in the visualtestrc.json should be disabled when running test locally
384-
run: npx nx test-testcafe
385+
run: |
386+
node ../../tools/scripts/performance_log.js &
387+
npx nx test-testcafe
385388
386389
- name: Sanitize job name
387390
if: ${{ failure() }}

.github/workflows/qunit_tests-additional-renovation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
4646
working-directory: ./packages/devextreme
4747
run: |
48+
node ../../tools/scripts/performance_log.js &
4849
npx nx build:dev
4950
npx nx build:systemjs
5051

.github/workflows/qunit_tests-renovation.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ jobs:
4040

4141
- name: Build
4242
working-directory: ./packages/devextreme
43+
shell: bash
4344
env:
4445
DEVEXTREME_TEST_CI: "true"
4546
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
4647
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
4748
BUILD_INPROGRESS_RENOVATION: "true"
48-
run: npx nx build:dev
49+
run: |
50+
node ../../tools/scripts/performance_log.js &
51+
npx nx build:dev
4952
5053
- name: Zip artifacts
5154
working-directory: ./packages/devextreme

.github/workflows/testcafe_tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ jobs:
4343
run: npm install --no-audit --no-fund
4444

4545
- name: Build
46-
run: npx nx build devextreme-main
46+
shell: bash
47+
run: |
48+
node ./tools/scripts/performance_log.js &
49+
npx nx build devextreme-main
4750
4851
- name: Zip artifacts
4952
working-directory: ./packages/devextreme
@@ -192,6 +195,7 @@ jobs:
192195
[ "${{ matrix.ARGS.platform }}" != "" ] && PLATFORM="--platform ${{ matrix.ARGS.platform }}"
193196
all_args="--browsers=chrome:devextreme-shr2 --componentFolder ${{ matrix.ARGS.componentFolder }} $CONCURRENCY $INDICES $PLATFORM $THEME"
194197
echo "$all_args"
198+
node ../../tools/scripts/performance_log.js &
195199
npx nx test $all_args
196200
197201
- name: Sanitize job name

tools/scripts/performance_log.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// NOTE: This is a temporary script to check the runner CPU / memory usage
2+
/* eslint-disable spellcheck/spell-checker, no-console */
3+
const os = require('os');
4+
5+
const BYTES_IN_MB = 1024 * 1024;
6+
const INTERVAL_MS = 10000;
7+
8+
const printCpuUsage = () => {
9+
const cpus = os.cpus();
10+
cpus.forEach((cpu, idx) => {
11+
let total = 0;
12+
const data = [];
13+
14+
for(const type in cpu.times) {
15+
total += cpu.times[type];
16+
}
17+
18+
console.info(`--- CPU ${idx} ---`);
19+
for(const type in cpu.times) {
20+
data.push(`${type}: ${Math.round(100 * cpu.times[type] / total)}`);
21+
}
22+
23+
console.log(data.join(' | '));
24+
});
25+
};
26+
27+
const printMemoryUsage = () => {
28+
const totalMemory = os.totalmem() / BYTES_IN_MB;
29+
const freeMemory = os.freemem() / BYTES_IN_MB;
30+
const usedMemory = totalMemory - freeMemory;
31+
const roundedTotalMemory = Math.round(totalMemory * 100) / 100;
32+
const roundedUsedMemory = Math.round(usedMemory * 100) / 100;
33+
const memoryUsagePercents = (roundedUsedMemory * 100) / roundedTotalMemory;
34+
const memoryUsagePercentsRounded = Math.round(memoryUsagePercents * 100) / 100;
35+
36+
console.info(`--- Memory ---\nUsed: ${memoryUsagePercentsRounded}%`);
37+
};
38+
39+
const printPerformanceLog = () => {
40+
console.log('===== PERFORMANCE_LOG =====');
41+
printCpuUsage();
42+
printMemoryUsage();
43+
console.log('===========================');
44+
};
45+
46+
printPerformanceLog();
47+
setInterval(() => {
48+
printPerformanceLog();
49+
}, INTERVAL_MS);

0 commit comments

Comments
 (0)