MueLu  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
26 namespace MueLu {
27 
30  static std::string getColonLabel(const std::string& label) {
31  if (label != "")
32  return label + ": ";
33  else
34  return "";
35  }
36 };
37 
41 class PrintMonitor : public BaseClass {
42  public:
44  PrintMonitor(const BaseClass& object, const std::string& msg, MsgType msgLevel = Runtime0);
45  ~PrintMonitor();
46 
47  private:
48  PrintMonitor();
49 
50  bool tabbed;
52 };
53 
68 class 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 
116 class 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 
137  ~SubMonitor();
138 
139  private:
142 };
143 
144 //---------------------------------------------------------------------------------------------------
145 
165 class FactoryMonitor : public Monitor {
166  public:
167  static int timerIdentifier_;
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 
191  ~FactoryMonitor();
192 
193  private:
200 };
201 
202 //---------------------------------------------------------------------------------------------------
203 
219  public:
228  SubFactoryMonitor(const BaseClass& object, const std::string& msg, int levelID, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
229 
238  SubFactoryMonitor(const BaseClass& object, const std::string& msg, const Level& level, MsgType msgLevel = Runtime1, MsgType timerLevel = Timings1);
239 
241 
242  private:
245 };
246 
247 } // namespace MueLu
248 
249 #endif // MUELU_MONITOR_HPP
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all children.
High level timing information (use Teuchos::TimeMonitor::summarize() to print)
Timer to be used in factories. Similar to Monitor but with additional timers.
Timer to be used in non-factories. Similar to Monitor, but doesn&#39;t print object description.
One-liner description of what is happening.
MutuallyExclusiveTimeMonitor< FactoryBase > timerMonitorExclusive_
Total time spent on all levels in this object only, excluding all children.
Integrates Teuchos::TimeMonitor with MueLu verbosity system.
static std::string getColonLabel(const std::string &label)
Helper function for object label.
Monitor(const BaseClass &object, const std::string &msg, MsgType msgLevel=Runtime0, MsgType timerLevel=Timings0)
Constructor.
Class that holds all level-specific information.
Definition: MueLu_Level.hpp:63
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all its children.
FactoryMonitor(const BaseClass &object, const std::string &msg, int levelID, MsgType msgLevel=static_cast< MsgType >(Test|Runtime0), MsgType timerLevel=Timings0)
Constructor.
Detailed timing information (use Teuchos::TimeMonitor::summarize() to print)
Timer to be used in factories. Similar to SubMonitor but adds a timer level by level.
Similar to TimeMonitor, but uses MutuallyExclusiveTime objects.
virtual ~Monitor()
TimeMonitor timerMonitor_
Base class for MueLu classes.
SubFactoryMonitor(const BaseClass &object, const std::string &msg, int levelID, MsgType msgLevel=Runtime1, MsgType timerLevel=Timings1)
Constructor.
Timer to be used in non-factories.
RCP< MutuallyExclusiveTimeMonitor< Level > > levelTimeMonitorExclusive_
Total time spent on this level in this object only, excluding all children.
PrintMonitor printMonitor_
Manages printing.
Description of what is happening (more verbose)
const BaseClass & object_
TimeMonitor timerMonitor_
Records total time spent in this object and all its children, over all levels.
PrintMonitor printMonitor_
SubMonitor(const BaseClass &object, const std::string &msg, MsgType msgLevel=Runtime1, MsgType timerLevel=Timings1)
Constructor.