56 std::string cleanupLabel(
const std::string& label) {
59 auto clean_label = label;
60 std::vector<std::string> bad_values = {
"\""};
61 std::vector<std::string> good_values = {
"'"};
62 for(
size_t i=0; i<bad_values.size(); ++i){
63 const auto & bad_value = bad_values[i];
64 const auto & good_value = good_values[i];
66 while ( ( pos = clean_label.find( bad_value, pos ) ) != std::string::npos ){
67 clean_label.replace( pos, bad_value.size(), good_value );
68 pos += good_value.size();
85 timer_ = Teuchos::TimeMonitor::getNewTimer(cleanupLabel(
"MueLu: " + msg));
87 timer_ = rcp(
new Teuchos::Time(cleanupLabel(
"MueLu: " + msg)));
92 timer_->incrementNumCalls();
93#ifdef HAVE_TEUCHOS_ADD_TIME_MONITOR_TO_STACKED_TIMER
94 const auto stackedTimer = Teuchos::TimeMonitor::getStackedTimer();
95 if (nonnull(stackedTimer))
96 stackedTimer->start(
timer_->name());
105 if (
timer_ != Teuchos::null) {
107#ifdef HAVE_TEUCHOS_ADD_TIME_MONITOR_TO_STACKED_TIMER
109 const auto stackedTimer = Teuchos::TimeMonitor::getStackedTimer();
110 if (nonnull(stackedTimer))
111 stackedTimer->stop(
timer_->name());
113 catch (std::runtime_error&) {
114 std::ostringstream warning;
116 "\n*********************************************************************\n"
117 "WARNING: Overlapping timers detected!\n"
118 "A TimeMonitor timer was stopped before a nested subtimer was\n"
119 "stopped. This is not allowed by the StackedTimer. This corner case\n"
120 "typically occurs if the TimeMonitor is stored in an RCP and the RCP is\n"
121 "assigned to a new timer. To disable this warning, either fix the\n"
122 "ordering of timer creation and destuction or disable the StackedTimer\n";
123 std::cout << warning.str() << std::endl;
124 Teuchos::TimeMonitor::setStackedTimer(Teuchos::null);
Base class for MueLu classes.
Similar to TimeMonitor, but uses MutuallyExclusiveTime objects.
RCP< Teuchos::Time > timer_
VerbLevel GetVerbLevel() const
Get the verbosity level.
int SetProcRankVerbose(int procRank) const
Set proc rank used for printing.
void SetVerbLevel(const VerbLevel verbLevel)
Set the verbosity level of this object.
bool IsPrint(MsgType type, int thisProcRankOnly=-1) const
Find out whether we need to print out information for a specific message type.
int GetProcRankVerbose() const
Get proc rank used for printing. Do not use this information for any other purpose.
Namespace for MueLu classes and methods.
@ RuntimeTimings
Timers that are enabled (using Timings0/Timings1) will be printed during the execution.
@ NoTimeReport
By default, enabled timers appears in the teuchos time monitor summary. Use this option if you do not...