class to output in XML format More...
#include <format_output.h>
Public Member Functions | |
xml_formatter (profile_container const *profile, symbol_collection &symbols, extra_images const &extra, string_filter const &symbol_filter) | |
build a ready to use formatter | |
void | output (std::ostream &out) |
virtual void | output_symbol (std::ostream &out, symbol_entry const *symb, size_t lo, size_t hi, bool is_module) |
std::string | output_symbol_details (symbol_entry const *symb, size_t &detail_index, size_t const lo, size_t const hi) |
output details for the symbol | |
void | show_details (bool) |
set the output_details boolean | |
void | output_symbol_data (std::ostream &out) |
void | add_format (format_flags flag) |
add a given column | |
void | show_header (bool) |
set the need_header boolean to false | |
void | vma_format_64bit (bool) |
format for 64 bit wide VMAs | |
void | show_long_filenames (bool) |
show long (full path) filenames | |
void | show_global_percent (bool) |
use global count rather symbol count for details percent | |
void | set_nr_classes (size_t nr_classes) |
void | output_header (std::ostream &out) |
Protected Types | |
typedef std::string(formatter::* | fct_format )(field_datum const &) |
format callback type | |
typedef std::map< format_flags, field_description > | format_map_t |
Protected Member Functions | |
void | do_output (std::ostream &out, symbol_entry const &symbol, sample_entry const &sample, counts_t &c, diff_array_t const &=diff_array_t(), bool hide_immutable_field=false) |
actually do output | |
size_t | output_header_field (std::ostream &out, format_flags fl, size_t padding) |
returns the nr of char needed to pad this field | |
size_t | output_field (std::ostream &out, field_datum const &datum, format_flags fl, size_t padding, bool hide_immutable) |
returns the nr of char needed to pad this field | |
format functions. | |
std::string | format_vma (field_datum const &) |
std::string | format_symb_name (field_datum const &) |
std::string | format_image_name (field_datum const &) |
std::string | format_app_name (field_datum const &) |
std::string | format_linenr_info (field_datum const &) |
std::string | format_nr_samples (field_datum const &) |
std::string | format_nr_cumulated_samples (field_datum const &) |
std::string | format_percent (field_datum const &) |
std::string | format_cumulated_percent (field_datum const &) |
std::string | format_percent_details (field_datum const &) |
std::string | format_cumulated_percent_details (field_datum const &) |
std::string | format_diff (field_datum const &) |
Protected Attributes | |
format_map_t | format_map |
stores functors for doing actual formatting | |
size_t | nr_classes |
number of profile classes | |
counts_t | counts |
total counts | |
format_flags | flags |
formatting flags set | |
bool | vma_64 |
true if we need to format as 64 bits quantities | |
bool | long_filenames |
false if we use basename(filename) in output rather filename | |
bool | need_header |
true if we need to show header before the first output | |
bool | global_percent |
extra_images const & | extra_found_images |
Private Member Functions | |
void | output_sample_data (std::ostream &out, sample_entry const &sample, size_t count) |
void | output_attribute (std::ostream &out, field_datum const &datum, format_flags fl, tag_t tag) |
output attribute in XML | |
bool | get_bfd_object (symbol_entry const *symb, op_bfd *&abfd) const |
void | output_the_symbol_data (std::ostream &out, symbol_entry const *symb, op_bfd *&abfd) |
void | output_cg_children (std::ostream &out, cg_symbol::children const cg_symb, op_bfd *&abfd) |
Private Attributes | |
profile_container const * | profile |
container we work from | |
symbol_collection & | symbols |
bool | need_details |
true if we need to show details for each symbols | |
size_t | detail_count |
string_filter const & | symbol_filter |
class to output in XML format
Definition at line 238 of file format_output.h.
typedef std::string(formatter::* format_output::formatter::fct_format)(field_datum const &) [protected, inherited] |
format callback type
Definition at line 100 of file format_output.h.
typedef std::map<format_flags, field_description> format_output::formatter::format_map_t [protected, inherited] |
Definition at line 132 of file format_output.h.
format_output::xml_formatter::xml_formatter | ( | profile_container const * | profile, | |
symbol_collection & | symbols, | |||
extra_images const & | extra, | |||
string_filter const & | symbol_filter | |||
) |
build a ready to use formatter
Definition at line 605 of file format_output.cpp.
References format_output::formatter::counts, profile, profile_container::samples_count(), and format_output::formatter::counts_t::total.
void format_output::formatter::add_format | ( | format_flags | flag | ) | [inherited] |
add a given column
Definition at line 129 of file format_output.cpp.
References format_output::formatter::flags.
void format_output::formatter::do_output | ( | std::ostream & | out, | |
symbol_entry const & | symbol, | |||
sample_entry const & | sample, | |||
counts_t & | c, | |||
diff_array_t const & | = diff_array_t() , |
|||
bool | hide_immutable_field = false | |||
) | [protected, inherited] |
actually do output
string format_output::formatter::format_app_name | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 286 of file format_output.cpp.
References symbol_entry::app_name, format_output::formatter::extra_found_images, get_image_name(), image_name_storage::int_real_basename, image_name_storage::int_real_filename, format_output::formatter::long_filenames, and format_output::formatter::field_datum::symbol.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_cumulated_percent | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 329 of file format_output.cpp.
References sample_entry::counts, format_output::formatter::field_datum::counts, format_output::formatter::counts_t::cumulated_percent, format_output::formatter::field_datum::diff, format_output::formatter::field_datum::pclass, format_output::formatter::field_datum::sample, and format_output::formatter::counts_t::total.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_cumulated_percent_details | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 347 of file format_output.cpp.
References sample_entry::counts, format_output::formatter::field_datum::counts, format_output::formatter::counts_t::cumulated_percent_details, format_output::formatter::field_datum::pclass, format_output::formatter::field_datum::sample, and format_output::formatter::counts_t::total.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_diff | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 356 of file format_output.cpp.
References format_output::formatter::field_datum::diff, format_output::formatter::format_percent(), percent_fract_width, and percent_int_width.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_image_name | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 276 of file format_output.cpp.
References format_output::formatter::extra_found_images, get_image_name(), symbol_entry::image_name, image_name_storage::int_real_basename, image_name_storage::int_real_filename, format_output::formatter::long_filenames, and format_output::formatter::field_datum::symbol.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_linenr_info | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 296 of file format_output.cpp.
References sample_entry::file_loc, format_output::formatter::long_filenames, and format_output::formatter::field_datum::sample.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_nr_cumulated_samples | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 310 of file format_output.cpp.
References sample_entry::counts, format_output::formatter::field_datum::counts, format_output::formatter::counts_t::cumulated_samples, format_output::formatter::field_datum::diff, format_output::formatter::field_datum::pclass, and format_output::formatter::field_datum::sample.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_nr_samples | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 302 of file format_output.cpp.
References sample_entry::counts, format_output::formatter::field_datum::pclass, and format_output::formatter::field_datum::sample.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_percent | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 321 of file format_output.cpp.
References format_output::formatter::field_datum::counts, sample_entry::counts, format_output::formatter::field_datum::diff, format_output::formatter::field_datum::pclass, format_output::formatter::field_datum::sample, and format_output::formatter::counts_t::total.
Referenced by format_output::formatter::format_diff(), and format_output::formatter::formatter().
string format_output::formatter::format_percent_details | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 340 of file format_output.cpp.
References format_output::formatter::field_datum::counts, sample_entry::counts, format_output::formatter::field_datum::pclass, format_output::formatter::field_datum::sample, and format_output::formatter::counts_t::total.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_symb_name | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 270 of file format_output.cpp.
References symbol_name_storage::demangle(), symbol_entry::name, format_output::formatter::field_datum::symbol, and symbol_names.
Referenced by format_output::formatter::formatter().
string format_output::formatter::format_vma | ( | field_datum const & | f | ) | [protected, inherited] |
Definition at line 264 of file format_output.cpp.
References format_output::formatter::field_datum::sample, and sample_entry::vma.
Referenced by format_output::formatter::formatter().
bool format_output::xml_formatter::get_bfd_object | ( | symbol_entry const * | symb, | |
op_bfd *& | abfd | |||
) | const [private] |
Retrieve a bfd object for this symbol, reopening a new bfd object only if necessary
Definition at line 658 of file format_output.cpp.
References symbol_entry::embedding_filename, format_output::formatter::extra_found_images, op_bfd::get_filename(), get_image_name(), image_format_failure, symbol_entry::image_name, image_name_storage::int_filename, report_image_error(), symbol_entry::spu_offset, and symbol_filter.
void format_output::xml_formatter::output | ( | std::ostream & | out | ) |
void format_output::xml_formatter::output_attribute | ( | std::ostream & | out, | |
field_datum const & | datum, | |||
format_flags | fl, | |||
tag_t | tag | |||
) | [private] |
output attribute in XML
Referenced by output_symbol_details().
void format_output::xml_formatter::output_cg_children | ( | std::ostream & | out, | |
cg_symbol::children const | cg_symb, | |||
op_bfd *& | abfd | |||
) | [private] |
size_t format_output::formatter::output_field | ( | std::ostream & | out, | |
field_datum const & | datum, | |||
format_flags | fl, | |||
size_t | padding, | |||
bool | hide_immutable | |||
) | [protected, inherited] |
returns the nr of char needed to pad this field
void format_output::formatter::output_header | ( | std::ostream & | out | ) | [inherited] |
output table header, implemented by calling the virtual function output_header_field()
size_t format_output::formatter::output_header_field | ( | std::ostream & | out, | |
format_flags | fl, | |||
size_t | padding | |||
) | [protected, inherited] |
returns the nr of char needed to pad this field
void format_output::xml_formatter::output_sample_data | ( | std::ostream & | out, | |
sample_entry const & | sample, | |||
size_t | count | |||
) | [private] |
virtual void format_output::xml_formatter::output_symbol | ( | std::ostream & | out, | |
symbol_entry const * | symb, | |||
size_t | lo, | |||
size_t | hi, | |||
bool | is_module | |||
) | [virtual] |
output one symbol symb to out according to the output format specifier previously set by call(s) to add_format()
Reimplemented in format_output::xml_cg_formatter.
Referenced by module_info::output_symbols().
void format_output::xml_formatter::output_symbol_data | ( | std::ostream & | out | ) |
string format_output::xml_formatter::output_symbol_details | ( | symbol_entry const * | symb, | |
size_t & | detail_index, | |||
size_t const | lo, | |||
size_t const | hi | |||
) |
output details for the symbol
Definition at line 780 of file format_output.cpp.
References profile_container::begin(), close_element(), sample_entry::counts, DETAIL_DATA, profile_container::end(), format_output::formatter::extra_found_images, sample_entry::file_loc, has_sample_counts(), init_attr(), NONE, open_element(), output_attribute(), output_sample_data(), profile, symbol_entry::sample, SOURCE_FILE, SOURCE_LINE, TABLE_ID, and VMA.
void format_output::xml_formatter::output_the_symbol_data | ( | std::ostream & | out, | |
symbol_entry const * | symb, | |||
op_bfd *& | abfd | |||
) | [private] |
void format_output::formatter::set_nr_classes | ( | size_t | nr_classes | ) | [inherited] |
Set the number of collected profile classes. Each class will output sample count and percentage in extra columns.
This class assumes that the profile information has been populated with the right number of classes.
Definition at line 123 of file format_output.cpp.
References format_output::formatter::nr_classes.
void format_output::xml_formatter::show_details | ( | bool | on_off | ) |
set the output_details boolean
Definition at line 621 of file format_output.cpp.
References need_details.
void format_output::formatter::show_global_percent | ( | bool | on_off | ) | [inherited] |
use global count rather symbol count for details percent
Definition at line 153 of file format_output.cpp.
References format_output::formatter::global_percent.
void format_output::formatter::show_header | ( | bool | on_off | ) | [inherited] |
set the need_header boolean to false
Definition at line 135 of file format_output.cpp.
References format_output::formatter::need_header.
void format_output::formatter::show_long_filenames | ( | bool | on_off | ) | [inherited] |
show long (full path) filenames
Definition at line 147 of file format_output.cpp.
References format_output::formatter::long_filenames.
void format_output::formatter::vma_format_64bit | ( | bool | on_off | ) | [inherited] |
format for 64 bit wide VMAs
Definition at line 141 of file format_output.cpp.
counts_t format_output::formatter::counts [protected, inherited] |
total counts
Definition at line 156 of file format_output.h.
Referenced by format_output::cg_formatter::cg_formatter(), format_output::diff_formatter::diff_formatter(), format_output::opreport_formatter::opreport_formatter(), format_output::xml_cg_formatter::xml_cg_formatter(), and xml_formatter().
size_t format_output::xml_formatter::detail_count [private] |
Definition at line 275 of file format_output.h.
extra_images const& format_output::formatter::extra_found_images [protected, inherited] |
To retrieve the real image location, usefull when acting on an archive and for 2.6 kernel modules
Definition at line 172 of file format_output.h.
Referenced by format_output::formatter::format_app_name(), format_output::formatter::format_image_name(), get_bfd_object(), and output_symbol_details().
format_flags format_output::formatter::flags [protected, inherited] |
formatting flags set
Definition at line 159 of file format_output.h.
Referenced by format_output::formatter::add_format().
format_map_t format_output::formatter::format_map [protected, inherited] |
stores functors for doing actual formatting
Definition at line 150 of file format_output.h.
Referenced by format_output::formatter::formatter().
bool format_output::formatter::global_percent [protected, inherited] |
bool if details percentage are relative to total count rather to symbol count
Definition at line 168 of file format_output.h.
Referenced by format_output::formatter::show_global_percent().
bool format_output::formatter::long_filenames [protected, inherited] |
false if we use basename(filename) in output rather filename
Definition at line 163 of file format_output.h.
Referenced by format_output::formatter::format_app_name(), format_output::formatter::format_image_name(), format_output::formatter::format_linenr_info(), and format_output::formatter::show_long_filenames().
bool format_output::xml_formatter::need_details [private] |
true if we need to show details for each symbols
Definition at line 272 of file format_output.h.
Referenced by show_details().
bool format_output::formatter::need_header [protected, inherited] |
true if we need to show header before the first output
Definition at line 165 of file format_output.h.
Referenced by format_output::formatter::show_header().
size_t format_output::formatter::nr_classes [protected, inherited] |
number of profile classes
Definition at line 153 of file format_output.h.
Referenced by format_output::formatter::set_nr_classes().
profile_container const* format_output::xml_formatter::profile [private] |
container we work from
Definition at line 266 of file format_output.h.
Referenced by output_symbol_details(), and xml_formatter().
string_filter const& format_output::xml_formatter::symbol_filter [private] |
with --details we need to reopen the bfd object for each symb to get it's contents, hence we store the filter used by the bfd ctor.
Definition at line 279 of file format_output.h.
Referenced by get_bfd_object().
Definition at line 269 of file format_output.h.
bool format_output::formatter::vma_64 [protected, inherited] |
true if we need to format as 64 bits quantities
Definition at line 161 of file format_output.h.