Stride Reference Manual  - generated for commit 9643b11
ConfigInfo.cpp
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2017, 2018 Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #include "ConfigInfo.h"
22 
23 #include <omp.h>
24 #include <string>
25 #include <unistd.h>
26 
27 #define STRINGIFY(x) #x
28 #define TOSTRING(x) STRINGIFY(x)
29 
30 namespace stride {
31 namespace util {
32 
33 std::string ConfigInfo::GitRevision() { return TOSTRING(STRIDE_GIT_HASH); }
34 
36 {
37  char hostname[40];
38  gethostname(hostname, 40);
39  return hostname;
40 }
41 
42 unsigned int ConfigInfo::ProcessorCount() { return PROCCOUNT; }
43 
45 {
46  unsigned int i = 1U;
47 #pragma omp parallel
48  {
49  i = static_cast<unsigned int>(omp_get_num_threads());
50  }
51  return i;
52 }
53 
54 } // namespace util
55 } // namespace stride
static unsigned int NumberAvailableThreads()
Return number of threads (in case of OpenMP).
Definition: ConfigInfo.cpp:44
#define TOSTRING(x)
Definition: ConfigInfo.cpp:28
static std::string GitRevision()
Return git revision string.
Definition: ConfigInfo.cpp:33
static std::string GetHostname()
Return current hostname.
Definition: ConfigInfo.cpp:35
Info on configuration.
static unsigned int ProcessorCount()
Return processor count for system.
Definition: ConfigInfo.cpp:42
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28