diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2016-12-31 03:19:59 +0900 |
|---|---|---|
| committer | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2016-12-31 03:19:59 +0900 |
| commit | 7e4091c7795d2bd72a0b6a4c3740bebdf3f002d9 (patch) | |
| tree | be53022bd9bfd953520975f40ba31da88d2ea5b6 /src/utils | |
| parent | :sparkles: (diff) | |
| download | sharkey-7e4091c7795d2bd72a0b6a4c3740bebdf3f002d9.tar.gz sharkey-7e4091c7795d2bd72a0b6a4c3740bebdf3f002d9.tar.bz2 sharkey-7e4091c7795d2bd72a0b6a4c3740bebdf3f002d9.zip | |
Extract MachineInfo
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/machineInfo.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/machineInfo.ts b/src/utils/machineInfo.ts new file mode 100644 index 0000000000..600460e4da --- /dev/null +++ b/src/utils/machineInfo.ts @@ -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)`); + } +} |