system-info.linux: Implement the system-report. word.

db4
Doug Coleman 2013-04-24 12:05:51 -07:00
parent 55b2fb0802
commit 71c526d36a
1 changed files with 9 additions and 3 deletions

View File

@ -1,8 +1,9 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types alien.syntax byte-arrays io
USING: accessors alien.c-types alien.syntax byte-arrays io
io.encodings.string io.encodings.utf8 io.streams.byte-array
kernel sequences splitting strings system system-info unix ;
kernel sequences splitting strings system system-info unix
unix.linux.proc math ;
IN: system-info.linux
FUNCTION-ALIAS: (uname)
@ -19,4 +20,9 @@ FUNCTION-ALIAS: (uname)
: machine ( -- string ) 4 uname nth ;
: domainname ( -- string ) 5 uname nth ;
M: linux os-version release ;
M: linux os-version release ;
M: linux cpus parse-proc-cpuinfo sort-cpus cpu-counts 2drop ;
: cores ( -- n ) parse-proc-cpuinfo sort-cpus cpu-counts drop nip ;
: hyperthreads ( -- n ) parse-proc-cpuinfo sort-cpus cpu-counts 2nip ;
M: linux cpu-mhz parse-proc-cpuinfo first cpu-mhz>> 1,000,000 * ;
M: linux physical-mem parse-proc-meminfo mem-total>> ;