HEBench
hebench_report.h
Go to the documentation of this file.
1 
2 // Copyright (C) 2021 Intel Corporation
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef _HEBench_Harness_Report_H_0596d40a3cce4b108a81595c50eb286d
6 #define _HEBench_Harness_Report_H_0596d40a3cce4b108a81595c50eb286d
7 
8 #include <stdint.h>
9 
10 #include "hebench_report_types.h"
11 
12 namespace hebench {
13 namespace ReportGen {
14 
15 extern "C"
16 {
17 
18  void *allocateReport();
19  void freeReport(void *p_report);
20 
21  int32_t setReportHeader(void *p_report, const char *new_header);
30  int32_t appendReportHeader(void *p_report, const char *new_header, int32_t new_line);
40  int32_t prependReportHeader(void *p_report, const char *new_header, int32_t new_line);
41  uint64_t getReportHeader(void *p_report, char *header, uint64_t size);
42 
43  int32_t setReportFooter(void *p_report, const char *new_footer);
52  int32_t appendReportFooter(void *p_report, const char *new_footer, int32_t new_line);
62  int32_t prependReportFooter(void *p_report, const char *new_footer, int32_t new_line);
63  uint64_t getReportFooter(void *p_report, char *footer, uint64_t size);
64 
73  int32_t addEventType(void *p_report, uint32_t event_type_id, const char *event_type_header);
83  int32_t addMainEventType(void *p_report, uint32_t event_type_id, const char *event_type_header);
91  int32_t hasEventType(void *p_report, uint32_t event_type_id);
92  uint64_t getEventTypeHeader(void *p_report, uint32_t event_type_id, char *event_type_header, uint64_t size);
93  uint64_t getEventTypeCount(void *p_report);
102  uint32_t getEventType(void *p_report, uint64_t index);
111  int32_t getMainEventType(void *p_report, uint32_t *p_event_type_id);
112 
113  // events management
114 
121  int32_t addEvent(void *p_report, const TimingReportEventC *p_event);
129  int32_t getEvent(void *p_report, TimingReportEventC *p_event, uint64_t index);
130  uint64_t getEventCount(void *p_report);
131  uint64_t getEventCapacity(void *p_report);
138  int32_t setEventCapacity(void *p_report, uint64_t new_capacity);
139  int32_t clearEvents(void *p_report);
140 
141  // CSV
142  int32_t save2CSV(void *p_report, const char *filename);
149  int32_t convert2CSV(void *p_report, char **pp_csv_content);
158  void freeCSVContent(char *p_csv_content);
159 
160  void *loadReportFromCSV(const char *p_csv_content, char error_description[MAX_DESCRIPTION_BUFFER_SIZE]);
161  void *loadReportFromCSVFile(const char *filename, char error_description[MAX_DESCRIPTION_BUFFER_SIZE]);
162 
163  // misc/utilities
164 
193  int32_t setTimingPrefix(TimingPrefixedSeconds *p_prefix, double seconds, char prefix);
194 
207  int32_t computeTimingPrefix(TimingPrefixedSeconds *p_prefix, double seconds);
208 }
209 
210 } // namespace ReportGen
211 } // namespace hebench
212 
213 #endif // defined _HEBench_Harness_Report_H_0596d40a3cce4b108a81595c50eb286d
#define MAX_DESCRIPTION_BUFFER_SIZE
uint32_t getEventType(void *p_report, uint64_t index)
Retrieve an event type ID.
void freeCSVContent(char *p_csv_content)
Releases resources allocated by functions that generate CSV formatted reports from a timing report.
int32_t setReportFooter(void *p_report, const char *new_footer)
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.
void * loadReportFromCSVFile(const char *filename, char error_description[MAX_DESCRIPTION_BUFFER_SIZE])
int32_t appendReportHeader(void *p_report, const char *new_header, int32_t new_line)
Appends text to existing header.
int32_t prependReportHeader(void *p_report, const char *new_header, int32_t new_line)
Prepends text to existing header.
uint64_t getReportHeader(void *p_report, char *header, uint64_t size)
int32_t getMainEventType(void *p_report, uint32_t *p_event_type_id)
getMainEventType
int32_t hasEventType(void *p_report, uint32_t event_type_id)
hasEventType
int32_t addEvent(void *p_report, const TimingReportEventC *p_event)
addEvent
uint64_t getEventCapacity(void *p_report)
int32_t save2CSV(void *p_report, const char *filename)
uint64_t getEventTypeCount(void *p_report)
void freeReport(void *p_report)
int32_t addEventType(void *p_report, uint32_t event_type_id, const char *event_type_header)
addEventType
uint64_t getReportFooter(void *p_report, char *footer, uint64_t size)
void * loadReportFromCSV(const char *p_csv_content, 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.
int32_t setReportHeader(void *p_report, const char *new_header)
int32_t appendReportFooter(void *p_report, const char *new_footer, int32_t new_line)
Appends text to existing footer.
uint64_t getEventTypeHeader(void *p_report, uint32_t event_type_id, char *event_type_header, uint64_t size)
uint64_t getEventCount(void *p_report)
int32_t getEvent(void *p_report, TimingReportEventC *p_event, uint64_t index)
getEvent
int32_t convert2CSV(void *p_report, char **pp_csv_content)
convert2CSV
int32_t setEventCapacity(void *p_report, uint64_t new_capacity)
setEventCapacity
int32_t clearEvents(void *p_report)
int32_t prependReportFooter(void *p_report, const char *new_footer, int32_t new_line)
Prepends text to existing footer.
int32_t computeTimingPrefix(TimingPrefixedSeconds *p_prefix, double seconds)
Retrieves the prefix for the time unit.