Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
Timer Class Reference

Get the execution between a block of code. More...

#include <timer.hpp>

Public Member Functions

 Timer ()
 Initialize a Timer with the current time.
 
int64_t nanoseconds () const
 Return the number of nanoseconds elapsed since the start of the timer.
 
int64_t milliseconds () const
 Return the number of nanoseconds elapsed since the start of the timer.
 
double seconds () const
 Return the number of seconds elapsed since the start of the timer.
 
std::string toString () const
 Return the number of seconds elapsed since the start of the timer as a string.
 

Private Member Functions

void start ()
 Manually sets the start time.
 
void end ()
 Manually sets the end time.
 

Private Attributes

struct timespec _startTime
 
struct timespec _endTime
 

Static Private Attributes

static constexpr int64_t NanosecondsPerSecond = 1000LL * 1000 * 1000
 

Detailed Description

Get the execution between a block of code.

Definition at line 12 of file timer.hpp.

Constructor & Destructor Documentation

◆ Timer()

Timer::Timer ( )
inline

Initialize a Timer with the current time.

Definition at line 34 of file timer.hpp.

Member Function Documentation

◆ end()

void Timer::end ( )
inlineprivate

Manually sets the end time.

Definition at line 27 of file timer.hpp.

◆ milliseconds()

int64_t Timer::milliseconds ( ) const
inline

Return the number of nanoseconds elapsed since the start of the timer.

Definition at line 61 of file timer.hpp.

◆ nanoseconds()

int64_t Timer::nanoseconds ( ) const
inline

Return the number of nanoseconds elapsed since the start of the timer.

Definition at line 43 of file timer.hpp.

◆ seconds()

double Timer::seconds ( ) const
inline

Return the number of seconds elapsed since the start of the timer.

Definition at line 70 of file timer.hpp.

◆ start()

void Timer::start ( )
inlineprivate

Manually sets the start time.

Definition at line 22 of file timer.hpp.

◆ toString()

std::string Timer::toString ( ) const
inline

Return the number of seconds elapsed since the start of the timer as a string.

Definition at line 80 of file timer.hpp.

Member Data Documentation

◆ _endTime

struct timespec Timer::_endTime
private

Definition at line 15 of file timer.hpp.

◆ _startTime

struct timespec Timer::_startTime
private

Definition at line 14 of file timer.hpp.

◆ NanosecondsPerSecond

constexpr int64_t Timer::NanosecondsPerSecond = 1000LL * 1000 * 1000
staticconstexprprivate

Definition at line 17 of file timer.hpp.


The documentation for this class was generated from the following file: