[Toybox] xcount_cpus
enh
enh at google.com
Mon Oct 26 09:25:16 PDT 2015
bionic had to give up on using /proc/cpuinfo or /proc/stat for
counting cpus. in particular, a certain soc vendor rob's worked for in
the past insists on doing things wrongly. the only methods we've never
had problems with on any kernel on any architecture are:
if you want online cpus, parse /sys/devices/system/cpu/online.
if you want offline cpus too, count cpu\d+ entries in /sys/devices/system/cpu.
is there a reason why you don't just use sysconf(3) and let it be the
C library's problem? (if so, that's probably worth a code comment.)
--
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
1445876716.0
More information about the Toybox
mailing list