Repo-Init
 
Loading...
Searching...
No Matches
Performance.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <prometheus/registry.h>
4
14 private:
15 std::chrono::high_resolution_clock::time_point _startTime;
16 prometheus::Summary *_perfTiming;
17 prometheus::Gauge *_maxTiming;
18 prometheus::Gauge *_minTiming;
19
20 public:
27 PerformanceTracker(const std::shared_ptr<prometheus::Registry> &reg, const std::string &name,
28 uint64_t metricID = 0);
29
33 void startTimer();
34
39 double endTimer();
40};
41
52 private:
54
55 public:
60 explicit TrackPerformance(PerformanceTracker &tracker) : _tracker(tracker) { _tracker.startTimer(); }
61
66
67 // Non-copyable and non-movable
68 TrackPerformance(const TrackPerformance & /*unused*/) = delete;
69 TrackPerformance(TrackPerformance && /*unused*/) = delete;
70 TrackPerformance &operator=(const TrackPerformance & /*unused*/) = delete;
72};
prometheus::Gauge * _minTiming
Minimum observed value.
std::chrono::high_resolution_clock::time_point _startTime
Set after startTimer to measure counter difference.
PerformanceTracker(const std::shared_ptr< prometheus::Registry > &reg, const std::string &name, uint64_t metricID=0)
prometheus::Summary * _perfTiming
Overall performance.
prometheus::Gauge * _maxTiming
Maximum observed value.
TrackPerformance(TrackPerformance &&)=delete
TrackPerformance & operator=(const TrackPerformance &)=delete
TrackPerformance(PerformanceTracker &tracker)
TrackPerformance(const TrackPerformance &)=delete
TrackPerformance & operator=(TrackPerformance &&)=delete
PerformanceTracker & _tracker
Reference to the PerformanceTracker object.