Sharkey/src/utils/machineInfo.ts

14 lines
433 B
TypeScript
Raw Normal View History

2016-12-30 20:19:59 +02:00
import * as os from 'os';
import Logger from './logger';
export default class MachineInfo {
2016-12-30 20:36:22 +02:00
static show(): void {
2016-12-30 20:19:59 +02:00
const totalmem = (os.totalmem() / 1024 / 1024 / 1024).toFixed(1);
const freemem = (os.freemem() / 1024 / 1024 / 1024).toFixed(1);
let logger = new Logger('Machine');
logger.info(os.hostname());
logger.info(`CPU: ${os.cpus().length}core`);
logger.info(`MEM: ${totalmem}GB (available: ${freemem}GB)`);
}
}