23namespace MultiProcess {
39 ProcessTimer::duration_map_t::key_type sec_name;
40 ProcessTimer::duration_map_t::mapped_type duration_list;
42 std::tie(sec_name, duration_list) = std::move(durations_element);
43 if (sec_name != to_return)
48 throw ::invalid_argument(
"section name " + to_return +
49 " not found in timer map, so it cannot"
59 }
else if (it->second.size() % 2 != 0) {
61 throw ::invalid_argument(
"Section name " + section_name +
62 " timer has already started, and was not stopped before calling `start_timer`");
65 it->second.push_back(chrono::steady_clock::now());
74 throw ::invalid_argument(
"Section name " + section_name +
" timer was never started!");
75 }
else if (it->second.size() % 2 == 0) {
77 throw ::invalid_argument(
"Section name " + section_name +
78 " timer does exist, but was not started before calling `end_timer`");
81 it->second.push_back(chrono::steady_clock::now());
96 ProcessTimer::duration_map_t::key_type sec_name;
97 ProcessTimer::duration_map_t::mapped_type duration_list;
99 std::tie(sec_name, duration_list) = std::move(durations_element);
100 if (to_print !=
"all" && sec_name != to_print)
104 long total_duration = 0;
105 cout <<
"Section name " << sec_name <<
":" << endl;
106 for (
auto it = duration_list.begin(); it != duration_list.end(); ++it) {
107 long duration = chrono::duration_cast<chrono::milliseconds>(*std::next(it) - *it).count();
108 cout <<
"Duration " << i <<
": " << duration <<
"ms +" << endl;
109 total_duration += duration;
112 cout <<
"--------------------" << endl <<
"Total: " << total_duration <<
"ms" << endl << endl;
119 ProcessTimer::duration_map_t::key_type sec_name;
120 ProcessTimer::duration_map_t::mapped_type duration_list;
122 std::tie(sec_name, duration_list) = std::move(durations_element);
124 cout <<
"Section name " << sec_name <<
":" << endl;
125 for (
auto it = duration_list.begin(); it != duration_list.end(); ++it) {
126 long duration_since_begin_start =
129 long duration_since_begin_end =
132 cout <<
"Duration " << i <<
": " << duration_since_begin_start <<
"ms-->" << duration_since_begin_end <<
"ms"
145 list<long> durations_since_begin;
147 ProcessTimer::duration_map_t::key_type sec_name;
148 ProcessTimer::duration_map_t::mapped_type duration_list;
150 std::tie(sec_name, duration_list) = std::move(durations_element);
151 durations_since_begin.clear();
152 for (
auto const ×tamp : duration_list) {
153 durations_since_begin.push_back(
156 j[sec_name] = durations_since_begin;
158 file << std::setw(4) << j;
166 meta.push_back(std::move(
data));
167 j[
"metadata"] = meta;
169 file << std::setw(4) << j;
180 meta[
"write_interval"] =
true;
181 j[
"metadata"] = meta;
183 file << std::setw(4) << j;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
static void add_metadata(json data)
static void print_timestamps()
static void set_write_interval(int write_interval)
static void print_durations(std::string to_print="all")
static std::chrono::time_point< std::chrono::steady_clock > begin
static std::list< std::chrono::time_point< std::chrono::steady_clock > > get_durations(std::string section_name)
static pid_t get_process()
static std::chrono::time_point< std::chrono::steady_clock > previous_write
static void start_timer(std::string section_name)
std::map< std::string, std::list< std::chrono::time_point< std::chrono::steady_clock > > > duration_map_t
static int write_interval
static duration_map_t durations
static void end_timer(std::string section_name)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...