AJA NTV2 SDK  17.1.1.1245
NTV2 SDK 17.1.1.1245
performance.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef AJA_PERFORMANCE_H
9 #define AJA_PERFORMANCE_H
10 
12 // Includes
14 #include "ajabase/common/timer.h"
15 #include <string>
16 #include <map>
17 
18 typedef std::map<std::string, uint64_t> AJAPerformanceExtraMap;
19 
21 // Declarations
24 {
25  public:
34  AJAPerformance(const std::string& name,
36  uint64_t skipEntries = 0);
37 
47  AJAPerformance(const std::string& name, const AJAPerformanceExtraMap& values,
49  uint64_t skipEntries = 0);
50 
59  uint64_t skipEntries = 0);
60 
61  ~AJAPerformance(void);
62 
68  void SetExtras(const AJAPerformanceExtraMap& values);
69 
73  void Start(void);
74 
79  void Stop(void);
80 
87  void Report(const std::string& name = "", const char *pFileName = NULL, int32_t lineNumber = -1);
88 
92  std::string Name(void);
93 
97  AJATimerPrecision Precision(void);
98 
102  uint64_t Entries(void);
103 
107  uint64_t TotalTime(void);
108 
112  uint64_t MinTime(void);
113 
117  uint64_t MaxTime(void);
118 
122  double Mean(void);
123 
127  double Variance(void);
128 
132  double StandardDeviation(void);
133 
137  const AJAPerformanceExtraMap Extras(void);
138 
139  private:
140  AJATimer mTimer;
141  std::string mName;
142  uint64_t mTotalTime;
143  uint64_t mEntries;
144  uint64_t mMinTime;
145  uint64_t mMaxTime;
146  double mMean;
147  double mM2;
148  uint64_t mNumEntriesToSkipAtStart;
149 
150  AJAPerformanceExtraMap mExtras;
151 };
152 
153 // Helper functions to track/report many performance timers and store in a map
154 typedef std::map<std::string, AJAPerformance> AJAPerformanceTracking;
155 
157  std::string key,
159  uint64_t skipEntries = 0);
160 
162  std::string key, const AJAPerformanceExtraMap& extras,
164  uint64_t skipEntries = 0);
165 
166 extern bool AJAPerformanceTracking_stop(AJAPerformanceTracking& stats, std::string key);
167 
168 extern bool AJAPerformanceTracking_report(AJAPerformanceTracking& stats, std::string title = "",
169  const char *pFileName = NULL, int32_t lineNumber = -1);
170 
171 
172 #endif // AJA_PERFORMANCE_H
173 
AJAPerformance
Definition: performance.h:23
AJAPerformanceTracking_stop
bool AJAPerformanceTracking_stop(AJAPerformanceTracking &stats, std::string key)
Definition: performance.cpp:269
AJAPerformanceTracking_start
bool AJAPerformanceTracking_start(AJAPerformanceTracking &stats, std::string key, AJATimerPrecision precision=AJATimerPrecisionMilliseconds, uint64_t skipEntries=0)
Definition: performance.cpp:224
NULL
#define NULL
Definition: ntv2caption608types.h:19
AJATimerPrecision
AJATimerPrecision
Definition: timer.h:14
AJAPerformanceExtraMap
std::map< std::string, uint64_t > AJAPerformanceExtraMap
Definition: performance.h:18
timer.h
Declares the AJATimer class.
AJATimer
Definition: timer.h:25
AJAPerformanceTracking
std::map< std::string, AJAPerformance > AJAPerformanceTracking
Definition: performance.h:154
AJAExport
#define AJAExport
Definition: export.h:33
AJAPerformanceTracking_report
bool AJAPerformanceTracking_report(AJAPerformanceTracking &stats, std::string title="", const char *pFileName=NULL, int32_t lineNumber=-1)
Definition: performance.cpp:283
AJATimerPrecisionMilliseconds
@ AJATimerPrecisionMilliseconds
Definition: timer.h:16