PandA-2024.02
|
Class to translate data from a format to another one. More...
#include <translator.hpp>
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... | |
Class to translate data from a format to another one.
Definition at line 83 of file translator.hpp.
|
explicit |
Constructor.
Param | is the set of the parameters |
Definition at line 171 of file translator.cpp.
|
static |
Collapse columns of data considering super classes and remove selected rows.
data | are the data to be collapsed |
column_names | are the names of the column |
Param | is the set of input parameters |
|
private |
Return a number in latex exponential notation.
input | is the number to be translated |
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().
|
private |
Read normalization file.
normalization | is 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.
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.
tags | is the column to be written |
keys | is the column to be written |
input_data | are the data of the first profiling analysis |
merge_data | are the data to be merged with the first profiling analysis |
output_data | is 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.
|
private |
Read latex column format from xml.
parser | is the parser used to parse the stream |
latex_column_formats | is where read data will be put |
max_column_width | is where maximum column width will be stored |
Definition at line 981 of file translator.cpp.
References CE_XVM, Translator::LatexColumnFormat::column_name, debug_level, DEBUG_LEVEL_VERY_PEDANTIC, xml_child::get_children(), Translator::LatexColumnFormat::get_CO(), xml_node::get_name(), Translator::LatexColumnFormat::get_TF(), Translator::LatexColumnFormat::GetTotalFormat(), INDENT_DBG_MEX, LOAD_XVM, SplitString(), STR, STR_XML_latex_table_alignment, STR_XML_latex_table_column, STR_XML_latex_table_column_name, STR_XML_latex_table_comparison, STR_XML_latex_table_operator, STR_XML_latex_table_precision, STR_XML_latex_table_root, STR_XML_latex_table_source_name, STR_XML_latex_table_text_format, STR_XML_latex_table_total, STR_XML_latex_table_value, THROW_ASSERT, and THROW_ERROR.
Referenced by write_to_latex().
|
staticprivate |
Replace '_' with ' '.
ioString | is the string to be converted |
Definition at line 943 of file translator.cpp.
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.
tags | is the column to be written |
data | is the data to be written |
file_name | is the name of the file where data will be written |
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.
results | is the data to be written |
file_name | is the name of the file |
Definition at line 176 of file translator.cpp.
References CSV_COL_SEPARATOR, symmetry::row, and THROW_ASSERT.
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.
results | is the data to be written |
file_name | is 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.
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.
tags | is the column to be written |
data | is the data to be written |
file_name | is 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.
|
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().
|
private |
the set of parameters
Definition at line 87 of file translator.hpp.
Referenced by get_exponential_notation(), get_normalization(), and write_to_latex().