ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Partitioner::RegionStats Class Reference

Statistics computed over a region of an address space. More...

#include <Partitioner.h>

Classes

struct  AnalysisResult
 
struct  DictionaryEntry
 

Public Types

enum  AnalysisEnum {
  RA_NBYTES =0,
  RA_NINSNS,
  RA_NCOVERAGE,
  RA_RCOVERAGE,
  RA_NSTARTS,
  RA_NFAILS,
  RA_RFAILS,
  RA_NOVERLAPS,
  RA_ROVERLAPS,
  RA_NINCOMPLETE,
  RA_RINCOMPLETE,
  RA_NBRANCHES,
  RA_RBRANCHES,
  RA_NCALLS,
  RA_RCALLS,
  RA_NNONCALLS,
  RA_RNONCALLS,
  RA_NINTERNAL,
  RA_RINTERNAL,
  RA_NICFGEDGES,
  RA_RICFGEDGES,
  RA_NCOMPS,
  RA_RCOMPS,
  RA_NIUNIQUE,
  RA_RIUNIQUE,
  RA_NREGREFS,
  RA_RREGREFS,
  RA_REGSZ,
  RA_REGVAR,
  RA_NPRIV,
  RA_RPRIV,
  RA_NFLOAT,
  RA_RFLOAT
}
 IDs for predefined analyses. More...
 

Public Member Functions

 RegionStats ()
 
virtual ~RegionStats ()
 
virtual RegionStatscreate () const
 Return a new, allocated copy of this object. More...
 
virtual void add_sample (size_t id, double val, size_t nsamples=1)
 Add another sample point to this container. More...
 
virtual size_t get_nsamples (size_t id) const
 Returns the number of samples accumulated for an analysis. More...
 
virtual double get_sum (size_t id) const
 Returns the sum stored for the analysis. More...
 
virtual double get_value (size_t id) const
 Returns the value (sum/nsamples) of an analysis. More...
 
virtual void compute_ratios ()
 Called to compute ratios, etc. More...
 
virtual void set_value (size_t id, double val)
 Set value to indicated single sample unless value is NaN. More...
 
double divnan (size_t num_id, size_t den_id) const
 Safely computes the ratio of two values. More...
 
void add_samples (const RegionStats *)
 Add samples from other statistics object to this one. More...
 
void square_diff (const RegionStats *)
 Compute square of differences. More...
 
virtual void print (std::ostream &) const
 

Static Public Member Functions

static size_t define_analysis (const std::string &name, const std::string &desc, double weight, size_t id=(size_t)(-1))
 Add a new analysis to this RegionStats container. More...
 
static size_t find_analysis (const std::string &name)
 Return the ID for an analysis based on name. More...
 
static size_t get_nanalyses ()
 Number of anlyses defined by this class and super classes. More...
 
static const std::string & get_name (size_t id)
 Returns name of analysis. More...
 
static const std::string & get_desc (size_t id)
 Returns one-line description of analysis. More...
 
static double get_weight (size_t id)
 Returns the default weight in the analysis definition. More...
 

Static Protected Member Functions

static void init_class ()
 

Private Attributes

std::vector< AnalysisResultresults
 

Static Private Attributes

static std::vector
< DictionaryEntry
dictionary
 

Friends

std::ostream & operator<< (std::ostream &, const RegionStats &)
 

Detailed Description

Statistics computed over a region of an address space.

Most of the members are floating point because they are also used to compute averages. For instance, aggregate_statistics() can compute the average number of instructions per function.

This is a virtual class so that users can easily augment it with additional analyses. The Partitioner never instantiates RegionStats objects directly, but rather always by calling Partitioner::new_region_stats(). The statistics are computed by methods like Partitioner::region_statistics() and Partitioner::aggregate_statistics(), which the user can also agument or replace.

// TODO: add an example showing how to specialize this class.

See also, Partitioner::CodeCriteria.

Definition at line 717 of file Partitioner.h.

Member Enumeration Documentation

IDs for predefined analyses.

Derived classes should start their numbering at the value returned by get_nanalyses() after allowing this base class to initialize itself.

Enumerator
RA_NBYTES 
RA_NINSNS 
RA_NCOVERAGE 
RA_RCOVERAGE 
RA_NSTARTS 
RA_NFAILS 
RA_RFAILS 
RA_NOVERLAPS 
RA_ROVERLAPS 
RA_NINCOMPLETE 
RA_RINCOMPLETE 
RA_NBRANCHES 
RA_RBRANCHES 
RA_NCALLS 
RA_RCALLS 
RA_NNONCALLS 
RA_RNONCALLS 
RA_NINTERNAL 
RA_RINTERNAL 
RA_NICFGEDGES 
RA_RICFGEDGES 
RA_NCOMPS 
RA_RCOMPS 
RA_NIUNIQUE 
RA_RIUNIQUE 
RA_NREGREFS 
RA_RREGREFS 
RA_REGSZ 
RA_REGVAR 
RA_NPRIV 
RA_RPRIV 
RA_NFLOAT 
RA_RFLOAT 

Definition at line 741 of file Partitioner.h.

Constructor & Destructor Documentation

Partitioner::RegionStats::RegionStats ( )
inline

Definition at line 748 of file Partitioner.h.

References init_class().

virtual Partitioner::RegionStats::~RegionStats ( )
inlinevirtual

Definition at line 749 of file Partitioner.h.

Member Function Documentation

virtual RegionStats* Partitioner::RegionStats::create ( ) const
virtual

Return a new, allocated copy of this object.

static size_t Partitioner::RegionStats::define_analysis ( const std::string &  name,
const std::string &  desc,
double  weight,
size_t  id = (size_t)(-1) 
)
static

Add a new analysis to this RegionStats container.

static size_t Partitioner::RegionStats::find_analysis ( const std::string &  name)
static

Return the ID for an analysis based on name.

static size_t Partitioner::RegionStats::get_nanalyses ( )
static

Number of anlyses defined by this class and super classes.

static const std::string& Partitioner::RegionStats::get_name ( size_t  id)
static

Returns name of analysis.

static const std::string& Partitioner::RegionStats::get_desc ( size_t  id)
static

Returns one-line description of analysis.

static double Partitioner::RegionStats::get_weight ( size_t  id)
static

Returns the default weight in the analysis definition.

virtual void Partitioner::RegionStats::add_sample ( size_t  id,
double  val,
size_t  nsamples = 1 
)
virtual

Add another sample point to this container.

virtual size_t Partitioner::RegionStats::get_nsamples ( size_t  id) const
virtual

Returns the number of samples accumulated for an analysis.

virtual double Partitioner::RegionStats::get_sum ( size_t  id) const
virtual

Returns the sum stored for the analysis.

virtual double Partitioner::RegionStats::get_value ( size_t  id) const
virtual

Returns the value (sum/nsamples) of an analysis.

virtual void Partitioner::RegionStats::compute_ratios ( )
virtual

Called to compute ratios, etc.

from other stats.

virtual void Partitioner::RegionStats::set_value ( size_t  id,
double  val 
)
virtual

Set value to indicated single sample unless value is NaN.

double Partitioner::RegionStats::divnan ( size_t  num_id,
size_t  den_id 
) const

Safely computes the ratio of two values.

void Partitioner::RegionStats::add_samples ( const RegionStats )

Add samples from other statistics object to this one.

void Partitioner::RegionStats::square_diff ( const RegionStats )

Compute square of differences.

virtual void Partitioner::RegionStats::print ( std::ostream &  ) const
virtual
static void Partitioner::RegionStats::init_class ( )
staticprotected

Referenced by RegionStats().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const RegionStats  
)
friend

Member Data Documentation

std::vector<DictionaryEntry> Partitioner::RegionStats::dictionary
staticprivate

Definition at line 735 of file Partitioner.h.

std::vector<AnalysisResult> Partitioner::RegionStats::results
private

Definition at line 736 of file Partitioner.h.


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