#include <timer.h>
Definition at line 16 of file timer.h.
◆ Timer() [1/4]
Botan::Timer::Timer |
( |
std::string_view | name, |
|
|
std::string_view | provider, |
|
|
std::string_view | doing, |
|
|
uint64_t | event_mult, |
|
|
size_t | buf_size, |
|
|
double | clock_cycle_ratio, |
|
|
uint64_t | clock_speed ) |
Definition at line 30 of file timer.cpp.
36 :
37 m_name(format_timer_name(
name, provider)),
40 m_event_mult(event_mult),
41 m_clock_cycle_ratio(clock_cycle_ratio),
42 m_clock_speed(clock_speed) {}
const std::string & doing() const
◆ Timer() [2/4]
Botan::Timer::Timer |
( |
std::string_view | name | ) |
|
|
inline |
Definition at line 26 of file timer.h.
Timer(std::string_view name, std::string_view provider, std::string_view doing, uint64_t event_mult, size_t buf_size, double clock_cycle_ratio, uint64_t clock_speed)
◆ Timer() [3/4]
Botan::Timer::Timer |
( |
std::string_view | name, |
|
|
size_t | buf_size ) |
|
inline |
◆ Timer() [4/4]
Botan::Timer::Timer |
( |
const Timer & | other | ) |
|
|
default |
◆ buf_size()
size_t Botan::Timer::buf_size |
( |
| ) |
const |
|
inline |
◆ bytes_per_second()
double Botan::Timer::bytes_per_second |
( |
| ) |
const |
|
inline |
◆ cycles_consumed()
uint64_t Botan::Timer::cycles_consumed |
( |
| ) |
const |
|
inline |
Definition at line 74 of file timer.h.
74 {
75 if(m_clock_speed != 0) {
76 return static_cast<uint64_t
>((m_clock_speed *
value()) / 1000.0);
77 }
78 return m_cpu_cycles_used;
79 }
◆ doing()
const std::string & Botan::Timer::doing |
( |
| ) |
const |
|
inline |
◆ events()
uint64_t Botan::Timer::events |
( |
| ) |
const |
|
inline |
◆ events_per_second()
double Botan::Timer::events_per_second |
( |
| ) |
const |
|
inline |
◆ get_name()
const std::string & Botan::Timer::get_name |
( |
| ) |
const |
|
inline |
◆ milliseconds()
double Botan::Timer::milliseconds |
( |
| ) |
const |
|
inline |
Definition at line 70 of file timer.h.
70{
return value() / 1000000.0; }
◆ ms_per_event()
double Botan::Timer::ms_per_event |
( |
| ) |
const |
|
inline |
Definition at line 72 of file timer.h.
double milliseconds() const
◆ operator<()
bool Botan::Timer::operator< |
( |
const Timer & | other | ) |
const |
Definition at line 70 of file timer.cpp.
70 {
71 if(this->
doing() != other.doing()) {
72 return (this->
doing() < other.doing());
73 }
74
75 return (this->
get_name() < other.get_name());
76}
const std::string & get_name() const
References doing(), and get_name().
◆ operator=()
Timer & Botan::Timer::operator= |
( |
const Timer & | other | ) |
|
|
default |
◆ run()
template<typename F >
auto Botan::Timer::run |
( |
F | f | ) |
-> decltype(f()) |
|
inline |
Definition at line 54 of file timer.h.
54 {
55 Timer_Scope timer(*this);
56 return f();
57 }
◆ run_until_elapsed()
template<typename F >
void Botan::Timer::run_until_elapsed |
( |
std::chrono::milliseconds | msec, |
|
|
F | f ) |
|
inline |
◆ seconds()
double Botan::Timer::seconds |
( |
| ) |
const |
|
inline |
◆ seconds_per_event()
double Botan::Timer::seconds_per_event |
( |
| ) |
const |
|
inline |
◆ set_custom_msg()
void Botan::Timer::set_custom_msg |
( |
std::string_view | s | ) |
|
|
inline |
◆ start()
void Botan::Timer::start |
( |
| ) |
|
◆ stop()
void Botan::Timer::stop |
( |
| ) |
|
Definition at line 50 of file timer.cpp.
50 {
51 if(m_timer_start) {
53
54 if(now > m_timer_start) {
55 m_time_used += (now - m_timer_start);
56 }
57
58 if(m_cpu_cycles_start != 0) {
60 if(cycles_taken > 0) {
61 m_cpu_cycles_used += static_cast<size_t>(cycles_taken * m_clock_cycle_ratio);
62 }
63 }
64
65 m_timer_start = 0;
66 ++m_event_count;
67 }
68}
References Botan::OS::get_cpu_cycle_counter(), and Botan::OS::get_system_timestamp_ns().
Referenced by start().
◆ to_string()
std::string Botan::Timer::to_string |
( |
| ) |
const |
Definition at line 78 of file timer.cpp.
78 {
79 if(!m_custom_msg.empty()) {
80 return m_custom_msg;
82 return result_string_ops();
83 } else {
84 return result_string_bps();
85 }
86}
References buf_size().
◆ under()
bool Botan::Timer::under |
( |
std::chrono::milliseconds | msec | ) |
const |
|
inline |
◆ value()
uint64_t Botan::Timer::value |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: