Skip to content

Commit 71e5222

Browse files
committed
collect system info for performance tests
1 parent ba4327c commit 71e5222

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
chrome-version: "132.0.6834.110"
5151
- attach_workspace:
5252
at: ~/
53+
- run:
54+
command: node system-info > ~/Downloads/system_info.txt
5355
- run:
5456
name: Run performance tests
5557
command: .circleci/test.sh performance-jasmine

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"test-syntax": "node tasks/test_syntax.js && npm run find-strings -- --no-output",
4949
"test-bundle": "node tasks/test_bundle.js",
5050
"test-performance": "node tasks/test_performance.js",
51+
"system-info": "node tasks/system_info.js",
5152
"test-plain-obj": "node tasks/test_plain_obj.mjs",
5253
"test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint",
5354
"b64": "python3 test/image/generate_b64_mocks.py && node devtools/test_dashboard/server.mjs",

tasks/system_info.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
var os = require('os');
2+
3+
var logs = [];
4+
function addLog(str) {
5+
logs.push(str)
6+
}
7+
8+
var systemInfo = {
9+
platform: os.platform(),
10+
type: os.type(),
11+
arch: os.arch(),
12+
release: os.release(),
13+
version: os.version ? os.version() : 'Unknown',
14+
hostname: os.hostname(),
15+
homedir: os.homedir(),
16+
tmpdir: os.tmpdir(),
17+
endianness: os.endianness(),
18+
};
19+
20+
addLog('💻 SYSTEM:');
21+
addLog(` Platform: ${systemInfo.platform}`);
22+
addLog(` Type: ${systemInfo.type}`);
23+
addLog(` Architecture: ${systemInfo.arch}`);
24+
addLog(` Release: ${systemInfo.release}`);
25+
addLog(` Hostname: ${systemInfo.hostname}`);
26+
27+
28+
var cpus = os.cpus();
29+
var loadAvg = os.loadavg();
30+
31+
var cpuInfo = {
32+
model: cpus[0].model,
33+
speed: cpus[0].speed,
34+
cores: cpus.length,
35+
loadAverage: loadAvg,
36+
cpuDetails: cpus
37+
};
38+
39+
addLog('');
40+
addLog('🔧 CPU:');
41+
addLog(` Model: ${cpuInfo.model}`);
42+
addLog(` Speed: ${cpuInfo.speed} MHz`);
43+
addLog(` Cores: ${cpuInfo.cores}${cpuInfo.physicalCores ? ` (${cpuInfo.physicalCores} physical)` : ''}`);
44+
addLog(` Load Average: ${loadAvg.map(load => load.toFixed(2)).join(', ')}`);
45+
46+
47+
var totalMem = os.totalmem();
48+
var freeMem = os.freemem();
49+
var usedMem = totalMem - freeMem;
50+
51+
var memoryInfo = {
52+
total: totalMem,
53+
free: freeMem,
54+
used: usedMem,
55+
usagePercent: (usedMem / totalMem) * 100
56+
};
57+
58+
function formatBytes(bytes, decimals = 2) {
59+
if (bytes === 0) return '0 Bytes';
60+
if (!bytes) return 'Unknown';
61+
62+
var k = 1024;
63+
var dm = decimals < 0 ? 0 : decimals;
64+
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
65+
var i = Math.floor(Math.log(bytes) / Math.log(k));
66+
67+
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
68+
}
69+
70+
addLog('');
71+
addLog('💾 MEMORY:');
72+
addLog(` Total: ${formatBytes(memoryInfo.total)}`);
73+
addLog(` Used: ${formatBytes(memoryInfo.used)} (${memoryInfo.usagePercent.toFixed(1)}%)`);
74+
addLog(` Free: ${formatBytes(memoryInfo.free)}`);
75+
76+
77+
console.log(logs.join('\n'));

0 commit comments

Comments
 (0)