HEBench
hebench::ReportGen::cpp::TimingPrefixUtility Class Reference

#include <hebench_report_cpp.h>

Public Types

enum class  TimeUnit {
  Default , Seconds , MilliSeconds , Microseconds ,
  Nanoseconds
}
 

Static Public Member Functions

static constexpr TimeUnit getPrefix (char ch_prefix)
 
static constexpr char getPrefix (TimeUnit unit)
 
static void setTimingPrefix (TimingPrefixedSeconds &prefix, double seconds, char ch_prefix)
 Converts the time in seconds to the specified time unit. More...
 
static void setTimingPrefix (TimingPrefixedSeconds &prefix, double seconds, TimeUnit unit)
 
static void computeTimingPrefix (TimingPrefixedSeconds &prefix, double seconds)
 Given a time interval in seconds, computes the timing prefix. More...
 

Detailed Description

Definition at line 20 of file hebench_report_cpp.h.

Member Enumeration Documentation

◆ TimeUnit

Enumerator
Default 
Seconds 
MilliSeconds 
Microseconds 
Nanoseconds 

Definition at line 23 of file hebench_report_cpp.h.

Member Function Documentation

◆ computeTimingPrefix()

void hebench::ReportGen::cpp::TimingPrefixUtility::computeTimingPrefix ( TimingPrefixedSeconds prefix,
double  seconds 
)
static

Given a time interval in seconds, computes the timing prefix.

Parameters
prefix
seconds

The timing prefix is the conversion of the time interval in seconds to the metric scale that best suits the measurement such that the time is in the range [1, 1000). The only prefixes supported are milli, micro, and nano. Thus, the ranges for just seconds is [0] U [1, infinite), and for nano is (0, 1000).

For example:

12000 seconds <=> 12000 seconds
0.5 seconds <=> 500 milliseconds
0.0005 seconds <=> 500 microseconds
0.0000005 seconds <=> 500 nanoseconds
0.0000000005 seconds <=> 0.5 nanoseconds
0 seconds <=> 0 seconds

Definition at line 64 of file hebench_report_cpp.cpp.

◆ getPrefix() [1/2]

static constexpr TimeUnit hebench::ReportGen::cpp::TimingPrefixUtility::getPrefix ( char  ch_prefix)
inlinestaticconstexpr

Definition at line 32 of file hebench_report_cpp.h.

◆ getPrefix() [2/2]

static constexpr char hebench::ReportGen::cpp::TimingPrefixUtility::getPrefix ( TimeUnit  unit)
inlinestaticconstexpr

Definition at line 57 of file hebench_report_cpp.h.

◆ setTimingPrefix() [1/2]

void hebench::ReportGen::cpp::TimingPrefixUtility::setTimingPrefix ( TimingPrefixedSeconds prefix,
double  seconds,
char  ch_prefix 
)
static

Converts the time in seconds to the specified time unit.

Parameters
[out]prefixStructure where to store the result.
[in]secondsTime in seconds for which to compute prefix.
[in]ch_prefixTime unit prefix specification. See details.

Given a timing in seconds and the metric prefix, this function will compute the corresponding value.

Values for ch_prefix are:

0: behaves as computeTimingPrefix() ‘'s’: result is in seconds. 'm': result is in milliseconds. 'u': result is in microseconds. 'n'`: result is in nanoseconds.

Any other value makes the function return a failure.

For example, if seconds is 0.05 and ch_prefix is m, then, the result is:

prefix.value = 50;
prefix.time_interval_ratio_den = 1000;
prefix.symbol = 'm';
prefix.prefix = 'milli';

Definition at line 59 of file hebench_report_cpp.cpp.

◆ setTimingPrefix() [2/2]

static void hebench::ReportGen::cpp::TimingPrefixUtility::setTimingPrefix ( TimingPrefixedSeconds prefix,
double  seconds,
TimeUnit  unit 
)
inlinestatic

Definition at line 111 of file hebench_report_cpp.h.


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