8 #ifndef META_OCEAN_BASE_HIGH_PERFORMANCE_TIMER_H
9 #define META_OCEAN_BASE_HIGH_PERFORMANCE_TIMER_H
92 static inline double ticks2seconds(
const Ticks ticks);
108 #ifdef OCEAN_USE_EXTERNAL_PRIVACY_CONFIRM_TICKS
187 inline double first()
const;
193 inline double firstMseconds()
const;
199 inline double second()
const;
205 inline double secondMseconds()
const;
211 inline double best()
const;
217 inline double bestMseconds()
const;
223 inline double worst()
const;
229 inline double worstMseconds()
const;
235 inline double last()
const;
241 inline double lastMseconds()
const;
253 inline double averageMseconds()
const;
261 inline double averageCyclesPerOperation(
const double operations,
const double clockRate = 3800000000.0)
const;
293 inline double total()
const;
299 inline double totalMseconds()
const;
305 inline double running()
const;
311 inline double runningMseconds()
const;
317 inline size_t measurements()
const;
323 inline bool isRunning()
const;
370 std::string
toString(
const unsigned int precision = 2u)
const;
376 explicit inline operator bool()
const;
394 double best_ = DBL_MAX;
397 double worst_ = -DBL_MAX;
403 bool started_ =
false;
564 bool reportAsTokenMatrix(std::vector<std::vector<Value>>& tokenMatrix,
const double referenceSeconds = 0.0,
const unsigned numberIndentationSpace = 0u,
const std::string& categoryNameDelimiter =
"::",
const bool addColumnDescriptions =
false,
const bool valuesAsStrings =
true,
const bool includeSubCategories =
true)
const;
632 inline void change(std::string name);
695 std::vector<std::string>
report(
const std::string& referenceCategory = std::string())
const;
711 bool reportWithHierarchies(std::vector<std::string>& report,
const std::string& referenceCategory = std::string(),
const std::string& categoryNameDelimiter =
"::")
const;
774 statisticPerformance(&performance)
786 if (statisticPerformance)
788 statisticPerformance->stop();
789 statisticPerformance =
nullptr;
795 ticksStart_ = ticks();
800 ocean_assert(precision() !=
Ticks(0));
801 return double(ticks) / double(precision());
861 return best_ * 1000.0;
911 ocean_assert(operations > 0.0 && clockRate > 0.0);
913 const double seconds =
average();
919 const double operationsPerSecond = operations / seconds;
920 ocean_assert(operationsPerSecond > 0.0);
922 const double cyclesPerOperation = clockRate / operationsPerSecond;
924 return cyclesPerOperation;
934 return total() * 1000.0;
957 inline HighPerformanceStatistic::operator bool()
const
965 stream << highPerformanceStatistic.
toString();
970 template <
bool tActive>
973 messageObject << highPerformanceStatistic.toString();
975 return messageObject;
978 template <
bool tActive>
981 messageObject << highPerformanceStatistic.toString();
983 return messageObject;
987 name_(std::move(name)),
1008 ocean_assert(startTicks_ <= stopTicks);
1030 name_ = std::move(name);
This class implements a recursive lock object.
Definition: Lock.h:31
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
static HighPerformanceBenchmark & get()
Returns a reference to the unique object.
Definition: Singleton.h:115
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15
std::ostream & operator<<(std::ostream &stream, const HighPerformanceStatistic &highPerformanceStatistic)
Definition: HighPerformanceTimer.h:963
uint64_t HighPerformanceTimer_externalPrivacyConfirmTicks()
Returns the recent CPU ticks which will contain a random offset which is constant through the executi...