2008-04-03 02:48:29 -04:00
|
|
|
USING: alien.syntax kernel math prettyprint io math.parser
|
2008-02-04 18:10:49 -05:00
|
|
|
combinators vocabs.loader hardware-info.backend system ;
|
2007-09-20 18:09:08 -04:00
|
|
|
IN: hardware-info
|
|
|
|
|
2008-04-03 02:48:29 -04:00
|
|
|
: write-unit ( x n str -- )
|
2008-04-04 00:35:57 -04:00
|
|
|
[ 2^ /f number>string write bl ] [ write ] bi* ;
|
2008-04-03 02:48:29 -04:00
|
|
|
|
|
|
|
: kb ( x -- ) 10 "kB" write-unit ;
|
|
|
|
: megs ( x -- ) 20 "MB" write-unit ;
|
|
|
|
: gigs ( x -- ) 30 "GB" write-unit ;
|
2008-04-04 00:35:57 -04:00
|
|
|
: ghz ( x -- ) 1000000000 /f number>string write bl "GHz" write ;
|
2007-09-20 18:09:08 -04:00
|
|
|
|
2008-04-02 20:23:37 -04:00
|
|
|
<< {
|
2008-04-02 19:25:33 -04:00
|
|
|
{ [ os windows? ] [ "hardware-info.windows" ] }
|
|
|
|
{ [ os linux? ] [ "hardware-info.linux" ] }
|
|
|
|
{ [ os macosx? ] [ "hardware-info.macosx" ] }
|
2008-04-11 13:55:57 -04:00
|
|
|
[ f ]
|
2008-01-14 16:42:21 -05:00
|
|
|
} cond [ require ] when* >>
|
2008-04-03 02:48:29 -04:00
|
|
|
|
|
|
|
: hardware-report. ( -- )
|
|
|
|
"CPUs: " write cpus number>string write nl
|
2008-04-04 00:35:57 -04:00
|
|
|
"CPU Speed: " write cpu-mhz ghz nl
|
2008-04-03 02:48:29 -04:00
|
|
|
"Physical RAM: " write physical-mem megs nl ;
|