99 _stream <<
Color::WHITE <<
"Custom values: " << std::endl;
100 std::set<std::string> names;
102 names.insert(it.first);
104 names.insert(it.first);
106 names.insert(it.first);
108 names.insert(it.first);
110 names.insert(it.first);
112 names.insert(it.first);
114 names.insert(it.first);
115 for (
const auto& name : names)
117 auto it_int = metrics.
custom_int().find(name);
129 auto it_flt = metrics.
custom_flt().find(name);
132 auto it_dbl = metrics.
custom_dbl().find(name);
135 auto it_str = metrics.
custom_str().find(name);
149 return std::string(79, ch);
154 std::ostringstream stream;
156 int64_t abs_hertz = std::abs(hertz);
158 if (abs_hertz >= 1000000000)
160 int64_t gigahertz = hertz / 1000000000;
161 int64_t megahertz = (hertz % 1000000000) / 1000000;
162 stream << gigahertz <<
'.' << ((megahertz < 100) ?
"0" :
"") << ((megahertz < 10) ?
"0" :
"") << megahertz <<
" GHz";
164 else if (abs_hertz >= 1000000)
166 int64_t megahertz = hertz / 1000000;
167 int64_t kilohertz = (hertz % 1000000) / 1000;
168 stream << megahertz <<
'.' << ((kilohertz < 100) ?
"0" :
"") << ((kilohertz < 10) ?
"0" :
"") << kilohertz <<
" MHz";
170 else if (abs_hertz >= 1000)
172 int64_t kilohertz = hertz / 1000;
173 hertz = hertz % 1000;
174 stream << kilohertz <<
'.' << ((hertz < 100) ?
"0" :
"") << ((hertz < 10) ?
"0" :
"") << hertz <<
" kHz";
177 stream << hertz <<
" Hz";
184 std::ostringstream stream;
186 int64_t abs_bytes = std::abs(bytes);
188 if (abs_bytes >= (1024ll * 1024ll * 1024ll * 1024ll))
190 int64_t tb = bytes / (1024ll * 1024ll * 1024ll * 1024ll);
191 int64_t gb = (bytes % (1024ll * 1024ll * 1024ll * 1024ll)) / (1024 * 1024 * 1024);
192 stream << tb <<
'.' << ((gb < 100) ?
"0" :
"") << ((gb < 10) ?
"0" :
"") << gb <<
" TiB";
194 else if (abs_bytes >= (1024 * 1024 * 1024))
196 int64_t gb = bytes / (1024 * 1024 * 1024);
197 int64_t mb = (bytes % (1024 * 1024 * 1024)) / (1024 * 1024);
198 stream << gb <<
'.' << ((mb < 100) ?
"0" :
"") << ((mb < 10) ?
"0" :
"") << mb <<
" GiB";
200 else if (abs_bytes >= (1024 * 1024))
202 int64_t mb = bytes / (1024 * 1024);
203 int64_t kb = (bytes % (1024 * 1024)) / 1024;
204 stream << mb <<
'.' << ((kb < 100) ?
"0" :
"") << ((kb < 10) ?
"0" :
"") << kb <<
" MiB";
206 else if (abs_bytes >= 1024)
208 int64_t kb = bytes / 1024;
209 bytes = bytes % 1024;
210 stream << kb <<
'.' << ((bytes < 100) ?
"0" :
"") << ((bytes < 10) ?
"0" :
"") << bytes <<
" KiB";
213 stream << bytes <<
" bytes";
220 std::ostringstream stream;
222 int64_t abs_nanoseconds = std::abs(nanoseconds);
224 if (abs_nanoseconds >= (60 * 60 * 1000000000ll))
226 int64_t hours = nanoseconds / (60 * 60 * 1000000000ll);
227 int64_t minutes = ((nanoseconds % (60 * 60 * 1000000000ll)) / 1000000000) / 60;
228 int64_t seconds = ((nanoseconds % (60 * 60 * 1000000000ll)) / 1000000000) % 60;
229 int64_t milliseconds = ((nanoseconds % (60 * 60 * 1000000000ll)) % 1000000000) / 1000000;
230 stream << hours <<
':' << ((minutes < 10) ?
"0" :
"") << minutes <<
':' << ((seconds < 10) ?
"0" :
"") << seconds <<
'.' << ((milliseconds < 100) ?
"0" :
"") << ((milliseconds < 10) ?
"0" :
"") << milliseconds <<
" h";
232 else if (abs_nanoseconds >= (60 * 1000000000ll))
234 int64_t minutes = nanoseconds / (60 * 1000000000ll);
235 int64_t seconds = (nanoseconds % (60 * 1000000000ll)) / 1000000000;
236 int64_t milliseconds = ((nanoseconds % (60 * 1000000000ll)) % 1000000000) / 1000000;
237 stream << minutes <<
':' << ((seconds < 10) ?
"0" :
"") << seconds <<
'.' << ((milliseconds < 100) ?
"0" :
"") << ((milliseconds < 10) ?
"0" :
"") << milliseconds <<
" m";
239 else if (abs_nanoseconds >= 1000000000)
241 int64_t seconds = nanoseconds / 1000000000;
242 int64_t milliseconds = (nanoseconds % 1000000000) / 1000000;
243 stream << seconds <<
'.' << ((milliseconds < 100) ?
"0" :
"") << ((milliseconds < 10) ?
"0" :
"") << milliseconds <<
" s";
245 else if (abs_nanoseconds >= 1000000)
247 int64_t milliseconds = nanoseconds / 1000000;
248 int64_t microseconds = (nanoseconds % 1000000) / 1000;
249 stream << milliseconds <<
'.' << ((microseconds < 100) ?
"0" :
"") << ((microseconds < 10) ?
"0" :
"") << microseconds <<
" ms";
251 else if (abs_nanoseconds >= 1000)
253 int64_t microseconds = nanoseconds / 1000;
254 nanoseconds = nanoseconds % 1000;
255 stream << microseconds <<
'.' << ((nanoseconds < 100) ?
"0" :
"") << ((nanoseconds < 10) ?
"0" :
"") << nanoseconds <<
" mcs";
258 stream << nanoseconds <<
" ns";
const std::string & name() const
Get benchmark name.
static bool IsDebug()
Is compiled in debug mode?
static std::string OSVersion()
Get OS version string.
static bool IsRelease()
Is compiled in release mode?
static time_t Timestamp()
Get the current time in seconds.
static bool Is64BitProcess()
Is 64-bit running process?
static bool Is64BitOS()
Is 64-bit OS?
static bool Is32BitOS()
Is 32-bit OS?
static bool Is32BitProcess()
Is 32-bit running process?
const std::string & name() const noexcept override
Get phase name.
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.
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.
int64_t min_time() const noexcept
Get minimal time of the phase execution.
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.
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.
int64_t total_items() const noexcept
Get total items processed in the phase.
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.
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.
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.
static std::string GenerateClockSpeed(int64_t hertz)
Generate clock speed string.
void ReportBenchmark(const BenchmarkBase &benchmark, const Settings &settings) override
Report current benchmark information.
static std::string GenerateSeparator(char ch)
Generate separator string.
void ReportEnvironment() override
Report environment information.
void ReportHeader() override
Report header.
void ReportPhase(const PhaseCore &phase, const PhaseMetrics &metrics) override
Report current phase information.
static std::string GenerateTimePeriod(int64_t nanoseconds)
Generate time period string.
void ReportSystem() override
Report system information.
void ReportFooter() override
Report footer.
static std::string GenerateDataSize(int64_t bytes)
Generate data size string.
int attempts() const noexcept
Get count of independent benchmark attempts.
int64_t duration() const noexcept
Get benchmark duration in milliseconds.
int64_t operations() const noexcept
Get count of operations.
static int CpuPhysicalCores()
CPU physical cores count.
static std::string CpuArchitecture()
CPU architecture string.
static int64_t RamFree()
Free RAM in bytes.
static int64_t CpuClockSpeed()
CPU clock speed in Hz.
static bool CpuHyperThreading()
Is CPU Hyper-Threading enabled?
static int64_t RamTotal()
Total RAM in bytes.
static int CpuLogicalCores()
CPU logical cores count.
Console management definition.
Environment management definition.
C++ Benchmark project definitions.
const char version[]
Project version.
@ LIGHTMAGENTA
Light magenta color.
@ LIGHTCYAN
Light cyan color.
@ DARKGREY
Dark grey color.
@ LIGHTRED
Light red color.
@ LIGHTGREEN
Light green color.
Console reporter definition.