better cpu report
parent
1e538ccd03
commit
d031087338
|
@ -2,6 +2,7 @@ USING: system ;
|
|||
IN: hardware-info.backend
|
||||
|
||||
HOOK: cpus os ( -- n )
|
||||
HOOK: cpu-mhz os ( -- n )
|
||||
HOOK: memory-load os ( -- n )
|
||||
HOOK: physical-mem os ( -- n )
|
||||
HOOK: available-mem os ( -- n )
|
||||
|
|
|
@ -3,11 +3,12 @@ combinators vocabs.loader hardware-info.backend system ;
|
|||
IN: hardware-info
|
||||
|
||||
: write-unit ( x n str -- )
|
||||
[ 2^ /i number>string write bl ] [ write ] bi* ;
|
||||
[ 2^ /f number>string write bl ] [ write ] bi* ;
|
||||
|
||||
: kb ( x -- ) 10 "kB" write-unit ;
|
||||
: megs ( x -- ) 20 "MB" write-unit ;
|
||||
: gigs ( x -- ) 30 "GB" write-unit ;
|
||||
: ghz ( x -- ) 1000000000 /f number>string write bl "GHz" write ;
|
||||
|
||||
<< {
|
||||
{ [ os windows? ] [ "hardware-info.windows" ] }
|
||||
|
@ -18,4 +19,5 @@ IN: hardware-info
|
|||
|
||||
: hardware-report. ( -- )
|
||||
"CPUs: " write cpus number>string write nl
|
||||
"CPU Speed: " write cpu-mhz ghz nl
|
||||
"Physical RAM: " write physical-mem megs nl ;
|
||||
|
|
|
@ -41,7 +41,7 @@ M: macosx physical-mem ( -- n ) { 6 5 } sysctl-query-uint ;
|
|||
: machine-arch ( -- n ) { 6 12 } sysctl-query-string ;
|
||||
: vector-unit ( -- n ) { 6 13 } sysctl-query-uint ;
|
||||
: bus-frequency ( -- n ) { 6 14 } sysctl-query-uint ;
|
||||
: cpu-frequency ( -- n ) { 6 15 } sysctl-query-uint ;
|
||||
M: macosx cpu-mhz ( -- n ) { 6 15 } sysctl-query-uint ;
|
||||
: cacheline-size ( -- n ) { 6 16 } sysctl-query-uint ;
|
||||
: l1-icache-size ( -- n ) { 6 17 } sysctl-query-uint ;
|
||||
: l1-dcache-size ( -- n ) { 6 18 } sysctl-query-uint ;
|
||||
|
|
Loading…
Reference in New Issue