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
Doug Coleman 2017-08-26 01:10:04 -05:00
parent 58e09f4a58
commit 3892047d2d
3 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,6 @@ FUNCTION-ALIAS: (uname)
M: linux os-version release ; M: linux os-version release ;
M: linux cpus parse-proc-cpuinfo sort-cpus cpu-counts 2drop ; M: linux cpus parse-proc-cpuinfo sort-cpus cpu-counts 2drop ;
: cores ( -- n ) parse-proc-cpuinfo sort-cpus cpu-counts drop nip ; : 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 cpu-mhz parse-proc-cpuinfo first cpu-mhz>> 1,000,000 * ;
M: linux physical-mem parse-proc-meminfo mem-total>> ; M: linux physical-mem parse-proc-meminfo mem-total>> ;

View File

@ -74,6 +74,7 @@ FUNCTION: int sysctl ( int* name, uint namelen, void* oldp, size_t* oldlenp, voi
: machine ( -- str ) { 6 1 } sysctl-query-string ; : machine ( -- str ) { 6 1 } sysctl-query-string ;
: model ( -- str ) { 6 2 } sysctl-query-string ; : model ( -- str ) { 6 2 } sysctl-query-string ;
M: macosx cpus ( -- n ) { 6 3 } sysctl-query-uint ; 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 ; : byte-order ( -- n ) { 6 4 } sysctl-query-uint ;
! Only an int, not large enough. Deprecated. ! Only an int, not large enough. Deprecated.

View File

@ -6,6 +6,7 @@ IN: system-info
HOOK: os-version os ( -- version ) HOOK: os-version os ( -- version )
HOOK: cpus os ( -- n ) HOOK: cpus os ( -- n )
HOOK: hyperthreads os ( -- n )
HOOK: cpu-mhz os ( -- n ) HOOK: cpu-mhz os ( -- n )
HOOK: memory-load os ( -- n ) HOOK: memory-load os ( -- n )
HOOK: physical-mem os ( -- n ) HOOK: physical-mem os ( -- n )