Extract MachineInfo

This commit is contained in:
Aya Morisawa
2016-12-31 03:19:59 +09:00
parent 2fd6ddf8ee
commit 7e4091c779
2 changed files with 15 additions and 8 deletions

13
src/utils/machineInfo.ts Normal file
View File

@@ -0,0 +1,13 @@
import * as os from 'os';
import Logger from './logger';
export default class MachineInfo {
static show() {
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)`);
}
}