#include "DebugOptionsHandler.h"
Definition at line 12 of file DebugOptionsHandler.h.
art::DebugOptionsHandler::DebugOptionsHandler |
( |
bpo::options_description & |
desc, |
|
|
std::string const & |
basename |
|
) |
| |
|
explicit |
Definition at line 42 of file DebugOptionsHandler.cc.
References art::add_opt(), and s.
45 bpo::options_description debug_options{
"Debugging options"};
46 auto options = debug_options.add_options();
49 bpo::value<std::string>(),
50 "Log art-specific multi-threading diagnostics to " 51 "the provided destination.");
52 add_opt(options,
"trace",
"Activate tracing.");
53 add_opt(options,
"notrace",
"Deactivate tracing.");
55 options,
"timing",
"Activate monitoring of time spent per event/module.");
58 bpo::value<std::string>(),
59 "Output time-tracking data to SQLite3 database with name <db-file>.");
60 add_opt(options,
"notiming",
"Deactivate time tracking.");
63 "Activate monitoring of memory use (deprecated--per-job " 64 "memory information printed in job summary).");
67 bpo::value<std::string>(),
68 "Output memory use data to SQLite3 database with name <db-file>.");
69 add_opt(options,
"nomemcheck",
"Deactivate monitoring of memory use.");
73 bpo::value<std::string>(),
74 "Output post-processed configuration to <file>; call constructors of all " 75 "sources, modules and services, performing extra configuration " 76 "verification. Exit just before processing the event loop.");
80 bpo::value<std::string>(),
81 (
"Output post-processed configuration to <file> and exit. Equivalent to env ART_DEBUG_CONFIG=<file> "s +
87 bpo::value<std::string>(),
88 "Output post-processed configuration to <file> and continue with job.");
90 options,
"annotate",
"Include configuration parameter source information.");
93 "Include configuration parameter source information " 94 "on line preceding parameter declaration.");
95 desc.add(debug_options);
void add_opt(T &t, Args &&...args)
int art::OptionsHandler::checkOptions |
( |
bpo::variables_map const & |
vm | ) |
|
|
inherited |
Definition at line 51 of file OptionsHandler.cc.
53 std::string
const thisClass(cet::demangle_symbol(
typeid(*this).name()));
54 return exceptionCatcher([&vm,
this] {
return doCheckOptions(vm); },
55 thisClass +
"::doCheckOptions()",
virtual int doCheckOptions(bpo::variables_map const &vm)=0
int art::DebugOptionsHandler::doCheckOptions |
( |
bpo::variables_map const & |
vm | ) |
|
|
overrideprivatevirtual |
Implements art::OptionsHandler.
Definition at line 99 of file DebugOptionsHandler.cc.
References art::errors::Configuration.
101 if (vm.count(
"trace") + vm.count(
"notrace") > 1) {
103 <<
"Options --trace and --notrace are incompatible.\n";
105 if (vm.count(
"timing") + vm.count(
"notiming") > 1) {
107 <<
"Options --timing and --notiming are incompatible.\n";
109 if (vm.count(
"timing-db") + vm.count(
"notiming") > 1) {
111 <<
"Options --timing-db and --notiming are incompatible.\n";
113 if (vm.count(
"memcheck") + vm.count(
"nomemcheck") > 1) {
115 <<
"Options --memcheck and --nomemcheck are incompatible.\n";
117 if (vm.count(
"memcheck-db") + vm.count(
"nomemcheck") > 1) {
119 <<
"Options --memcheck-db and --nomemcheck are incompatible.\n";
121 if (vm.count(
"validate-config") + vm.count(
"debug-config") +
122 vm.count(
"config-out") >
125 <<
"Options --validate-config, --debug-config, and --config-out are " 128 if (vm.count(
"annotate") + vm.count(
"prefix-annotate") > 1) {
130 <<
"Options --annotate and --prefix-annotate are incompatible.\n";
133 if (vm.count(
"annotate") + vm.count(
"prefix-annotate") == 1 &&
134 vm.count(
"debug-config") + vm.count(
"config-out") == 0) {
136 <<
"Options --annotate and --prefix-annotate must be specified with " 137 "either --debug-config or --config-out.\n";
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Implements art::OptionsHandler.
Definition at line 144 of file DebugOptionsHandler.cc.
References fhicl::intermediate_table::erase(), art::detail::exists_outside_prolog(), art::detail::fhicl_key(), fhicl::intermediate_table::get(), fhicl::intermediate_table::put(), fhicl::intermediate_table::putEmptyTable(), and s.
151 auto const scheduler_key =
fhicl_key(
"services",
"scheduler");
152 std::string debug_table;
156 auto const result = destination_via_env();
158 debug_table =
fhicl_key(scheduler_key,
"debugConfig");
163 if (vm.count(
"validate-config")) {
164 debug_table =
fhicl_key(scheduler_key,
"validateConfig");
165 fn = vm[
"validate-config"].as<std::string>();
166 }
else if (vm.count(
"debug-config")) {
167 debug_table =
fhicl_key(scheduler_key,
"debugConfig");
168 fn = vm[
"debug-config"].as<std::string>();
169 }
else if (vm.count(
"config-out")) {
170 debug_table =
fhicl_key(scheduler_key,
"configOut");
171 fn = vm[
"config-out"].as<std::string>();
173 if (!debug_table.empty()) {
177 std::string mode{
"raw"};
178 if (vm.count(
"annotate")) {
181 if (vm.count(
"prefix-annotate")) {
182 mode =
"prefix-annotate";
184 if (!debug_table.empty()) {
185 raw_config.
put(
fhicl_key(debug_table,
"printMode"), mode);
188 if (vm.count(
"trace")) {
189 raw_config.
put(
"services.scheduler.wantTracer",
true);
190 }
else if (vm.count(
"notrace")) {
191 raw_config.
put(
"services.scheduler.wantTracer",
false);
193 auto const timingdb = vm.count(
"timing-db");
194 if (vm.count(
"timing") || timingdb) {
197 raw_config.
put(
"services.TimeTracker.dbOutput.filename",
198 vm[
"timing-db"].as<std::string>());
199 }
else if (vm.count(
"notiming")) {
200 raw_config.
erase(
"services.TimeTracker");
202 auto const memdb = vm.count(
"memcheck-db");
203 if (vm.count(
"memcheck") || memdb) {
206 raw_config.
put(
"services.MemoryTracker.dbOutput.filename",
207 vm[
"memcheck-db"].as<std::string>());
208 }
else if (vm.count(
"nomemcheck")) {
209 raw_config.
erase(
"services.MemoryTracker");
213 auto const message_key =
fhicl_key(
"services",
"message");
214 auto const dests_key =
fhicl_key(message_key,
"destinations");
216 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.categories.ArtReport.limit"),
218 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.categories.default.limit"), -1);
219 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.type"),
"cout");
220 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.threshold"),
"INFO");
223 auto const& dests = raw_config.
get<
table_t const&>(dests_key);
226 for (
auto const& p : dests) {
227 std::string
const& dest_name = p.first;
228 if (dest_name ==
"statistics"s)
231 fhicl_key(dests_key, dest_name,
"categories.MTdiagnostics.limit"), 0);
235 auto const& stats_dest_key =
fhicl_key(dests_key,
"statistics");
237 auto const& stats_dests = raw_config.
get<
table_t const&>(stats_dest_key);
238 for (
auto const& p : stats_dests) {
239 std::string
const& dest_name = p.first;
241 fhicl_key(stats_dest_key, dest_name,
"categories.MTdiagnostics.limit"),
246 if (vm.count(
"mt-diagnostics") > 0) {
247 auto const dest = vm[
"mt-diagnostics"].as<std::string>();
248 std::regex
const re_stdout{R
"((STDOUT|cout))", 249 std::regex_constants::ECMAScript | 250 std::regex_constants::icase}; 251 std::regex const re_stderr{R
"((STDERR|cerr))", 252 std::regex_constants::ECMAScript | 253 std::regex_constants::icase}; 254 if (std::regex_match(dest, re_stdout)) {
258 fhicl_key(dests_key,
"STDOUT.categories.MTdiagnostics.limit"), -1);
262 auto const mt_dest_key =
fhicl_key(dests_key,
"MTdiagnostics");
263 if (std::regex_match(dest, re_stderr)) {
267 raw_config.
put(
fhicl_key(mt_dest_key,
"filename"), dest);
269 raw_config.
put(
fhicl_key(mt_dest_key,
"categories.MTdiagnostics.limit"),
271 raw_config.
put(
fhicl_key(mt_dest_key,
"categories.default.limit"), 0);
bool exists_outside_prolog(fhicl::intermediate_table const &config, std::string const &key)
std::enable_if_t< std::is_convertible< T, std::string >::value, std::string > fhicl_key(T const &name)
Definition at line 60 of file OptionsHandler.cc.
Referenced by art::run_art_string_config().
63 std::string
const thisClass(cet::demangle_symbol(
typeid(*this).name()));
64 return exceptionCatcher(
66 thisClass +
"::doProcessOptions()",
virtual int doProcessOptions(bpo::variables_map const &vm, fhicl::intermediate_table &raw_config)=0
The documentation for this class was generated from the following files: