profile_container Class Reference

#include <profile_container.h>

Inheritance diagram for profile_container:
Inheritance graph
[legend]
Collaboration diagram for profile_container:
Collaboration graph
[legend]

Data Structures

struct  symbol_choice
 used for select_symbols() More...

Public Member Functions

 profile_container (bool debug_info, bool need_details, extra_images const &extra)
 ~profile_container ()
void add (profile_t const &profile, op_bfd const &abfd, std::string const &app_name, size_t pclass)
symbol_entry const * find_symbol (std::string const &image_name, bfd_vma vma) const
symbol_collection const find_symbol (debug_name_id filename, size_t linenr) const
sample_entry const * find_sample (symbol_entry const *symbol, bfd_vma vma) const
symbol_entry const * find (symbol_entry const &symbol) const
 Find a symbol. Return NULL if not found.
symbol_collection const select_symbols (symbol_choice &choice) const
symbol_collection const select_symbols (debug_name_id filename) const
std::vector< debug_name_id > const select_filename (double threshold) const
 Like select_symbols for filename without allowing sort by vma.
count_array_t samples_count () const
 return the total number of samples
count_array_t samples_count (debug_name_id filename_id) const
count_array_t samples_count (debug_name_id filename, size_t linenr) const
symbol_container::symbols_t::iterator begin_symbol () const
 return an iterator to the first symbol
symbol_container::symbols_t::iterator end_symbol () const
 return an iterator to the last symbol
sample_container::samples_iterator begin () const
 return iterator to the first samples
sample_container::samples_iterator end () const
 return iterator to the last samples
sample_container::samples_iterator begin (symbol_entry const *) const
 return iterator to the first samples for this symbol
sample_container::samples_iterator end (symbol_entry const *) const
 return iterator to the last samples for this symbol

Data Fields

extra_images extra_found_images

Private Member Functions

void add_samples (op_bfd const &abfd, symbol_index_t sym_index, profile_t::iterator_pair const &, symbol_entry const *symbol, size_t pclass, unsigned long start)
 helper for add()
std::string create_artificial_symbol (op_bfd const &abfd, u32 start, u32 &end, size_t &order)

Private Attributes

scoped_ptr< symbol_containersymbols
scoped_ptr< sample_containersamples
count_array_t total_count



bool debug_info
bool need_details

Detailed Description

Store multiple samples files belonging to the same profiling session. This is the main container capable of holding the profiles for arbitrary binary images and arbitrary profile classes.

Definition at line 35 of file profile_container.h.


Constructor & Destructor Documentation

profile_container::profile_container ( bool  debug_info,
bool  need_details,
extra_images const &  extra 
)

Build an object to store information on samples. All parameters acts as hint for what you will request after recording samples and so allow optimizations during recording the information.

Parameters:
debug_info If true line numbers and source files are recorded.
need_details If true if we need to record all samples or to to record them at symbol level.
extra extra images location

Definition at line 52 of file profile_container.cpp.

profile_container::~profile_container (  ) 

Definition at line 64 of file profile_container.cpp.


Member Function Documentation

void profile_container::add ( profile_t const &  profile,
op_bfd const &  abfd,
std::string const &  app_name,
size_t  pclass 
)

add() - record symbols/samples in the underlying container

Parameters:
profile the samples files container
abfd the associated bfd object
app_name the owning application name of sample
pclass the profile class to add results for

add() is an helper for delayed ctor. Take care you can't safely make any call to add after any other member function call. Obviously you can add only samples files which are coherent (same sampling rate, same events etc.)

Referenced by populate_for_image().

Here is the caller graph for this function:

void profile_container::add_samples ( op_bfd const &  abfd,
symbol_index_t  sym_index,
profile_t::iterator_pair const &  p_it,
symbol_entry const *  symbol,
size_t  pclass,
unsigned long  start 
) [private]
sample_container::samples_iterator profile_container::begin ( symbol_entry const *  symbol  )  const

return iterator to the first samples for this symbol

Definition at line 297 of file profile_container.cpp.

References samples.

sample_container::samples_iterator profile_container::begin (  )  const

return iterator to the first samples

Definition at line 310 of file profile_container.cpp.

References samples.

Referenced by format_output::xml_formatter::output_symbol_details().

Here is the caller graph for this function:

symbol_container::symbols_t::iterator profile_container::begin_symbol (  )  const

return an iterator to the first symbol

Definition at line 326 of file profile_container.cpp.

References symbols.

Referenced by callgraph_container::add_symbols(), and diff_container::get_symbols().

Here is the caller graph for this function:

std::string profile_container::create_artificial_symbol ( op_bfd const &  abfd,
u32  start,
u32 end,
size_t &  order 
) [private]

create an unique artificial symbol for an offset range. The range is only a hint of the maximum size of the created symbol. We give to the symbol an unique name as ?image_file_name::order and a range up to the nearest of syms or for the whole range if no syms exist after the start offset. the end parameter is updated to reflect the symbol range.

The rationale here is to try to create symbols for alignment between function as little as possible and to create meaningfull symbols for special case such image w/o symbol.

sample_container::samples_iterator profile_container::end ( symbol_entry const *  symbol  )  const

return iterator to the last samples for this symbol

Definition at line 304 of file profile_container.cpp.

References samples.

sample_container::samples_iterator profile_container::end (  )  const

return iterator to the last samples

Definition at line 316 of file profile_container.cpp.

References samples.

Referenced by format_output::xml_formatter::output_symbol_details(), select_filename(), and select_symbols().

Here is the caller graph for this function:

symbol_container::symbols_t::iterator profile_container::end_symbol (  )  const

return an iterator to the last symbol

Definition at line 331 of file profile_container.cpp.

References symbols.

Referenced by callgraph_container::add_symbols(), and diff_container::get_symbols().

Here is the caller graph for this function:

symbol_entry const * profile_container::find ( symbol_entry const &  symbol  )  const

Find a symbol. Return NULL if not found.

Definition at line 321 of file profile_container.cpp.

References symbols.

sample_entry const * profile_container::find_sample ( symbol_entry const *  symbol,
bfd_vma  vma 
) const

Find a sample by its symbol, vma, return zero if there is no sample at this vma

Definition at line 277 of file profile_container.cpp.

References samples.

symbol_collection const profile_container::find_symbol ( debug_name_id  filename,
size_t  linenr 
) const

Find the symbols from its filename, linenr, return an empty symbol_collection if no symbol at this location

Definition at line 264 of file profile_container.cpp.

References symbols.

symbol_entry const* profile_container::find_symbol ( std::string const &  image_name,
bfd_vma  vma 
) const

Find a symbol from its image_name, vma, return zero if no symbol for this image at this vma

count_array_t profile_container::samples_count ( debug_name_id  filename,
size_t  linenr 
) const

Get the samples count which belongs to filename, linenr. Return 0 if no samples found.

Definition at line 289 of file profile_container.cpp.

References samples.

count_array_t profile_container::samples_count ( debug_name_id  filename_id  )  const

Get the samples count which belongs to filename. Return 0 if no samples found.

Definition at line 283 of file profile_container.cpp.

References samples.

count_array_t profile_container::samples_count (  )  const

return the total number of samples

Definition at line 248 of file profile_container.cpp.

References total_count.

Referenced by format_output::opreport_formatter::opreport_formatter(), select_filename(), and format_output::xml_formatter::xml_formatter().

Here is the caller graph for this function:

vector< debug_name_id > const profile_container::select_filename ( double  threshold  )  const

Like select_symbols for filename without allowing sort by vma.

Definition at line 195 of file profile_container.cpp.

References end(), op_ratio(), ratio(), samples, samples_count(), and total_count.

Here is the call graph for this function:

symbol_collection const profile_container::select_symbols ( debug_name_id  filename  )  const

select_symbols - create a set of symbols belonging to a given source

Parameters:
filename source file where are defined the returned symbols

Definition at line 271 of file profile_container.cpp.

References symbols.

symbol_collection const profile_container::select_symbols ( symbol_choice choice  )  const

select_symbols - create a set of symbols sorted by sample count

Parameters:
choice parameters to use/fill in when selecting

Definition at line 166 of file profile_container.cpp.

References end(), profile_container::symbol_choice::hints, profile_container::symbol_choice::image_name, image_names, profile_container::symbol_choice::match_image, filename_storage< I >::name(), op_ratio(), symbols, profile_container::symbol_choice::threshold, options::threshold, and total_count.

Here is the call graph for this function:


Field Documentation

Optimization hints for what information we are going to need, see the explanation in profile_container()

Definition at line 180 of file profile_container.h.

Referenced by add_samples().

Definition at line 185 of file profile_container.h.

Referenced by populate_for_image().

Definition at line 181 of file profile_container.h.

The samples count collected by pp tools sorted by increased vma, provide also a sort order on (filename, linenr)

Definition at line 170 of file profile_container.h.

Referenced by add_samples(), begin(), end(), find_sample(), samples_count(), and select_filename().

The symbols collected by pp tools sorted by increased vma, provide also a sort order on samples count for each profile class

Definition at line 167 of file profile_container.h.

Referenced by begin_symbol(), end_symbol(), find(), find_symbol(), and select_symbols().

build() must count samples count for each profile class so cache it here since user of profile_container often need it later.

Definition at line 173 of file profile_container.h.

Referenced by samples_count(), select_filename(), and select_symbols().


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

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1