ryujin 2.1.1 revision 46bf70e400e423a8ffffe8300887eeb35b8dfb2c
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 <compile_time_options.h>
9
10#include <deal.II/base/timer.h>
11
12#include <map>
13#include <string>
14
15namespace ryujin
16{
25 class Scope
26 {
27 public:
31 Scope(std::map<std::string, dealii::Timer> &computing_timer,
32 const std::string &section)
33 : computing_timer_(computing_timer)
34 , section_(section)
35 {
36 computing_timer_[section_].start();
37#ifdef DEBUG_OUTPUT
38 std::cout << "{scoped timer} \"" << section_ << "\" started" << std::endl;
39#endif
40 }
41
46 {
47#ifdef DEBUG_OUTPUT
48 std::cout << "{scoped timer} \"" << section_ << "\" stopped" << std::endl;
49#endif
50 computing_timer_[section_].stop();
51 }
52
53 private:
54 std::map<std::string, dealii::Timer> &computing_timer_;
55 const std::string section_;
56 };
57} // namespace ryujin
Scope(std::map< std::string, dealii::Timer > &computing_timer, const std::string &section)
Definition: scope.h:31