Kode/Kore

Extend system API to get core and/or thread count at runtime

tcdude opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
When scheduling multi-threaded workloads I would like to take the number of cores (or if that is not possible, the number of threads) available into account to make good use of the available CPU resources.

Describe the solution you'd like
I would like to call something like kinc_system_core_count() (and/or _thread_count()) and get a positive, non-zero integer back.

Describe alternatives you've considered
I considered using Google cpu_featres but would prefer a solution where Kinc offers this OOTB

Additional context

  • On certain platforms it is necessary to take different approaches to determine the core count, like on Android where an App runs sandboxed and doesn't allow access to cpuinfo.
  • Currently on ARM based systems there is no distinction between core and thread count (since there's to my knowledge no SMT cores).

I think it works everywhere now.