ryujin 2.1.1 revision 0348cbb53a3e4b1da2a4c037e81f88f2d21ce219
scope.h
Go to the documentation of this file.
1//
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3// Copyright (C) 2020 - 2021 by the ryujin authors
4//
5
6#pragma once
7
8#include <deal.II/base/timer.h>
9
10#include <map>
11#include <string>
12
13namespace ryujin
14{
23 class Scope
24 {
25 public:
29 Scope(std::map<std::string, dealii::Timer> &computing_timer,
30 const std::string &section)
31 : computing_timer_(computing_timer)
32 , section_(section)
33 {
34 computing_timer_[section_].start();
35#ifdef DEBUG_OUTPUT
36 std::cout << "{scoped timer} \"" << section_ << "\" started" << std::endl;
37#endif
38 }
39
44 {
45#ifdef DEBUG_OUTPUT
46 std::cout << "{scoped timer} \"" << section_ << "\" stopped" << std::endl;
47#endif
48 computing_timer_[section_].stop();
49 }
50
51 private:
52 std::map<std::string, dealii::Timer> &computing_timer_;
53 const std::string section_;
54 };
55} // namespace ryujin
Scope(std::map< std::string, dealii::Timer > &computing_timer, const std::string &section)
Definition: scope.h:29