GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSProfilerManager.hh
Go to the documentation of this file.
1 #ifndef GUARD_GGEMS_TOOLS_GGEMSPROFILERMANAGER_HH
2 #define GUARD_GGEMS_TOOLS_GGEMSPROFILERMANAGER_HH
3 
4 // ************************************************************************
5 // * This file is part of GGEMS. *
6 // * *
7 // * GGEMS is free software: you can redistribute it and/or modify *
8 // * it under the terms of the GNU General Public License as published by *
9 // * the Free Software Foundation, either version 3 of the License, or *
10 // * (at your option) any later version. *
11 // * *
12 // * GGEMS is distributed in the hope that it will be useful, *
13 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 // * GNU General Public License for more details. *
16 // * *
17 // * You should have received a copy of the GNU General Public License *
18 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
19 // * *
20 // ************************************************************************
21 
34 #ifdef _MSC_VER
35 #pragma warning(disable: 4251) // Deleting warning exporting STL members!!!
36 #endif
37 
38 #include <unordered_map>
40 
41 typedef std::unordered_map<std::string, GGEMSProfiler> ProfilerUMap;
47 class GGEMS_EXPORT GGEMSProfilerManager
48 {
49  private:
54 
58  ~GGEMSProfilerManager(void);
59 
60  public:
67  {
68  static GGEMSProfilerManager instance;
69  return instance;
70  }
71 
77  GGEMSProfilerManager(GGEMSProfilerManager const& profiler_manager) = delete;
78 
84  GGEMSProfilerManager& operator=(GGEMSProfilerManager const& profiler_manager) = delete;
85 
91  GGEMSProfilerManager(GGEMSProfilerManager const&& profiler_manager) = delete;
92 
98  GGEMSProfilerManager& operator=(GGEMSProfilerManager const&& profiler_manager) = delete;
99 
106  void HandleEvent(cl::Event event, std::string const& profile_name);
107 
112  void PrintSummaryProfile(void) const;
113 
118  void Reset(void);
119 
124  void Clean(void);
125 
126  private:
128 };
129 
135 extern "C" GGEMS_EXPORT GGEMSProfilerManager* get_instance_profiler_manager(void);
136 
142 extern "C" GGEMS_EXPORT void print_summary_profiler_manager(GGEMSProfilerManager* profiler_manager);
143 
144 #endif // End of GUARD_GGEMS_TOOLS_GGEMSPROFILERMANAGER_HH
GGEMSProfilerManager::GetInstance
static GGEMSProfilerManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSProfilerManager.hh:66
GGEMSProfilerManager::operator=
GGEMSProfilerManager & operator=(GGEMSProfilerManager const &profiler_manager)=delete
Avoid assignement of the class by reference.
get_instance_profiler_manager
GGEMSProfilerManager * get_instance_profiler_manager(void)
Get the GGEMSProfilerManager pointer for python user.
Definition: GGEMSProfilerManager.cc:113
GGEMSProfilerManager
GGEMS class managing profiler data.
Definition: GGEMSProfilerManager.hh:48
GGEMSProfilerManager::operator=
GGEMSProfilerManager & operator=(GGEMSProfilerManager const &&profiler_manager)=delete
Avoid copy of the class by rvalue reference.
print_summary_profiler_manager
void print_summary_profiler_manager(GGEMSProfilerManager *profiler_manager)
Print summary of profiler.
Definition: GGEMSProfilerManager.cc:122
GGEMSProfilerManager::GGEMSProfilerManager
GGEMSProfilerManager(GGEMSProfilerManager const &&profiler_manager)=delete
Avoid copy of the class by rvalue reference.
GGEMSProfilerManager::profilers_
ProfilerUMap profilers_
Definition: GGEMSProfilerManager.hh:127
GGEMSProfilerManager::GGEMSProfilerManager
GGEMSProfilerManager(GGEMSProfilerManager const &profiler_manager)=delete
Avoid copy of the class by reference.
ProfilerUMap
std::unordered_map< std::string, GGEMSProfiler > ProfilerUMap
Definition: GGEMSProfilerManager.hh:41
GGEMSProfiler.hh
GGEMS class handling a specific profiler type.