1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors io kernel math math.parser sequences system
7 HOOK: os-version os ( -- version )
9 HOOK: cpu-mhz os ( -- n )
10 HOOK: memory-load os ( -- n )
11 HOOK: physical-mem os ( -- n )
12 HOOK: available-mem os ( -- n )
13 HOOK: total-page-file os ( -- n )
14 HOOK: available-page-file os ( -- n )
15 HOOK: total-virtual-mem os ( -- n )
16 HOOK: available-virtual-mem os ( -- n )
17 HOOK: available-virtual-extended-mem os ( -- n )
18 HOOK: computer-name os ( -- string )
19 HOOK: username os ( -- string )
21 : write-unit ( x n str -- )
22 [ 2^ /f number>string write bl ] [ write ] bi* ;
24 : kb ( x -- ) 10 "kB" write-unit ;
25 : megs ( x -- ) 20 "MB" write-unit ;
26 : gigs ( x -- ) 30 "GB" write-unit ;
27 : ghz ( x -- ) 1000000000 /f number>string write bl "GHz" write ;
29 : system-report. ( -- )
30 "CPUs: " write cpus number>string write nl
31 "CPU Speed: " write cpu-mhz ghz nl
32 "Physical RAM: " write physical-mem megs nl ;
34 "system-info." os name>> append require