41 return std::chrono::duration_cast<std::chrono::nanoseconds>(in);
48 return std::chrono::duration_cast<std::chrono::duration<double>>(in).count();
57 #if defined(ENABLE_TIMERS) 58 #ifdef USE_STACK_TIMERS 74 #if defined(ENABLE_TIMERS) 80 const std::string prefix_str(
"Prefix::");
85 #if defined(ENABLE_TIMERS) 109 TEST_CASE(
"test_timer_flat_profile_same_name",
"[utilities]")
117 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.1
s);
120 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.2
s);
121 for (
int i = 0; i < 3; i++)
157 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.1
s);
181 idx2 = p2.
nameList.at(
"timer1/timer2");
193 TEST_CASE(
"test_timer_nested_profile_two_children",
"[utilities]")
201 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.1
s);
228 TEST_CASE(
"test_timer_nested_profile_alt_routes",
"[utilities]")
239 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.1
s);
280 TEST_CASE(
"test_timer_nested_profile_collate",
"[utilities]")
290 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.1
s);
332 for (
int i = 0; i < StackKey::max_level + 1; i++)
343 std::vector<FakeTimer*> timer_list;
344 for (
int i = 0; i < StackKey::max_level + 1; i++)
346 std::ostringstream name;
347 name <<
"timer" << i;
348 FakeTimer* t = tm.createTimer(name.str());
349 timer_list.push_back(t);
352 for (
int i = 0; i < StackKey::max_level + 1; i++)
353 timer_list[i]->start();
355 for (
int i = StackKey::max_level; i >= 0; i--)
356 timer_list[i]->stop();
372 std::vector<FakeTimer*> timer_list;
373 for (
int i = 0; i < std::numeric_limits<timer_id_t>::max() + 1; i++)
375 std::ostringstream name;
376 name <<
"timer" << i;
377 FakeTimer* t = tm.createTimer(name.str());
378 timer_list.push_back(t);
405 FakeChronoClock::fake_chrono_clock_increment =
convert_to_ns(1.0
s);
class that handles xmlDoc
long get_num_calls() const
helper functions for EinsplineSetBuilder
TimerType< FakeChronoClock > FakeTimer
void output_timing(Communicate *comm, Libxml2Document &doc, xmlNodePtr root)
std::vector< TimerIDName_t< T > > TimerNameList_t
void collate_stack_profile(Communicate *comm, StackProfileData &p)
void newDoc(const std::string &rootName)
long num_calls
total call counts
Timer accumulates time and call counts.
Manager creates timers and handle reports.
FakeChronoClock::duration convert_to_ns(T in)
REQUIRE(std::filesystem::exists(filename))
TimerNameList_t< TestTimer > TestTimerNames
void collate_flat_profile(Communicate *comm, FlatProfileData &p)
bool timer_max_level_exceeded
double total_time
total time accumulated of all the calls
TIMER * createTimer(const std::string &myname, timer_levels mytimer=timer_level_fine)
Create a new timer object registred in this manager. This call is thread-safe.
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void set_timer_threshold(const timer_levels threshold)
StackKeyParam< 2 > StackKey
TimerManager< FakeTimer > FakeTimerManager
void dump(const std::string &newxml)
TEST_CASE("test setup timers", "[utilities]")
void set_total_time(TimerType< CLOCK > *timer, double total_time_input)
double convert_to_s(T in)
void set_num_calls(TimerType< CLOCK > *timer, long num_calls_input)