diff options
author | Brian White <mscdex@mscdex.net> | 2010-12-22 21:55:47 +0300 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-12-22 22:01:25 +0300 |
commit | d75c338dd6e9afe09356870cde456fd0c0e87e76 (patch) | |
tree | 4ea9921947fa0a67603ed332ee21c4f0c15deb1d /doc | |
parent | 0d58353d66290c7138d5e96829e722772f8ca452 (diff) |
Add more functionality to the os module
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/os.markdown | 97 |
1 files changed, 96 insertions, 1 deletions
diff --git a/doc/api/os.markdown b/doc/api/os.markdown index 4429bddbfb6..3c4e1b44fdc 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -2,6 +2,101 @@ Use `require('os')` to access this module. -### os.getHostname() +### os.hostname() Returns the hostname of the operating system. + +### os.type() + +Returns the operating system name. + +### os.release() + +Returns the operating system release. + +### os.uptime() + +Returns the system uptime in seconds. + +### os.loadavg() + +Returns an array containing the 1, 5, and 15 minute load averages. + +### os.totalmem() + +Returns the total amount of system memory in bytes. + +### os.freemem() + +Returns the amount of free system memory in bytes. + +### os.cpus() + +Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of CPU ticks spent in: user, nice, sys, idle, and irq). + +Example inspection of os.cpus: + + [ { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 252020, + nice: 0, + sys: 30340, + idle: 1070356870, + irq: 0 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 306960, + nice: 0, + sys: 26980, + idle: 1071569080, + irq: 0 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 248450, + nice: 0, + sys: 21750, + idle: 1070919370, + irq: 0 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 256880, + nice: 0, + sys: 19430, + idle: 1070905480, + irq: 20 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 511580, + nice: 20, + sys: 40900, + idle: 1070842510, + irq: 0 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 291660, + nice: 0, + sys: 34360, + idle: 1070888000, + irq: 10 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 308260, + nice: 0, + sys: 55410, + idle: 1071129970, + irq: 880 } }, + { model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', + speed: 2926, + times: + { user: 266450, + nice: 1480, + sys: 34920, + idle: 1072572010, + irq: 30 } } ]
\ No newline at end of file |