HEBench
hebench::ReportGen Namespace Reference

Namespaces

 Compiler
 
 cpp
 

Classes

struct  _TimingReportEventC
 
struct  _UnitPrefix
 
struct  OverviewHeader
 
struct  StatisticsResult
 
struct  ReportEventTypeStats
 
class  ReportStats
 
class  EventType
 Extracts and maintains the timing report events of the same type. More...
 
class  TimingReportImpl
 

Typedefs

typedef struct _TimingReportEventC TimingReportEventC
 
typedef struct _UnitPrefix TimingPrefixedSeconds
 

Functions

void * allocateReport ()
 
void freeReport (void *p_report)
 
int32_t setReportHeader (void *p_report, const char *new_header)
 
int32_t appendReportHeader (void *p_report, const char *new_header, int32_t new_line)
 Appends text to existing header. More...
 
int32_t prependReportHeader (void *p_report, const char *new_header, int32_t new_line)
 Prepends text to existing header. More...
 
uint64_t getReportHeader (void *p_report, char *header, uint64_t size)
 
int32_t setReportFooter (void *p_report, const char *new_footer)
 
int32_t appendReportFooter (void *p_report, const char *new_footer, int32_t new_line)
 Appends text to existing footer. More...
 
int32_t prependReportFooter (void *p_report, const char *new_footer, int32_t new_line)
 Prepends text to existing footer. More...
 
uint64_t getReportFooter (void *p_report, char *footer, uint64_t size)
 
int32_t addEventType (void *p_report, uint32_t event_type_id, const char *event_type_header)
 addEventType More...
 
int32_t addMainEventType (void *p_report, uint32_t event_type_id, const char *event_type_header)
 Adds an event type and marks it as the main event. More...
 
int32_t hasEventType (void *p_report, uint32_t event_type_id)
 hasEventType More...
 
uint64_t getEventTypeHeader (void *p_report, uint32_t event_type_id, char *event_type_header, uint64_t size)
 
uint64_t getEventTypeCount (void *p_report)
 
uint32_t getEventType (void *p_report, uint64_t index)
 Retrieve an event type ID. More...
 
int32_t getMainEventType (void *p_report, uint32_t *p_event_type_id)
 getMainEventType More...
 
int32_t addEvent (void *p_report, const TimingReportEventC *p_event)
 addEvent More...
 
int32_t getEvent (void *p_report, TimingReportEventC *p_event, uint64_t index)
 getEvent More...
 
uint64_t getEventCount (void *p_report)
 
uint64_t getEventCapacity (void *p_report)
 
int32_t setEventCapacity (void *p_report, uint64_t new_capacity)
 setEventCapacity More...
 
int32_t clearEvents (void *p_report)
 
int32_t save2CSV (void *p_report, const char *filename)
 
int32_t convert2CSV (void *p_report, char **pp_csv_content)
 convert2CSV More...
 
void freeCSVContent (char *p_csv_content)
 Releases resources allocated by functions that generate CSV formatted reports from a timing report. More...
 
void * loadReportFromCSV (const char *p_csv_content, char error_description[MAX_DESCRIPTION_BUFFER_SIZE])
 
void * loadReportFromCSVFile (const char *filename, char error_description[MAX_DESCRIPTION_BUFFER_SIZE])
 
int32_t setTimingPrefix (TimingPrefixedSeconds *p_prefix, double seconds, char prefix)
 Computes the value for the time unit based on a specified prefix. More...
 
int32_t computeTimingPrefix (TimingPrefixedSeconds *p_prefix, double seconds)
 Retrieves the prefix for the time unit. More...
 
void computeStats (StatisticsResult &result, const double *data, std::size_t count)
 
std::string to_string (const std::string_view &s)
 

Class Documentation

◆ hebench::ReportGen::_TimingReportEventC

struct hebench::ReportGen::_TimingReportEventC

Definition at line 20 of file hebench_report_types.h.

Class Members
double cpu_time_end
double cpu_time_start
char description[MAX_TIME_REPORT_EVENT_DESCRIPTION_SIZE] Description attached to this event.

Set to empty string if no description.

uint32_t event_type_id ID specifying the event type.

During summary report, events with the same ID will be grouped together for statistical computations. Users must make sure that related events are tagged with the correct ID.

uint64_t input_sample_count
int64_t time_interval_ratio_den Scale of time interval used for this event.
See also
time_interval_ratio_num
int64_t time_interval_ratio_num Scale of time interval used for this event.

Timing values in this instance are given in this scale.

This represents the ratio of this scale with respect to 1 second. For example, 1 millisecond is 0.001 seconds, and thus, its scale ratio is 1:1000. So, the time, in seconds for wall time is

Similarly for CPU time.

double wall_time_end
double wall_time_start

◆ hebench::ReportGen::_UnitPrefix

struct hebench::ReportGen::_UnitPrefix

Definition at line 60 of file hebench_report_types.h.

Class Members
char prefix[MAX_DESCRIPTION_BUFFER_SIZE] Full name for the prefix (or empty string if no prefix).

milli, micro, nano

char symbol[MAX_SYMBOL_BUFFER_SIZE] Symbol for the prefix.

m for milli, u micro, n for nano

int64_t time_interval_ratio_den Denominator of timing scale ratio with respect to a unit.

Numerator is always 1.

double value Value in the specified unit.

◆ hebench::ReportGen::StatisticsResult

struct hebench::ReportGen::StatisticsResult

Definition at line 22 of file hebench_report_stats.h.

Class Members
double ave
double ave_trim
uint64_t input_sample_count
double max
double median
double min
double pct_1
double pct_10
double pct_90
double pct_99
double samples_per_unit
double samples_per_unit_trim
double total
double variance
double variance_trim

◆ hebench::ReportGen::ReportEventTypeStats

struct hebench::ReportGen::ReportEventTypeStats

Definition at line 41 of file hebench_report_stats.h.

Collaboration diagram for hebench::ReportGen::ReportEventTypeStats:
Class Members
double cpu_time_1
double cpu_time_10
double cpu_time_90
double cpu_time_99
double cpu_time_ave
double cpu_time_ave_trim
double cpu_time_max
double cpu_time_median
double cpu_time_min
double cpu_time_variance
double cpu_time_variance_trim
string description
uint32_t event_id ID specifying the event type.

During summary report, events with the same ID are grouped together for statistical computations. Users must make sure that related events are tagged with the correct ID.

uint64_t input_sample_count Number of input samples used.

This is, if the operation were a latency operation, it was executed once for each input sample.

string name Event name.
double ops_per_sec
double ops_per_sec_trim
double total_time
double wall_time_1
double wall_time_10
double wall_time_90
double wall_time_99
double wall_time_ave
double wall_time_ave_trim
double wall_time_max
double wall_time_median
double wall_time_min
double wall_time_variance
double wall_time_variance_trim

Typedef Documentation

◆ TimingPrefixedSeconds

◆ TimingReportEventC

Function Documentation

◆ addEvent()

int32_t hebench::ReportGen::addEvent ( void *  p_report,
const TimingReportEventC p_event 
)

addEvent

Parameters
p_report
p_event
Returns
true on success.

Definition at line 366 of file hebench_report.cpp.

◆ addEventType()

int32_t hebench::ReportGen::addEventType ( void *  p_report,
uint32_t  event_type_id,
const char *  event_type_header 
)

addEventType

Parameters
p_report
event_type_id
event_type_header
Returns
true on success.

event type: groups a collection of events under the same type.

Definition at line 221 of file hebench_report.cpp.

◆ addMainEventType()

int32_t hebench::ReportGen::addMainEventType ( void *  p_report,
uint32_t  event_type_id,
const char *  event_type_header 
)

Adds an event type and marks it as the main event.

Parameters
p_report
event_type_id
event_type_header
Returns
true on success.

The main event is the event on which the summary will focus.

Definition at line 242 of file hebench_report.cpp.

◆ allocateReport()

void * hebench::ReportGen::allocateReport ( )

Definition at line 23 of file hebench_report.cpp.

◆ appendReportFooter()

int32_t hebench::ReportGen::appendReportFooter ( void *  p_report,
const char *  new_footer,
int32_t  new_line 
)

Appends text to existing footer.

Parameters
p_report
new_footer
new_lineIf true a new line will be added after current footer before appending new_footer .
Returns
true on success

Definition at line 160 of file hebench_report.cpp.

◆ appendReportHeader()

int32_t hebench::ReportGen::appendReportHeader ( void *  p_report,
const char *  new_header,
int32_t  new_line 
)

Appends text to existing header.

Parameters
p_report
new_header
new_lineIf true a new line will be added after current header before appending new_header .
Returns
true on success

Definition at line 78 of file hebench_report.cpp.

◆ clearEvents()

int32_t hebench::ReportGen::clearEvents ( void *  p_report)

Definition at line 471 of file hebench_report.cpp.

◆ computeStats()

void hebench::ReportGen::computeStats ( StatisticsResult result,
const double *  data,
std::size_t  count 
)

Definition at line 20 of file hebench_report_stats.cpp.

◆ computeTimingPrefix()

int32_t hebench::ReportGen::computeTimingPrefix ( TimingPrefixedSeconds p_prefix,
double  seconds 
)

Retrieves the prefix for the time unit.

Parameters
[out]p_prefixStructure where to store the result.
[in]secondsTime in seconds for which to compute prefix.

Given a timing in seconds, this function will compute the metric prefix. The time used are: greater than 1: seconds between 1 and 0.001: milliseconds between 0.001 and 0.000001: microseconds between 0.000001 and 0.000000001: nanoseconds

Definition at line 640 of file hebench_report.cpp.

◆ convert2CSV()

int32_t hebench::ReportGen::convert2CSV ( void *  p_report,
char **  pp_csv_content 
)

convert2CSV

Parameters
p_report
[out]pp_csv_contentDeallocate using freeCSVContent()
Returns
true on success.

Definition at line 518 of file hebench_report.cpp.

◆ freeCSVContent()

void hebench::ReportGen::freeCSVContent ( char *  p_csv_content)

Releases resources allocated by functions that generate CSV formatted reports from a timing report.

Parameters
[in]p_csv_contentPointer to the string buffer allocated by functions that generate CSV reports.

Use this function to free resources allocated by convert2CSV(), generateSummaryCSV(), and similar functions.

Definition at line 553 of file hebench_report.cpp.

◆ freeReport()

void hebench::ReportGen::freeReport ( void *  p_report)

Definition at line 43 of file hebench_report.cpp.

◆ getEvent()

int32_t hebench::ReportGen::getEvent ( void *  p_report,
TimingReportEventC p_event,
uint64_t  index 
)

getEvent

Parameters
p_report
p_event
index
Returns
true on success.

Definition at line 391 of file hebench_report.cpp.

◆ getEventCapacity()

uint64_t hebench::ReportGen::getEventCapacity ( void *  p_report)

Definition at line 431 of file hebench_report.cpp.

◆ getEventCount()

uint64_t hebench::ReportGen::getEventCount ( void *  p_report)

Definition at line 412 of file hebench_report.cpp.

◆ getEventType()

uint32_t hebench::ReportGen::getEventType ( void *  p_report,
uint64_t  index 
)

Retrieve an event type ID.

Parameters
p_report
[in]indexIndex of the event type to retrieve. Must be less than getEventTypeCount() .
Returns
ID of the event type corresponding to the specified index, or maximum uint32_t value on error.

Definition at line 324 of file hebench_report.cpp.

◆ getEventTypeCount()

uint64_t hebench::ReportGen::getEventTypeCount ( void *  p_report)

Definition at line 305 of file hebench_report.cpp.

◆ getEventTypeHeader()

uint64_t hebench::ReportGen::getEventTypeHeader ( void *  p_report,
uint32_t  event_type_id,
char *  event_type_header,
uint64_t  size 
)

Definition at line 282 of file hebench_report.cpp.

◆ getMainEventType()

int32_t hebench::ReportGen::getMainEventType ( void *  p_report,
uint32_t *  p_event_type_id 
)

getMainEventType

Parameters
p_report
p_event_type_id
Returns
true if report has main event type and it was successfully retrieved into p_event_type_id .
false on error or otherwise.

Definition at line 343 of file hebench_report.cpp.

◆ getReportFooter()

uint64_t hebench::ReportGen::getReportFooter ( void *  p_report,
char *  footer,
uint64_t  size 
)

Definition at line 202 of file hebench_report.cpp.

◆ getReportHeader()

uint64_t hebench::ReportGen::getReportHeader ( void *  p_report,
char *  header,
uint64_t  size 
)

Definition at line 120 of file hebench_report.cpp.

◆ hasEventType()

int32_t hebench::ReportGen::hasEventType ( void *  p_report,
uint32_t  event_type_id 
)

hasEventType

Parameters
p_report
event_type_id
Returns
Less than 0 on error, greater than 0 if report has an event of the specified ID type, 0 otherwise.

Definition at line 263 of file hebench_report.cpp.

◆ loadReportFromCSV()

void * hebench::ReportGen::loadReportFromCSV ( const char *  p_csv_content,
char  error_description[MAX_DESCRIPTION_BUFFER_SIZE] 
)

Definition at line 559 of file hebench_report.cpp.

◆ loadReportFromCSVFile()

void * hebench::ReportGen::loadReportFromCSVFile ( const char *  filename,
char  error_description[MAX_DESCRIPTION_BUFFER_SIZE] 
)

Definition at line 587 of file hebench_report.cpp.

◆ prependReportFooter()

int32_t hebench::ReportGen::prependReportFooter ( void *  p_report,
const char *  new_footer,
int32_t  new_line 
)

Prepends text to existing footer.

Parameters
p_report
new_footer
new_lineIf true, new_footer , followed by a new line, will be prepended to the current footer. Otherwise, the current footer will follow new_footer immediately without a new line.
Returns
true on success

Definition at line 181 of file hebench_report.cpp.

◆ prependReportHeader()

int32_t hebench::ReportGen::prependReportHeader ( void *  p_report,
const char *  new_header,
int32_t  new_line 
)

Prepends text to existing header.

Parameters
p_report
new_header
new_lineIf true, new_header , followed by a new line, will be prepended to the current header. Otherwise, the current header will follow new_header immediately without a new line.
Returns
true on success

Definition at line 99 of file hebench_report.cpp.

◆ save2CSV()

int32_t hebench::ReportGen::save2CSV ( void *  p_report,
const char *  filename 
)

Definition at line 492 of file hebench_report.cpp.

◆ setEventCapacity()

int32_t hebench::ReportGen::setEventCapacity ( void *  p_report,
uint64_t  new_capacity 
)

setEventCapacity

Parameters
p_report
new_capacity
Returns
true on success.

Definition at line 450 of file hebench_report.cpp.

◆ setReportFooter()

int32_t hebench::ReportGen::setReportFooter ( void *  p_report,
const char *  new_footer 
)

Definition at line 139 of file hebench_report.cpp.

◆ setReportHeader()

int32_t hebench::ReportGen::setReportHeader ( void *  p_report,
const char *  new_header 
)

Definition at line 57 of file hebench_report.cpp.

◆ setTimingPrefix()

int32_t hebench::ReportGen::setTimingPrefix ( TimingPrefixedSeconds p_prefix,
double  seconds,
char  prefix 
)

Computes the value for the time unit based on a specified prefix.

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

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

Values for 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 prefix is m, then, the result is:

p_prefix->value = 50;
p_prefix->time_interval_ratio_den = 1000;
p_prefix->symbol = 'm';
p_prefix->prefix = 'milli';

Definition at line 622 of file hebench_report.cpp.

◆ to_string()

std::string hebench::ReportGen::to_string ( const std::string_view &  s)

Definition at line 18 of file hebench_report_impl.cpp.