PandA-2024.02
Data Structures | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Translator Class Reference

Class to translate data from a format to another one. More...

#include <translator.hpp>

Collaboration diagram for Translator:
Collaboration graph
[legend]

Data Structures

class  LatexColumnFormat
 Class describing the characteristic of a column of latex table. More...
 

Public Member Functions

 Translator (const ParameterConstRef Param)
 Constructor. More...
 
void write_to_csv (const std::map< std::string, CustomOrderedSet< std::string >> &tags, const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &results, const std::string &file_name) const
 Write rtl data in csv format. More...
 
void write_to_csv (const std::map< std::string, CustomMap< std::string, std::string >> &results, const std::string &file_name) const
 Write text data in csv format. More...
 
void write_to_pa (const std::map< std::string, CustomOrderedSet< std::string >> &tags, const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &results, const std::string &file_name) const
 Write profiling analysis to pa. More...
 
void write_to_latex (std::map< std::string, CustomMap< std::string, std::string >> &results, const Parameters_FileFormat input_format, const std::string &file_name) const
 Write data in latex table format. More...
 
void merge_pa (const std::map< std::string, CustomOrderedSet< std::string >> &tags, const CustomUnorderedMap< std::string, CustomOrderedSet< std::string >> &keys, const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &input_data, const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &merge_data, CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &output_data) const
 Merget profiling analysis. More...
 

Static Public Member Functions

static void AggregateAndClean (std::map< std::string, std::map< std::string, long double >> &data, CustomOrderedSet< std::string > &column_names, const ParameterConstRef param)
 Collapse columns of data considering super classes and remove selected rows. More...
 

Private Member Functions

void get_normalization (CustomUnorderedMap< std::string, long double > &normalization) const
 Read normalization file. More...
 
std::string get_exponential_notation (const std::string &input) const
 Return a number in latex exponential notation. More...
 
void read_column_formats (const XMLDomParserRef parser, std::list< LatexColumnFormat > &latex_column_formats, size_t &max_column_width) const
 Read latex column format from xml. More...
 

Static Private Member Functions

static void replace_underscore (std::string &ioString)
 Replace '_' with ' '. More...
 

Private Attributes

const ParameterConstRef Param
 the set of parameters More...
 
int debug_level
 the debug level More...
 

Detailed Description

Class to translate data from a format to another one.

Definition at line 83 of file translator.hpp.

Constructor & Destructor Documentation

◆ Translator()

Translator::Translator ( const ParameterConstRef  Param)
explicit

Constructor.

Parameters
Paramis the set of the parameters

Definition at line 171 of file translator.cpp.

Member Function Documentation

◆ AggregateAndClean()

static void Translator::AggregateAndClean ( std::map< std::string, std::map< std::string, long double >> &  data,
CustomOrderedSet< std::string > &  column_names,
const ParameterConstRef  param 
)
static

Collapse columns of data considering super classes and remove selected rows.

Parameters
dataare the data to be collapsed
column_namesare the names of the column
Paramis the set of input parameters

◆ get_exponential_notation()

std::string Translator::get_exponential_notation ( const std::string &  input) const
private

Return a number in latex exponential notation.

Parameters
inputis the number to be translated
Returns
the string in exponential notation

Definition at line 948 of file translator.cpp.

References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, output, Param, PRINT_DBG_MEX, and result.

Referenced by write_to_latex().

Here is the caller graph for this function:

◆ get_normalization()

void Translator::get_normalization ( CustomUnorderedMap< std::string, long double > &  normalization) const
private

Read normalization file.

Parameters
normalizationis where normalize data will be stored

Definition at line 885 of file translator.cpp.

References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, XMLDomParser::Exec(), xml_child::get_children(), XMLDomParser::get_document(), LOAD_XVM, Param, test_panda::parser, PRINT_DBG_MEX, STR, THROW_ERROR, and symmetry::value.

Here is the call graph for this function:

◆ merge_pa()

void Translator::merge_pa ( const std::map< std::string, CustomOrderedSet< std::string >> &  tags,
const CustomUnorderedMap< std::string, CustomOrderedSet< std::string >> &  keys,
const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &  input_data,
const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &  merge_data,
CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &  output_data 
) const

Merget profiling analysis.

Parameters
tagsis the column to be written
keysis the column to be written
input_dataare the data of the first profiling analysis
merge_dataare the data to be merged with the first profiling analysis
output_datais where data will be stored

Definition at line 826 of file translator.cpp.

References debug_level, DEBUG_LEVEL_VERY_PEDANTIC, input_data, and PRINT_DBG_MEX.

◆ read_column_formats()

void Translator::read_column_formats ( const XMLDomParserRef  parser,
std::list< LatexColumnFormat > &  latex_column_formats,
size_t max_column_width 
) const
private

◆ replace_underscore()

void Translator::replace_underscore ( std::string &  ioString)
staticprivate

Replace '_' with ' '.

Parameters
ioStringis the string to be converted

Definition at line 943 of file translator.cpp.

◆ write_to_csv() [1/2]

void Translator::write_to_csv ( const std::map< std::string, CustomOrderedSet< std::string >> &  tags,
const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &  results,
const std::string &  file_name 
) const

Write rtl data in csv format.

Parameters
tagsis the column to be written
datais the data to be written
file_nameis the name of the file where data will be written

◆ write_to_csv() [2/2]

void Translator::write_to_csv ( const std::map< std::string, CustomMap< std::string, std::string >> &  results,
const std::string &  file_name 
) const

Write text data in csv format.

Parameters
resultsis the data to be written
file_nameis the name of the file

Definition at line 176 of file translator.cpp.

References CSV_COL_SEPARATOR, symmetry::row, and THROW_ASSERT.

◆ write_to_latex()

void Translator::write_to_latex ( std::map< std::string, CustomMap< std::string, std::string >> &  results,
const Parameters_FileFormat  input_format,
const std::string &  file_name 
) const

Write data in latex table format.

Parameters
resultsis the data to be written
file_nameis the name of the files

The maximum width of a column

The bold cells

The bambu version

The timestamp

The bambu arguments

The list of benchmarks

The stream

Computing total when necessary

Adjusting precision

Checking if we have to use exponetial notation

Recomputing column width

Checking if we have to print average line

Definition at line 259 of file translator.cpp.

References add_escape(), Translator::LatexColumnFormat::Compare(), debug_level, DEBUG_LEVEL_VERY_PEDANTIC, default_latex_format_stat, XMLDomParser::Exec(), xml_child::get_children(), XMLDomParser::get_document(), get_exponential_notation(), INDENT_DBG_MEX, line(), NUM_CST_latex_table_max_column_width, Param, test_panda::parser, read_column_formats(), symmetry::row, STR, STR_XML_experimental_setup_bambu_arguments, STR_XML_experimental_setup_bambu_version, STR_XML_experimental_setup_benchmarks, STR_XML_experimental_setup_timestamp, STR_XML_experimental_setup_value, THROW_ERROR, THROW_UNREACHABLE, and symmetry::value.

Here is the call graph for this function:

◆ write_to_pa()

void Translator::write_to_pa ( const std::map< std::string, CustomOrderedSet< std::string >> &  tags,
const CustomUnorderedMap< std::string, CustomUnorderedMapStable< std::string, CustomUnorderedMapStable< std::string, long double >>> &  results,
const std::string &  file_name 
) const

Write profiling analysis to pa.

Parameters
tagsis the column to be written
datais the data to be written
file_nameis the name of the file where data will be written

Definition at line 214 of file translator.cpp.

References CSV_COL_SEPARATOR, and THROW_ASSERT.

Field Documentation

◆ debug_level

int Translator::debug_level
private

the debug level

Definition at line 90 of file translator.hpp.

Referenced by get_exponential_notation(), get_normalization(), merge_pa(), read_column_formats(), and write_to_latex().

◆ Param

const ParameterConstRef Translator::Param
private

the set of parameters

Definition at line 87 of file translator.hpp.

Referenced by get_exponential_notation(), get_normalization(), and write_to_latex().


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

Generated on Mon Feb 12 2024 13:04:06 for PandA-2024.02 by doxygen 1.8.13