Debian Codegraph @

js/src/threading/windows/CpuCount.cpp

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "threading/CpuCount.h"
7
8 #include "util/WindowsWrapper.h"
9
10 uint32_t js::GetCPUCount() {
11 static uint32_t ncpus = 0;
12
13 if (ncpus == 0) {
14 SYSTEM_INFO sysinfo;
15 GetSystemInfo(&sysinfo);
16 ncpus = uint32_t(sysinfo.dwNumberOfProcessors);
17 }
18
19 return ncpus;
20 }