root/lib/nproc.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


     1 /* Detect the number of processors.
     2 
     3    Copyright (C) 2009-2023 Free Software Foundation, Inc.
     4 
     5    This file is free software: you can redistribute it and/or modify
     6    it under the terms of the GNU Lesser General Public License as
     7    published by the Free Software Foundation; either version 2.1 of the
     8    License, or (at your option) any later version.
     9 
    10    This file 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, see <https://www.gnu.org/licenses/>.  */
    17 
    18 /* Written by Glen Lenker and Bruno Haible.  */
    19 
    20 /* Allow the use in C++ code.  */
    21 #ifdef __cplusplus
    22 extern "C" {
    23 #endif
    24 
    25 /* A "processor" in this context means a thread execution unit, that is either
    26    - an execution core in a (possibly multi-core) chip, in a (possibly multi-
    27      chip) module, in a single computer, or
    28    - a thread execution unit inside a core
    29      (hyper-threading, see <https://en.wikipedia.org/wiki/Hyper-threading>).
    30    Which of the two definitions is used, is unspecified.  */
    31 
    32 enum nproc_query
    33 {
    34   NPROC_ALL,                 /* total number of processors */
    35   NPROC_CURRENT,             /* processors available to the current process */
    36   NPROC_CURRENT_OVERRIDABLE  /* likewise, but overridable through the
    37                                 OMP_NUM_THREADS environment variable */
    38 };
    39 
    40 /* Return the total number of processors.  The result is guaranteed to
    41    be at least 1.  */
    42 extern unsigned long int num_processors (enum nproc_query query);
    43 
    44 #ifdef __cplusplus
    45 }
    46 #endif /* C++ */

/* [<][>][^][v][top][bottom][index][help] */