OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cpu.h" | 5 #include "cpu.h" |
6 | 6 |
7 #if V8_LIBC_MSVCRT | 7 #if V8_LIBC_MSVCRT |
8 #include <intrin.h> // __cpuid() | 8 #include <intrin.h> // __cpuid() |
9 #endif | 9 #endif |
10 #if V8_OS_POSIX | 10 #if V8_OS_POSIX |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 part_ = strtol(part, &end, 0); | 489 part_ = strtol(part, &end, 0); |
490 if (end == part) { | 490 if (end == part) { |
491 part_ = 0; | 491 part_ = 0; |
492 } | 492 } |
493 delete[] part; | 493 delete[] part; |
494 } | 494 } |
495 | 495 |
496 #endif | 496 #endif |
497 } | 497 } |
498 | 498 |
499 | |
500 // static | |
501 int CPU::NumberOfProcessorsOnline() { | |
502 #if V8_OS_WIN | |
503 SYSTEM_INFO info; | |
504 GetSystemInfo(&info); | |
505 return info.dwNumberOfProcessors; | |
506 #else | |
507 return static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); | |
508 #endif | |
509 } | |
510 | |
511 } } // namespace v8::internal | 499 } } // namespace v8::internal |
OLD | NEW |