#include <timer.h>
Definition at line 16 of file timer.h.
Botan::Timer::Timer |
( |
const std::string & |
name, |
|
|
const std::string & |
provider, |
|
|
const std::string & |
doing, |
|
|
uint64_t |
event_mult, |
|
|
size_t |
buf_size, |
|
|
double |
clock_cycle_ratio, |
|
|
uint64_t |
clock_speed |
|
) |
| |
|
inline |
Definition at line 19 of file timer.h.
26 : m_name(
name + ((provider.empty() || provider ==
"base") ?
"" :
" [" + provider +
"]"))
29 , m_event_mult(event_mult)
30 , m_clock_cycle_ratio(clock_cycle_ratio)
31 , m_clock_speed(clock_speed)
const std::string & doing() const
Botan::Timer::Timer |
( |
const std::string & |
name | ) |
|
|
inline |
Definition at line 34 of file timer.h.
Timer(const std::string &name, const std::string &provider, const std::string &doing, uint64_t event_mult, size_t buf_size, double clock_cycle_ratio, uint64_t clock_speed)
Botan::Timer::Timer |
( |
const std::string & |
name, |
|
|
size_t |
buf_size |
|
) |
| |
|
inline |
Definition at line 38 of file timer.h.
Timer(const std::string &name, const std::string &provider, const std::string &doing, uint64_t event_mult, size_t buf_size, double clock_cycle_ratio, uint64_t clock_speed)
Botan::Timer::Timer |
( |
const Timer & |
other | ) |
|
|
default |
size_t Botan::Timer::buf_size |
( |
| ) |
const |
|
inline |
double Botan::Timer::bytes_per_second |
( |
| ) |
const |
|
inline |
uint64_t Botan::Timer::cycles_consumed |
( |
| ) |
const |
|
inline |
Definition at line 110 of file timer.h.
112 if(m_clock_speed != 0)
114 return static_cast<uint64_t
>((m_clock_speed *
value()) / 1000.0);
116 return m_cpu_cycles_used;
const std::string& Botan::Timer::doing |
( |
| ) |
const |
|
inline |
uint64_t Botan::Timer::events |
( |
| ) |
const |
|
inline |
double Botan::Timer::events_per_second |
( |
| ) |
const |
|
inline |
const std::string& Botan::Timer::get_name |
( |
| ) |
const |
|
inline |
double Botan::Timer::milliseconds |
( |
| ) |
const |
|
inline |
double Botan::Timer::ms_per_event |
( |
| ) |
const |
|
inline |
Definition at line 105 of file timer.h.
double milliseconds() const
bool Botan::Timer::operator< |
( |
const Timer & |
other | ) |
const |
Definition at line 59 of file timer.cpp.
References doing(), and get_name().
61 if(this->
doing() != other.doing())
62 return (this->
doing() < other.doing());
64 return (this->
get_name() < other.get_name());
const std::string & doing() const
const std::string & get_name() const
Timer& Botan::Timer::operator= |
( |
const Timer & |
other | ) |
|
|
default |
template<typename F >
auto Botan::Timer::run |
( |
F |
f | ) |
-> decltype(f())
|
|
inline |
Definition at line 75 of file timer.h.
77 Timer_Scope timer(*
this);
template<typename F >
void Botan::Timer::run_until_elapsed |
( |
std::chrono::milliseconds |
msec, |
|
|
F |
f |
|
) |
| |
|
inline |
double Botan::Timer::seconds |
( |
| ) |
const |
|
inline |
Definition at line 95 of file timer.h.
double milliseconds() const
double Botan::Timer::seconds_per_event |
( |
| ) |
const |
|
inline |
void Botan::Timer::set_custom_msg |
( |
const std::string & |
s | ) |
|
|
inline |
void Botan::Timer::start |
( |
| ) |
|
void Botan::Timer::stop |
( |
| ) |
|
Definition at line 22 of file timer.cpp.
References Botan::OS::get_cpu_cycle_counter(), and Botan::OS::get_system_timestamp_ns().
Referenced by start().
26 if(m_cpu_cycles_start != 0)
31 m_cpu_cycles_used +=
static_cast<size_t>(cycles_taken * m_clock_cycle_ratio);
37 if(now > m_timer_start)
39 const uint64_t dur = now - m_timer_start;
43 if(m_event_count == 0)
45 m_min_time = m_max_time = dur;
49 m_max_time = std::max(m_max_time, dur);
50 m_min_time = std::min(m_min_time, dur);
uint64_t BOTAN_TEST_API get_cpu_cycle_counter()
uint64_t BOTAN_TEST_API get_system_timestamp_ns()
std::string Botan::Timer::to_string |
( |
| ) |
const |
Definition at line 67 of file timer.cpp.
References buf_size().
69 if(m_custom_msg.size() > 0)
75 return result_string_ops();
79 return result_string_bps();
bool Botan::Timer::under |
( |
std::chrono::milliseconds |
msec | ) |
|
|
inline |
Definition at line 49 of file timer.h.
double milliseconds() const
uint64_t Botan::Timer::value |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: