system-info: Add hyperthreads. Windows needs to implement this.
The whole system-info needs a better api in general. At least this patch fixes cli.git on macOS.modern-harvey2
parent
58e09f4a58
commit
3892047d2d
|
@ -23,6 +23,6 @@ FUNCTION-ALIAS: (uname)
|
|||
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 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>> ;
|
||||
|
|
|
@ -74,6 +74,7 @@ FUNCTION: int sysctl ( int* name, uint namelen, void* oldp, size_t* oldlenp, voi
|
|||
: machine ( -- str ) { 6 1 } sysctl-query-string ;
|
||||
: model ( -- str ) { 6 2 } sysctl-query-string ;
|
||||
M: macosx cpus ( -- n ) { 6 3 } sysctl-query-uint ;
|
||||
M: macosx hyperthreads ( -- n ) { 6 3 } sysctl-query-uint ;
|
||||
: byte-order ( -- n ) { 6 4 } sysctl-query-uint ;
|
||||
|
||||
! Only an int, not large enough. Deprecated.
|
||||
|
|
|
@ -6,6 +6,7 @@ IN: system-info
|
|||
|
||||
HOOK: os-version os ( -- version )
|
||||
HOOK: cpus os ( -- n )
|
||||
HOOK: hyperthreads os ( -- n )
|
||||
HOOK: cpu-mhz os ( -- n )
|
||||
HOOK: memory-load os ( -- n )
|
||||
HOOK: physical-mem os ( -- n )
|
||||
|
|
Loading…
Reference in New Issue