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
13
class
PerformanceTracker
{
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> ®,
const
std::string &name,
28
uint64_t metricID = 0);
29
33
void
startTimer
();
34
39
double
endTimer
();
40
};
41
51
class
TrackPerformance
{
52
private
:
53
PerformanceTracker
&
_tracker
;
54
55
public
:
60
explicit
TrackPerformance
(
PerformanceTracker
&tracker) :
_tracker
(tracker) {
_tracker
.
startTimer
(); }
61
65
~TrackPerformance
() {
_tracker
.
endTimer
(); }
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
;
71
TrackPerformance
&
operator=
(
TrackPerformance
&&
/*unused*/
) =
delete
;
72
};
PerformanceTracker
Definition
Performance.hpp:13
PerformanceTracker::_minTiming
prometheus::Gauge * _minTiming
Minimum observed value.
Definition
Performance.hpp:18
PerformanceTracker::endTimer
double endTimer()
Definition
Performance.cpp:36
PerformanceTracker::_startTime
std::chrono::high_resolution_clock::time_point _startTime
Set after startTimer to measure counter difference.
Definition
Performance.hpp:15
PerformanceTracker::startTimer
void startTimer()
Definition
Performance.cpp:34
PerformanceTracker::PerformanceTracker
PerformanceTracker(const std::shared_ptr< prometheus::Registry > ®, const std::string &name, uint64_t metricID=0)
Definition
Performance.cpp:12
PerformanceTracker::_perfTiming
prometheus::Summary * _perfTiming
Overall performance.
Definition
Performance.hpp:16
PerformanceTracker::_maxTiming
prometheus::Gauge * _maxTiming
Maximum observed value.
Definition
Performance.hpp:17
TrackPerformance
Definition
Performance.hpp:51
TrackPerformance::TrackPerformance
TrackPerformance(TrackPerformance &&)=delete
TrackPerformance::operator=
TrackPerformance & operator=(const TrackPerformance &)=delete
TrackPerformance::TrackPerformance
TrackPerformance(PerformanceTracker &tracker)
Definition
Performance.hpp:60
TrackPerformance::TrackPerformance
TrackPerformance(const TrackPerformance &)=delete
TrackPerformance::operator=
TrackPerformance & operator=(TrackPerformance &&)=delete
TrackPerformance::_tracker
PerformanceTracker & _tracker
Reference to the PerformanceTracker object.
Definition
Performance.hpp:53
TrackPerformance::~TrackPerformance
~TrackPerformance()
Definition
Performance.hpp:65
include
metrics
Performance.hpp
Generated on Sun Nov 10 2024 08:35:45 for Repo-Init by
1.11.0