Zoltan2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Zoltan2_TimerManager.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Zoltan2: A package of combinatorial algorithms for scientific computing
4 //
5 // Copyright 2012 NTESS and the Zoltan2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
14 #ifndef ZOLTAN2_TIMERMANAGER_HPP
15 #define ZOLTAN2_TIMERMANAGER_HPP
16 
17 #include <Zoltan2_Standards.hpp>
18 #include <Zoltan2_Parameters.hpp>
19 #include <Teuchos_TimeMonitor.hpp>
20 
21 #include <map>
22 #include <iostream>
23 #include <fstream>
24 #include <bitset>
25 
26 namespace Zoltan2{
27 
28 class TimerManager {
29 
30 private:
31  RCP<const Comm<int> > comm_;
32  std::ostream *myOS_;
33  std::ofstream *fileOS_;
34  TimerType ttype_;
35  std::bitset<NUM_TIMING_OPTIONS> typeSelector_;
36 
37  Array<RCP<Teuchos::Time> > timers_;
38  std::map<std::string, int> timerMap_;
39  int stopHint_;
40 
41 public:
42 
45  TimerManager(const RCP<const Comm<int> > & comm, std::ofstream *of,
46  TimerType tt);
47 
50  TimerManager(const RCP<const Comm<int> > & comm, std::ostream *os,
51  TimerType tt);
52 
55  ~TimerManager();
56 
59  void start(TimerType tt, const std::string &name);
60 
63  void stop(TimerType tt, const std::string &name);
64 
67  void printAndResetToZero();
68 
71  void print() const;
72 };
73 
74 } // namespace Zoltan2
75 
76 #endif
Defines Parameter related enumerators, declares functions.
TimerType
The type of timers which should be active.
void print() const
Print out global summary, do not reset timers.
TimerManager(const RCP< const Comm< int > > &comm, std::ofstream *of, TimerType tt)
Constructor for output to a file.
void printAndResetToZero()
Print out global summary of timers and reset timers to zero.
Gathering definitions used in software development.
void stop(TimerType tt, const std::string &name)
Stop the named timer.
void start(TimerType tt, const std::string &name)
Start the named timer.