Ignore:
Timestamp:
Jan 18, 2012, 6:15:05 AM (13 years ago)
Author:
[email protected]
Message:

Cross-platform processor core counter
https://bugs.webkit.org/show_bug.cgi?id=76530

Patch by Roland Takacs <[email protected]> on 2012-01-18
Reviewed by Zoltan Herczeg.

Source/JavaScriptCore:

Two files have been created that include the processor core counter function.
It used to be in ParallelJobsGeneric.h/cpp before.

(JSC::Options::initializeOptions):

  • wtf/CMakeLists.txt:
  • wtf/NumberOfCores.cpp: Added.

(WTF::numberOfProcessorCores):

  • wtf/NumberOfCores.h: Added.
  • wtf/ParallelJobsGeneric.cpp:

(WTF::ParallelEnvironment::ParallelEnvironment):

  • wtf/ParallelJobsGeneric.h:

Source/WTF:

Two files have been added to the project, namely NumberOfCores.h/cpp,
that include a CPU core number determining function.

  • WTF.pro:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Options.cpp

    r103286 r105270  
    2828
    2929#include <limits>
     30#include <wtf/NumberOfCores.h>
    3031#include <wtf/PageBlock.h>
    3132
     
    175176
    176177    int cpusToUse = 1;
    177 #if OS(DARWIN) && ENABLE(PARALLEL_GC)
    178     int name[2];
    179     size_t valueSize = sizeof(cpusToUse);
    180     name[0] = CTL_HW;
    181     name[1] = HW_AVAILCPU;
    182     sysctl(name, 2, &cpusToUse, &valueSize, 0, 0);
     178#if ENABLE(PARALLEL_GC)
     179    cpusToUse = WTF::numberOfProcessorCores();
    183180#endif
    184181    // We don't scale so well beyond 4.
Note: See TracChangeset for help on using the changeset viewer.