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_;
199 RCP<MutuallyExclusiveTimeMonitor<Level> > levelTimeMonitorExclusive_;
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:
244 RCP<TimeMonitor> levelTimeMonitor_;
245};
246
247} // namespace MueLu
248
249#endif // MUELU_MONITOR_HPP
Base class for MueLu classes.
FactoryMonitor(const BaseClass &object, const std::string &msg, int levelID, MsgType msgLevel=static_cast< MsgType >(Test|Runtime0), MsgType timerLevel=Timings0)
Constructor.
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all its children.
RCP< MutuallyExclusiveTimeMonitor< Level > > levelTimeMonitorExclusive_
Total time spent on this level in this object only, excluding all children.
MutuallyExclusiveTimeMonitor< FactoryBase > timerMonitorExclusive_
Total time spent on all levels in this object only, excluding all children.
Class that holds all level-specific information.
TimeMonitor timerMonitor_
Records total time spent in this object and all its children, over all levels.
virtual ~Monitor()
Monitor(const BaseClass &object, const std::string &msg, MsgType msgLevel=Runtime0, MsgType timerLevel=Timings0)
Constructor.
PrintMonitor printMonitor_
Manages printing.
Similar to TimeMonitor, but uses MutuallyExclusiveTime objects.
PrintMonitor(const BaseClass &object, const std::string &msg, MsgType msgLevel=Runtime0)
Constructor.
const BaseClass & object_
RCP< TimeMonitor > levelTimeMonitor_
Total time spent on this level in this object and all children.
SubFactoryMonitor(const BaseClass &object, const std::string &msg, int levelID, MsgType msgLevel=Runtime1, MsgType timerLevel=Timings1)
Constructor.
TimeMonitor timerMonitor_
PrintMonitor printMonitor_
SubMonitor(const BaseClass &object, const std::string &msg, MsgType msgLevel=Runtime1, MsgType timerLevel=Timings1)
Constructor.
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.