Commit | Line | Data |
---|---|---|
0f00f2c3 LC |
1 | /* Detect the number of processors. |
2 | ||
f0007cad | 3 | Copyright (C) 2009-2012 Free Software Foundation, Inc. |
0f00f2c3 LC |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU Lesser General Public License as published by | |
7 | the Free Software Foundation; either version 2, or (at your option) | |
8 | any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public License | |
16 | along with this program; if not, write to the Free Software Foundation, | |
17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | ||
19 | /* Written by Glen Lenker and Bruno Haible. */ | |
20 | ||
21 | /* Allow the use in C++ code. */ | |
22 | #ifdef __cplusplus | |
23 | extern "C" { | |
24 | #endif | |
25 | ||
26 | /* A "processor" in this context means a thread execution unit, that is either | |
27 | - an execution core in a (possibly multi-core) chip, in a (possibly multi- | |
28 | chip) module, in a single computer, or | |
29 | - a thread execution unit inside a core | |
30 | (hyper-threading, see <http://en.wikipedia.org/wiki/Hyper-threading>). | |
31 | Which of the two definitions is used, is unspecified. */ | |
32 | ||
33 | enum nproc_query | |
34 | { | |
35 | NPROC_ALL, /* total number of processors */ | |
36 | NPROC_CURRENT, /* processors available to the current process */ | |
37 | NPROC_CURRENT_OVERRIDABLE /* likewise, but overridable through the | |
38 | OMP_NUM_THREADS environment variable */ | |
39 | }; | |
40 | ||
41 | /* Return the total number of processors. The result is guaranteed to | |
42 | be at least 1. */ | |
43 | extern unsigned long int num_processors (enum nproc_query query); | |
44 | ||
45 | #ifdef __cplusplus | |
46 | } | |
47 | #endif /* C++ */ |