Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_SC_NPROCESSORS_ONLN may not be reliable on Android #34

Closed
Ms2ger opened this issue Jan 23, 2017 · 3 comments · Fixed by #45 or #51
Closed

_SC_NPROCESSORS_ONLN may not be reliable on Android #34

Ms2ger opened this issue Jan 23, 2017 · 3 comments · Fixed by #45 or #51

Comments

@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 23, 2017

Quoting from mozilla.dev.platform:

sysconf(_SC_NPROCESSORS_ONLN) is used a number of places in the tree to get
a core count for parallel algorithms. The web says that that phrase does
not really return the number of available cores on ARM Linuxish systems in
general, including Android - because the return value does not account for
cores that are sleeping for power saving reasons. (I've confirmed this
locally on an ARM board.) So you may get lucky when you ask. Or not.

sysconf(_SC_NPROCESSORS_CONF) works better here.

JS engine issue with some background and links to other discussions:
https://bugzilla.mozilla.org/show_bug.cgi?id=1333059.

@seanmonstar
Copy link
Owner

Sounds like a reasonable change to me, then.

@seanmonstar
Copy link
Owner

#45 had to be reverted, _SC_NPROCESSORS_CONF is not defined in libc on Android.

@GabrielMajeri
Copy link
Contributor

Sorry my pull request did not work, I submitted a pull request to libc now to add the _SC_NPROCESSORS_CONF constant.

Once the pull request gets accepted, perhaps this issue could finally be closed.

bors added a commit to rust-lang/libc that referenced this issue Jun 24, 2017
Add missing Android constant

This pull requests add the `_SC_NPROCESSORS_CONF` constant to `libc` for Android targets. The similar `_SC_NPROCESSORS_ONLN` already existed.

The reason for adding only this constant is to help fix an [issue with `num_cpus`](seanmonstar/num_cpus#34).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants