<ol>
- <li> Fixed: TimerOutput constructed with an MPI_COMM in wall_time
- mode now constructs synchronized Timer objects. This gives reliable
- parallel benchmark timings.
- <br>
- (Timo Heister, 2013/04/18)
- </li>
-
<li> New: The step-49 tutorial program now also has a discussion on
what to do once you have a coarse mesh and want to refine it.
<br>
<ol>
+<li> New: class TimerOutput::Scope does automatic scope based enter/
+exit_section of a TimerOutput object.
+<br>
+(Timo Heister, 2013/04/18)
+</li>
+
+<li> Fixed: TimerOutput constructed with an MPI_COMM in wall_time
+mode now constructs synchronized Timer objects. This gives reliable
+parallel benchmark timings.
+<br>
+(Timo Heister, 2013/04/18)
+</li>
+
<li> Improved and Fixed: LogStream (and deallog) now respect std::flush in
addition to std::endl to write out content to the console/file.
Furthermore, LogStream::push(...) and LogStream::pop() now work in a thread
class TimerOutput
{
public:
+ /**
+ * Helper class to enter/exit sections in TimerOutput be constructing
+ * a simple scope-based object.
+ */
+ class Scope
+ {
+ public:
+ /**
+ * Enter the given section in the timer. Exit automatically when calling
+ * stop() or destructor runs.
+ */
+ Scope(dealii::TimerOutput &timer_, const std::string §ion_name);
+
+ /**
+ * Destructor calls stop()
+ */
+ ~Scope();
+
+ /**
+ * In case you want to exit the scope before the destructor is executed,
+ * call this function.
+ */
+ void stop();
+
+ private:
+ /**
+ * Reference to the TimerOutput object
+ */
+ dealii::TimerOutput & timer;
+ /**
+ * Do we still need to exit the section we are in?
+ */
+ bool in;
+ };
+
/**
* Sets whether to generate output every
* time we exit a section, just in the
leave_subsection(section_name);
}
+inline
+TimerOutput::Scope::Scope(dealii::TimerOutput &timer_, const std::string §ion_name)
+:
+timer(timer_), in(true)
+{
+ timer.enter_section(section_name);
+}
+
+inline
+TimerOutput::Scope::~Scope()
+{
+ stop();
+}
+
+inline
+void
+TimerOutput::Scope::stop()
+{
+ if (!in) return;
+ in=false;
+
+ timer.exit_section();
+}
+
DEAL_II_NAMESPACE_CLOSE