Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit d2332da

Browse files
fix: correct consumed resource table (#869)
1 parent 48a65f3 commit d2332da

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cortex-js/src/infrastructure/commanders/ps.command.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class PSCommand extends CommandRunner {
3535
checkingSpinner.succeed(isOnline ? 'API server is online' : 'API server is offline');
3636
})
3737
.then(async () => {
38-
const table = [];
3938
const cpuUsage = (await systeminformation.currentLoad()).currentLoad.toFixed(2);
4039
const gpusLoad = [];
4140
const gpus = await systeminformation.graphics();
@@ -47,16 +46,19 @@ export class PSCommand extends CommandRunner {
4746
}
4847
const memoryData = await systeminformation.mem();
4948
const memoryUsage = (memoryData.active / memoryData.total * 100).toFixed(2)
50-
table.push({
49+
const consumedTable = {
5150
'CPU Usage': `${cpuUsage}%`,
5251
'Memory Usage': `${memoryUsage}%`,
53-
});
52+
} as {
53+
'CPU Usage': string,
54+
'Memory Usage': string,
55+
'VRAM'?: string,
56+
}
57+
5458
if(gpusLoad.length > 0 && gpusLoad.filter(gpu => gpu.totalVram > 0).length > 0) {
55-
table.push({
56-
'VRAM': gpusLoad,
57-
});
59+
consumedTable['VRAM'] = gpusLoad.map(gpu => `${gpu.totalVram} MB`).join(', ');
5860
}
59-
console.table(table);
61+
console.table([consumedTable]);
6062
})
6163
}
6264
}

0 commit comments

Comments
 (0)