SourceXtractorPlusPlus
0.11
Please provide a description of the project.
SEImplementation
src
lib
Configuration
MultiThreadingConfig.cpp
Go to the documentation of this file.
1
17
/*
18
* MultiThreadingConfig.cpp
19
*
20
* Created on: May 22, 2018
21
* Author: mschefer
22
*/
23
24
#include <boost/thread.hpp>
25
26
#include "
SEImplementation/Configuration/MultiThreadingConfig.h
"
27
28
using namespace
Euclid::Configuration
;
29
namespace
po = boost::program_options;
30
31
namespace
SourceXtractor
{
32
33
static
const
std::string
THREADS_NB
{
"thread-count"
};
34
35
MultiThreadingConfig::MultiThreadingConfig(
long
manager_id) :
Configuration
(manager_id), m_threads_nb(-1) {
36
}
37
38
auto
MultiThreadingConfig::getProgramOptions
() ->
std::map<std::string, OptionDescriptionList>
{
39
return
{ {
"Multi-threading"
, {
40
{
THREADS_NB
.
c_str
(), po::value<int>()->default_value(-1),
"Number of worker threads (-1=automatic, 0=disable all multithreading)"
}
41
}}};
42
}
43
44
void
MultiThreadingConfig::initialize
(
const
UserValues
& args) {
45
m_threads_nb
= args.
at
(
THREADS_NB
).as<
int
>();
46
if
(
m_threads_nb
== -1) {
47
m_threads_nb
= boost::thread::hardware_concurrency();
48
}
else
if
(
m_threads_nb
< -1) {
49
throw
Elements::Exception
(
"Invalid number of threads."
);
50
}
51
}
52
53
}
// SourceXtractor namespace
54
SourceXtractor::MultiThreadingConfig::initialize
void initialize(const UserValues &args) override
Definition:
MultiThreadingConfig.cpp:44
Euclid::Configuration
SourceXtractor::THREADS_NB
static const std::string THREADS_NB
Definition:
MultiThreadingConfig.cpp:33
Euclid::Configuration::Configuration
SourceXtractor::MultiThreadingConfig::m_threads_nb
int m_threads_nb
Definition:
MultiThreadingConfig.h:46
std::map
STL class.
std::string
STL class.
std::map::at
T at(T... args)
SourceXtractor
Definition:
Aperture.h:30
Elements::Exception
MultiThreadingConfig.h
std::string::c_str
T c_str(T... args)
SourceXtractor::MultiThreadingConfig::getProgramOptions
std::map< std::string, OptionDescriptionList > getProgramOptions() override
Definition:
MultiThreadingConfig.cpp:38
Generated by
1.8.14