libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

mhd_tool_get_cpu_count.h (1912B)


      1 /*
      2  This file is part of GNU libmicrohttpd
      3   Copyright (C) 2023 Evgeny Grin (Karlson2k)
      4 
      5   This library is free software; you can redistribute it and/or
      6   modify it under the terms of the GNU Lesser General Public
      7   License as published by the Free Software Foundation; either
      8   version 2.1 of the License, or (at your option) any later version.
      9 
     10   This library 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 GNU
     13   Lesser General Public License for more details.
     14 
     15   You should have received a copy of the GNU Lesser General Public
     16   License along with this library; if not, write to the Free Software
     17   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
     18  */
     19 
     20 /**
     21  * @file tools/mhd_tool_get_cpu_count.h
     22  * @brief  Declaration of functions to detect the number of available
     23  *         CPU cores.
     24  * @author Karlson2k (Evgeny Grin)
     25  */
     26 
     27 
     28 #ifndef SRC_TOOLS_MHD_TOOL_GET_CPU_COUNT_H_
     29 #define SRC_TOOLS_MHD_TOOL_GET_CPU_COUNT_H_ 1
     30 
     31 
     32 /**
     33  * Detect the number of logical CPU cores available for the process.
     34  * The number of cores available for this process could be different from
     35  * value of cores available on the system. The OS may have limit on number
     36  * assigned/allowed cores for single process and process may have limited
     37  * CPU affinity.
     38  * @return the number of logical CPU cores available for the process or
     39  *         -1 if failed to detect
     40  */
     41 int
     42 mhd_tool_get_proc_cpu_count (void);
     43 
     44 
     45 /**
     46  * Try to detect the number of logical CPU cores available for the system.
     47  * The number of available logical CPU cores could be changed any time due to
     48  * CPU hotplug.
     49  * @return the number of logical CPU cores available,
     50  *         -1 if failed to detect.
     51  */
     52 int
     53 mhd_tool_get_system_cpu_count (void);
     54 
     55 #endif /* SRC_TOOLS_MHD_TOOL_GET_CPU_COUNT_H_ */