9 #ifndef CPPBENCHMARK_PHASE_METRICS_H
10 #define CPPBENCHMARK_PHASE_METRICS_H
69 int64_t
total_time() const noexcept {
return _total_time; }
85 const std::map<std::
string,
int>&
custom_int() const noexcept {
return _custom_int; }
87 const std::map<std::string, unsigned>&
custom_uint() const noexcept {
return _custom_uint; }
89 const std::map<std::string, int64_t>&
custom_int64() const noexcept {
return _custom_int64; }
91 const std::map<std::string, uint64_t>&
custom_uint64() const noexcept {
return _custom_uint64; }
93 const std::map<std::string, float>&
custom_flt() const noexcept {
return _custom_flt; }
95 const std::map<std::string, double>&
custom_dbl() const noexcept {
return _custom_dbl; }
97 const std::map<std::string, std::string>&
custom_str() const noexcept {
return _custom_str; }
99 int threads() const noexcept {
return _threads; }
106 { _total_operations += operations; }
112 { _total_items += items; }
118 { _total_bytes += bytes; }
126 { _custom_int[name] = value; }
133 { _custom_uint[name] = value; }
140 { _custom_int64[name] = value; }
147 { _custom_uint64[name] = value; }
154 { _custom_flt[name] = value; }
161 { _custom_dbl[name] = value; }
167 void SetCustom(
const std::string& name,
const std::string& value)
168 { _custom_str[name].assign(value); }
188 int64_t _total_operations;
189 int64_t _total_items;
190 int64_t _total_bytes;
191 std::map<std::string, int> _custom_int;
192 std::map<std::string, unsigned> _custom_uint;
193 std::map<std::string, int64_t> _custom_int64;
194 std::map<std::string, uint64_t> _custom_uint64;
195 std::map<std::string, float> _custom_flt;
196 std::map<std::string, double> _custom_dbl;
197 std::map<std::string, std::string> _custom_str;
204 void InitLatencyHistogram(
const std::tuple<int64_t, int64_t, int>&
latency) noexcept;
205 void PrintLatencyHistogram(FILE* file, int32_t resolution)
const noexcept;
206 void FreeLatencyHistogram() noexcept;
208 void StartCollecting() noexcept;
209 void StopCollecting() noexcept;
212 void ResetMetrics() noexcept;
int64_t total_bytes() const noexcept
Get total bytes processed in the phase.
double mean_latency() const noexcept
Get latency mean value of the phase execution.
PhaseMetrics(const PhaseMetrics &)=default
const std::map< std::string, unsigned > & custom_uint() const noexcept
Get custom unsigned integers map.
int64_t total_time() const noexcept
Get total time of the phase execution.
void AddOperations(int64_t operations) noexcept
Increase operations count of the current phase.
int64_t min_time() const noexcept
Get minimal time of the phase execution.
void SetThreads(int threads)
Set threads value.
int64_t min_latency() const noexcept
Get latency minimal value of the phase execution.
double stdv_latency() const noexcept
Get latency standard deviation of the phase execution.
void SetCustom(const std::string &name, uint64_t value)
Set custom unsigned integer 64-bit value.
int64_t max_latency() const noexcept
Get latency maximal value of the phase execution.
const std::map< std::string, int64_t > & custom_int64() const noexcept
Get custom integers 64-bit map.
const std::map< std::string, std::string > & custom_str() const noexcept
Get custom strings map.
void SetCustom(const std::string &name, double value)
Set custom double value.
int64_t total_items() const noexcept
Get total items processed in the phase.
void SetCustom(const std::string &name, unsigned value)
Set custom unsigned integer value.
void SetCustom(const std::string &name, const std::string &value)
Set custom string value.
int64_t avg_time() const noexcept
Get average time of the phase execution.
int64_t max_time() const noexcept
Get maximal time of the phase execution.
const std::map< std::string, uint64_t > & custom_uint64() const noexcept
Get custom unsigned integers 64-bit map.
void SetCustom(const std::string &name, int value)
Set custom integer value.
void SetCustom(const std::string &name, int64_t value)
Set custom integer 64-bit value.
void AddItems(int64_t items) noexcept
Register processed items in the current phase.
void AddBytes(int64_t bytes) noexcept
Register processed bytes in the current phase.
void AddLatency(int64_t latency) noexcept
Add latency value of the current phase.
PhaseMetrics(PhaseMetrics &&) noexcept=default
void SetCustom(const std::string &name, float value)
Set custom float value.
int64_t bytes_per_second() const noexcept
Get data throughput (bytes / second)
int64_t items_per_second() const noexcept
Get items throughput (items / second)
const std::map< std::string, int > & custom_int() const noexcept
Get custom integers map.
int64_t operations_per_second() const noexcept
Get operations throughput (operations / second)
const std::map< std::string, float > & custom_flt() const noexcept
Get custom float map.
PhaseMetrics()
Default constructor.
bool latency() const noexcept
Is metrics contains latency values?
const std::map< std::string, double > & custom_dbl() const noexcept
Get custom doubles map.
int64_t total_operations() const noexcept
Get total operations made in the phase.
int threads() const noexcept
C++ Benchmark project definitions.