PerformanceMonitor.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
23 //----------------------------------------------------------------------/*
24 
25 #ifndef ICL_CORE_TIMER_H
26 #define ICL_CORE_TIMER_H
27 
28 #include <string>
29 #include <vector>
30 #include <map>
31 #include <ostream>
32 
36 
37 
38 #include <icl_core/TimeStamp.h>
39 
40 namespace icl_core {
41 namespace perf_mon{
42 
43 
70 {
71 public:
78  static PerformanceMonitor* getInstance();
79 
88  static void initialize(const uint32_t num_names, const uint32_t num_events);
89 
94  static void start(std::string timer_name);
95 
105  static double measurement(std::string timer_name, std::string description, std::string prefix = "",
107 
118  static double startStop(std::string timer_name, std::string description, std::string prefix = "",
120 
127  static void addData(std::string name, double data, std::string prefix);
128 
136  static void addStaticData(std::string name, double data, std::string prefix);
137 
146  static void addNonTimeData(std::string name, double data, std::string prefix);
147 
152  static void enablePrefix(std::string prefix);
153 
160  static void enableAll(const bool& enabled);
161 
166  static void disablePrefix(std::string prefix);
167 
174  static void printSummary(std::string prefix, std::string name,
176 
183  static void printSummaryAll(icl_core::logging::LogLevel level = icl_core::logging::eLL_INFO);
184 
185 
191  static void printSummaryFromPrefix(std::string prefix, icl_core::logging::LogLevel level = icl_core::logging::eLL_INFO);
192 
194  bool m_enabled;
197 
198 protected:
203 
205  void createStatisticSummary(std::stringstream& ss, std::string prefix, std::string name);
206  void createStatisticSummaryNonTime(std::stringstream& ss, std::string prefix, std::string name);
207 
208 
210  void print(std::string message, icl_core::logging::LogLevel level = icl_core::logging::eLL_DEBUG);
211 
213  void addEvent(std::string prefix, std::string name, double data);
214  void addNonTimeEvent(std::string prefix, std::string name, double data);
215 
217  bool isEnabled(std::string prefix);
218 
220  double getAverage(std::string name);
221  double getAverageNonTime(std::string name);
222 
224  void getMedian(std::string name, double& median, double& min, double& max);
225  void getMedianNonTime(std::string name, double& median, double& min, double& max);
226 
227  std::map<std::string, std::vector<double> > m_data;
228  std::map<std::string, std::vector<double> > m_data_nontime;
229  std::map<std::string, TimeStamp> m_timer;
230  std::vector<std::vector<double> > m_buffer;
231  std::map<std::string, bool> m_enabled_prefix;
232  std::map<std::string, double > m_static_data;
233 
235 
236 
237 private:
239 };
240 
241 
242 } // namespace perf_mon
243 } // namespace icl_core
244 
245 #endif /* ICL_CORE_TIMER_H */
static PerformanceMonitor * m_instance
unsigned int uint32_t
Definition: msvc_stdint.h:93
bool initialize(int &argc, char *argv[], bool remove_read_arguments)
Definition: Config.cpp:50
std::map< std::string, double > m_static_data
bool m_print_stop
if set to false, the performance monitor won&#39;t print measurement events
#define ICL_CORE_PERFORMANCE_MONITOR_EXPORT
The PerformanceMonitor class provides an easy to use tool for performance measurement.
std::map< std::string, TimeStamp > m_timer
std::vector< std::vector< double > > m_buffer
std::map< std::string, bool > m_enabled_prefix
Contains import/export definitions for the Win32 plattform.
std::map< std::string, std::vector< double > > m_data_nontime
bool m_enabled
if set to false, the performance monitor will be non-operational
Contains TimeStamp.
std::map< std::string, std::vector< double > > m_data


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58