Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Issue 23655004: Replace OS::NumberOfCores() with CPU::NumberOfProcessorsOnline(). (Closed)

Created:
7 years, 3 months ago by Benedikt Meurer
Modified:
7 years, 3 months ago
Reviewers:
Toon Verwaest
CC:
v8-dev, tfarina
Visibility:
Public.

Description

Replace OS::NumberOfCores() with CPU::NumberOfProcessorsOnline(). The name NumberOfCores is misleading, as it does not return the actual number of cores. While NumberOfProcessorsOnline is also not a great name, it's at least consistent with the operating system terminology. R=verwaest@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=16392

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -20 lines) Patch
M src/cpu.h View 1 chunk +3 lines, -0 lines 0 comments Download
M src/cpu.cc View 2 chunks +19 lines, -0 lines 2 comments Download
M src/isolate.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/platform.h View 1 chunk +0 lines, -2 lines 0 comments Download
M src/platform-posix.cc View 1 chunk +0 lines, -5 lines 0 comments Download
M src/platform-win32.cc View 1 chunk +0 lines, -7 lines 0 comments Download
M test/cctest/test-cpu.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M test/cctest/test-platform.cc View 1 chunk +0 lines, -5 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Benedikt Meurer
Hey Toon, Another method moved out of the platform files. PTAL -- Benedikt
7 years, 3 months ago (2013-08-28 10:49:49 UTC) #1
Toon Verwaest
lgtm
7 years, 3 months ago (2013-08-28 11:44:57 UTC) #2
Benedikt Meurer
Committed patchset #1 manually as r16392.
7 years, 3 months ago (2013-08-28 12:33:08 UTC) #3
tfarina
https://codereview.chromium.org/23655004/diff/1/src/cpu.cc File src/cpu.cc (right): https://codereview.chromium.org/23655004/diff/1/src/cpu.cc#newcode456 src/cpu.cc:456: int CPU::NumberOfProcessorsOnline() { looks like the ninja implementation is ...
7 years, 3 months ago (2013-08-31 22:10:46 UTC) #4
Benedikt Meurer
7 years, 3 months ago (2013-09-01 08:32:43 UTC) #5
Message was sent while issue was closed.
https://codereview.chromium.org/23655004/diff/1/src/cpu.cc
File src/cpu.cc (right):

https://codereview.chromium.org/23655004/diff/1/src/cpu.cc#newcode456
src/cpu.cc:456: int CPU::NumberOfProcessorsOnline() {
On 2013/08/31 22:10:46, tfarina wrote:
> looks like the ninja implementation is stronger.
> 
> see:
> https://github.com/martine/ninja/blob/master/src/util.cc#L303

No, just unnecessarily complex:
- The BSDs implement sysconf(_SC_NPROCESSORS_ONLN) in terms of sysctl({CTL_HW,
HW_NCPU}), and at least FreeBSD attempts to use ELF aux info if available.
- glibc implements sysconf(_SC_NPROCESSORS_ONLN) in terms of get_nprocs(). And
the #if defined(linux) is broken, because get_nprocs() is a glibc extension and
has nothing to do with Linux.
So basically we have 20 fewer lines, for exactly the same result.

Powered by Google App Engine
This is Rietveld 408576698