Skip to content

Commit 1941d33

Browse files
authored
CI: Add cpu / memory usage raw logs (DevExpress#29394)
1 parent b8b6e46 commit 1941d33

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
@@ -141,6 +141,7 @@ runs:
141141
DISPLAY: ":99"
142142
CHROME_CMD: ${{ env.CHROME_SHELL }}
143143
run: |
144+
node ../../tools/scripts/performance_log.js &
144145
chmod +x ./docker-ci.sh
145146
./docker-ci.sh
146147

.github/workflows/demos_visual_tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ jobs:
5757
run: pnpm install
5858

5959
- name: DevExtreme - Build
60-
run: pnpx nx build devextreme
60+
shell: bash
61+
run: |
62+
node ./tools/scripts/performance_log.js &
63+
pnpx nx build devextreme
6164
6265
testcafe:
6366
needs:
@@ -138,7 +141,9 @@ jobs:
138141
# DISABLE_DEMO_TEST_SETTINGS: ignore # Uncomment to ignore the `ignore` field
139142
# DISABLE_DEMO_TEST_SETTINGS: comparison-options # Uncomment to ignore the `comparison-options` field
140143
CI_ENV: true # The `ignore` field in the visualtestrc.json should be disabled when running test locally
141-
run: pnpx nx test-testcafe
144+
run: |
145+
node ../../tools/scripts/performance_log.js &
146+
pnpx nx test-testcafe
142147
143148
- name: Show accessibility warnings
144149
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
@@ -438,6 +438,7 @@ jobs:
438438
python -m http.server 8083 &
439439
440440
- name: Run TestCafe tests
441+
shell: bash
441442
working-directory: apps/demos
442443
env:
443444
CHANGEDFILEINFOSPATH: changed-files.json
@@ -451,7 +452,9 @@ jobs:
451452
# DISABLE_DEMO_TEST_SETTINGS: ignore # Uncomment to ignore the `ignore` field
452453
# DISABLE_DEMO_TEST_SETTINGS: comparison-options # Uncomment to ignore the `comparison-options` field
453454
CI_ENV: true # The `ignore` field in the visualtestrc.json should be disabled when running test locally
454-
run: pnpx nx test-testcafe
455+
run: |
456+
node ../../tools/scripts/performance_log.js &
457+
pnpx nx test-testcafe
455458
456459
- name: Sanitize job name
457460
if: ${{ failure() }}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
6161
working-directory: ./packages/devextreme
6262
run: |
63+
node ../../tools/scripts/performance_log.js &
6364
pnpx nx build:dev
6465
pnpx nx build:systemjs
6566

.github/workflows/qunit_tests-renovation.yml

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

5656
- name: Build
5757
working-directory: ./packages/devextreme
58+
shell: bash
5859
env:
5960
DEVEXTREME_TEST_CI: "true"
6061
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
6162
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: "true"
6263
BUILD_INPROGRESS_RENOVATION: "true"
63-
run: pnpx nx build:dev
64+
run: |
65+
node ../../tools/scripts/performance_log.js &
66+
pnpx nx build:dev
6467
6568
- name: Zip artifacts
6669
working-directory: ./packages/devextreme

.github/workflows/testcafe_tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ jobs:
5858
run: pnpm install
5959

6060
- name: Build
61-
run: pnpx nx build devextreme
61+
shell: bash
62+
run: |
63+
node ./tools/scripts/performance_log.js &
64+
pnpx nx build devextreme
6265
6366
- name: Zip artifacts
6467
working-directory: ./packages/devextreme
@@ -232,6 +235,7 @@ jobs:
232235
[ "${{ matrix.ARGS.platform }}" != "" ] && PLATFORM="--platform ${{ matrix.ARGS.platform }}"
233236
all_args="--browsers=chrome:devextreme-shr2 --componentFolder ${{ matrix.ARGS.componentFolder }} $CONCURRENCY $INDICES $PLATFORM $THEME"
234237
echo "$all_args"
238+
node ../../tools/scripts/performance_log.js &
235239
pnpm run test $all_args
236240
237241
- 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)