MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_Monitor.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_MONITOR_HPP
11#define MUELU_MONITOR_HPP
12
13#include <string>
14#include <algorithm> // for swap
15#include <ostream> // for basic_ostream, operator<<, etc
16#include "Teuchos_FancyOStream.hpp" // for OSTab, FancyOStream
17#include "Teuchos_RCPDecl.hpp" // for RCP
18#include "Teuchos_RCP.hpp" // for RCP::RCP<T>, RCP::operator=, etc
19#include "Teuchos_Utils.hpp" // for Utils
20#include "MueLu_VerbosityLevel.hpp" // for MsgType, MsgType::Runtime0, etc
21#include "MueLu_BaseClass.hpp"
23#include "MueLu_Level.hpp"
24#include "MueLu_TimeMonitor.hpp"
25
26namespace MueLu {
27
30 static std::string getColonLabel(const std::string& label) {
31 if (label != "")
32 return label + ": ";
33 else
34 return "";
35 }
36};
37
41class PrintMonitor : public BaseClass {
42 public:
44 PrintMonitor(const BaseClass& object, const std::string& msg, MsgType msgLevel = Runtime0);
46
47 private:
49
50 bool tabbed;
52};
53
68class Monitor : public BaseClass {
69 public:
77 Monitor(const BaseClass& object, const std::string& msg, MsgType msgLevel = Runtime0, MsgType timerLevel = Timings0);
78
87 Monitor(const BaseClass& object, const std::string& msg, const std::string& label, MsgType msgLevel = Runtime0, MsgType timerLevel = Timings0);
88
89 virtual ~Monitor();
90
91 private:
96};
97
98//---------------------------------------------------------------------------------------------------
99
116class SubMonitor : public BaseClass {
117 public:
125 SubMonitor(const BaseClass& object, const std::string& msg, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
126
135 SubMonitor(const BaseClass& object, const std::string& msg, const std::string& label, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
136
138
139 private:
142};
143
144//---------------------------------------------------------------------------------------------------
145
165class FactoryMonitor : public Monitor {
166 public:
168
177 FactoryMonitor(const BaseClass& object, const std::string& msg, int levelID, MsgType msgLevel = static_cast<MsgType>(Test | Runtime0), MsgType timerLevel = Timings0);
178
189 FactoryMonitor(const BaseClass& object, const std::string& msg, const Level& level, MsgType msgLevel = static_cast<MsgType>(Test | Runtime0), MsgType timerLevel = Timings0);
190
192
193 private:
195 RCP<TimeMonitor> levelTimeMonitor_;
196};
197
198//---------------------------------------------------------------------------------------------------
199
215 public:
224 SubFactoryMonitor(const BaseClass& object, const std::string& msg, int levelID, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
225
234 SubFactoryMonitor(const BaseClass& object, const std::string& msg, const Level& level, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
235
237
238 private:
240 RCP<TimeMonitor> levelTimeMonitor_;
241};
242
243} // namespace MueLu
244
245#endif // MUELU_MONITOR_HPP
Base class for MueLu classes.
Timer to be used in factories. Similar to Monitor but with additional timers.
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all its children.
Class that holds all level-specific information.
Timer to be used in non-factories.
TimeMonitor timerMonitor_
Records total time spent in this object and all its children, over all levels.
virtual ~Monitor()
PrintMonitor printMonitor_
Manages printing.
const BaseClass & object_
Timer to be used in factories. Similar to SubMonitor but adds a timer level by level.
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all children.
Timer to be used in non-factories. Similar to Monitor, but doesn't print object description.
TimeMonitor timerMonitor_
PrintMonitor printMonitor_
Integrates Teuchos::TimeMonitor with MueLu verbosity system.
Namespace for MueLu classes and methods.
@ Timings1
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
@ Timings0
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
@ Runtime0
One-liner description of what is happening.
@ Runtime1
Description of what is happening (more verbose)
static std::string getColonLabel(const std::string &label)
Helper function for object label.