19 bpo::options_description debug_options{
"Debugging options"};
21 debug_options.add_options()
23 bpo::value<std::string>(),
24 "Log art-specific multi-threading diagnostics to " 25 "the provided destination.")
26 (
"trace",
"Activate tracing.")
27 (
"no-trace",
"Deactivate tracing.")
28 (
"timing",
"Activate monitoring of time spent per event/module.")
30 bpo::value<std::string>(),
31 "Output time-tracking data to SQLite3 database with name <db-file>.")
32 (
"no-timing",
"Deactivate time tracking.")
34 bpo::value<std::string>(),
35 "Output memory use data to SQLite3 database with name <db-file>.")
36 (
"no-memcheck",
"Deactivate monitoring of memory use.")
37 (
"data-dependency-graph,g",
38 bpo::value<std::string>(),
39 "Print DOT file that shows the dependency graph of " 40 "modules, based on the specified paths and 'consumes' " 41 "statements invoked by users; call constructors of all " 42 "modules and exit just before processing the event loop.")
44 bpo::value<std::string>(),
45 "Output post-processed configuration to <file>; call constructors of all " 46 "sources, modules and services, performing extra configuration " 47 "verification. Exit just before processing the event loop.")
49 bpo::value<std::string>()->implicit_value(
"brief"),
50 "Output summary of full program configuration. Allowed values include " 51 "'brief', 'detailed', and 'full'.")
53 bpo::value<std::string>(),
54 "Output post-processed configuration to <file> and continue with job.")
56 bpo::value<std::string>(),
57 "Output post-processed configuration to <file> and exit.")
58 (
"annotate",
"Include configuration parameter source information.")
60 "Include configuration parameter source information " 61 "on line preceding parameter declaration.");
63 desc.add(debug_options);
69 if (vm.count(
"trace") + vm.count(
"no-trace") > 1) {
71 <<
"Options --trace and --no-trace are incompatible.\n";
73 if (vm.count(
"timing") + vm.count(
"no-timing") > 1) {
75 <<
"Options --timing and --no-timing are incompatible.\n";
77 if (vm.count(
"timing-db") + vm.count(
"no-timing") > 1) {
79 <<
"Options --timing-db and --no-timing are incompatible.\n";
81 if (vm.count(
"memcheck-db") + vm.count(
"no-memcheck") > 1) {
83 <<
"Options --memcheck-db and --no-memcheck are incompatible.\n";
85 unsigned const config_out_count = vm.count(
"validate-config") +
86 vm.count(
"debug-config") +
87 vm.count(
"config-out");
88 if (config_out_count + vm.count(
"config-summary") > 1) {
90 <<
"Options --validate-config, --debug-config, --config-out, and " 91 "--config-summary are incompatible.\n";
93 unsigned const annotate_count =
94 vm.count(
"annotate") + vm.count(
"prefix-annotate");
95 if (annotate_count > 1) {
97 <<
"Options --annotate and --prefix-annotate are incompatible, and may " 98 "be specified only once.\n";
101 if (annotate_count == 1 && config_out_count == 0) {
103 <<
"Options --annotate and --prefix-annotate may be specified only for " 105 "--debug-config, --config-out, or --validate-config program " 114 bpo::variables_map
const& vm,
120 auto const scheduler_key =
fhicl_key(
"services",
"scheduler");
121 std::string
const debug_table{
fhicl_key(scheduler_key,
"debug")};
126 raw_config.
erase(debug_table);
130 auto debugging_options = {
131 "config-summary",
"config-out",
"debug-config",
"validate-config"};
132 for (
auto const opt : debugging_options) {
134 tie(option, fn) = make_tuple(opt, vm[opt].as<std::string>());
140 if (option ==
"config-summary") {
141 mode = vm[
"config-summary"].as<std::string>();
143 if (vm.count(
"annotate")) {
145 }
else if (vm.count(
"prefix-annotate")) {
146 mode =
"prefix-annotate";
152 if (!option.empty()) {
153 raw_config.
put(
fhicl_key(debug_table,
"option"), option);
155 raw_config.
put(
fhicl_key(debug_table,
"printMode"), mode);
158 std::string graph_option{
"data-dependency-graph"};
159 if (vm.count(graph_option)) {
160 raw_config.
put(
"services.scheduler.dataDependencyGraph",
161 vm[graph_option].as<std::string>());
164 if (vm.count(
"trace")) {
166 }
else if (vm.count(
"no-trace")) {
167 raw_config.
erase(
"services.Tracer");
169 auto const timingdb = vm.count(
"timing-db");
170 if (vm.count(
"timing") || timingdb) {
173 raw_config.
put(
"services.TimeTracker.dbOutput.filename",
174 vm[
"timing-db"].as<std::string>());
175 }
else if (vm.count(
"no-timing")) {
176 raw_config.
erase(
"services.TimeTracker");
178 if (vm.count(
"memcheck-db")) {
179 raw_config.
put(
"services.MemoryTracker.dbOutput.filename",
180 vm[
"memcheck-db"].as<std::string>());
181 }
else if (vm.count(
"no-memcheck")) {
182 raw_config.
erase(
"services.MemoryTracker");
186 auto const message_key =
fhicl_key(
"services",
"message");
187 auto const dests_key =
fhicl_key(message_key,
"destinations");
189 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.categories.ArtReport.limit"),
191 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.categories.default.limit"), -1);
192 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.type"),
"cout");
193 raw_config.
put(
fhicl_key(dests_key,
"STDOUT.threshold"),
"INFO");
196 auto const& dests = raw_config.
get<
table_t const&>(dests_key);
199 for (
auto const& p : dests) {
200 std::string
const& dest_name = p.first;
201 if (dest_name ==
"statistics"s)
204 fhicl_key(dests_key, dest_name,
"categories.MTdiagnostics.limit"), 0);
208 auto const& stats_dest_key =
fhicl_key(dests_key,
"statistics");
210 auto const& stats_dests = raw_config.
get<
table_t const&>(stats_dest_key);
211 for (
auto const& p : stats_dests) {
212 std::string
const& dest_name = p.first;
214 fhicl_key(stats_dest_key, dest_name,
"categories.MTdiagnostics.limit"),
219 if (vm.count(
"mt-diagnostics") > 0) {
220 auto const dest = vm[
"mt-diagnostics"].as<std::string>();
225 fhicl_key(dests_key,
"STDOUT.categories.MTdiagnostics.limit"), -1);
229 auto const mt_dest_key =
fhicl_key(dests_key,
"MTdiagnostics");
234 raw_config.
put(
fhicl_key(mt_dest_key,
"filename"), dest);
236 raw_config.
put(
fhicl_key(mt_dest_key,
"categories.MTdiagnostics.limit"),
238 raw_config.
put(
fhicl_key(mt_dest_key,
"categories.default.limit"), 0);
int doProcessOptions(bpo::variables_map const &vm, fhicl::intermediate_table &raw_config) override
bool exists_outside_prolog(fhicl::intermediate_table const &config, std::string const &key)
int doCheckOptions(bpo::variables_map const &vm) override
std::enable_if_t< std::is_convertible_v< T, std::string >, std::string > fhicl_key(T const &name)
shims::map< std::string, extended_value > table_t
DebugOptionsHandler(bpo::options_description &desc)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool output_to_stderr(std::string const &spec)
bool output_to_stdout(std::string const &spec)