20using std::list, std::string, std::invalid_argument, std::cout, std::endl, std::to_string, std::ios;
21namespace chrono = std::chrono;
24namespace MultiProcess {
40 ProcessTimer::duration_map_t::key_type
sec_name;
50 throw ::invalid_argument(
"section name " +
to_return +
51 " not found in timer map, so it cannot"
61 }
else if (it->second.size() % 2 != 0) {
63 throw ::invalid_argument(
"Section name " +
section_name +
64 " timer has already started, and was not stopped before calling `start_timer`");
67 it->second.push_back(chrono::steady_clock::now());
76 throw ::invalid_argument(
"Section name " +
section_name +
" timer was never started!");
77 }
else if (it->second.size() % 2 == 0) {
79 throw ::invalid_argument(
"Section name " +
section_name +
80 " timer does exist, but was not started before calling `end_timer`");
83 it->second.push_back(chrono::steady_clock::now());
98 ProcessTimer::duration_map_t::key_type
sec_name;
107 cout <<
"Section name " <<
sec_name <<
":" << endl;
109 long duration = chrono::duration_cast<chrono::milliseconds>(*std::next(it) - *it).count();
110 cout <<
"Duration " << i <<
": " <<
duration <<
"ms +" << endl;
114 cout <<
"--------------------" << endl <<
"Total: " <<
total_duration <<
"ms" << endl << endl;
121 ProcessTimer::duration_map_t::key_type
sec_name;
126 cout <<
"Section name " <<
sec_name <<
":" << endl;
149 ProcessTimer::duration_map_t::key_type
sec_name;
160 file << std::setw(4) <<
j;
170 j[
"metadata"] =
meta;
172 file << std::setw(4) <<
j;
184 meta[
"write_interval"] =
true;
185 j[
"metadata"] =
meta;
187 file << std::setw(4) <<
j;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
const_iterator begin() const
const_iterator end() const
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()
std::map< std::string, std::list< std::chrono::time_point< std::chrono::steady_clock > > > duration_map_t
static std::chrono::time_point< std::chrono::steady_clock > previous_write
static void start_timer(std::string section_name)
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...