1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax kernel math prettyprint io math.parser
4 combinators vocabs.loader system-info.backend system ;
7 : write-unit ( x n str -- )
8 [ 2^ /f number>string write bl ] [ write ] bi* ;
10 : kb ( x -- ) 10 "kB" write-unit ;
11 : megs ( x -- ) 20 "MB" write-unit ;
12 : gigs ( x -- ) 30 "GB" write-unit ;
13 : ghz ( x -- ) 1000000000 /f number>string write bl "GHz" write ;
16 { [ os windows? ] [ "system-info.windows" ] }
17 { [ os linux? ] [ "system-info.linux" ] }
18 { [ os macosx? ] [ "system-info.macosx" ] }
20 } cond [ require ] when* >>
22 : system-report. ( -- )
23 "CPUs: " write cpus number>string write nl
24 "CPU Speed: " write cpu-mhz ghz nl
25 "Physical RAM: " write physical-mem megs nl ;