Otawa
0.10
|
This class alleviates the work of building a statistics collector. More...
#include <otawa/stats/BBStatCollector.h>
Public Member Functions | |
BBStatCollector (WorkSpace *ws) | |
Build the BB statistics collector. More... | |
virtual void | collect (Collector &collector) |
Called to collect the statistics. More... | |
virtual cstring | name (void) const =0 |
Name of the statistics (for human user, in english). More... | |
virtual cstring | unit (void) const =0 |
Name of statistics unit (for human user, in english). More... | |
virtual bool | isEnum (void) const =0 |
Test if the statistics concerns enumerated value. More... | |
virtual const cstring | valueName (int value)=0 |
Get the name of an enumerated value (for human user, in english). More... | |
virtual int | mergeContext (int v1, int v2)=0 |
This function allows to merge statistics of a same block in different contexts. More... | |
virtual int | mergeAgreg (int v1, int v2)=0 |
This function allows to merge statistics when different blocks are aggregated. More... | |
Protected Member Functions | |
WorkSpace * | ws (void) const |
CFG * | cfg (void) const |
virtual int | total (void) |
Default implementation of a total as the sum of the total of each basic block (method total(BasicBlock *). More... | |
virtual void | collect (Collector &collector, BasicBlock *bb)=0 |
This method is called for each basic block in the current workspace (except for syntactic entry and exit blocks). More... | |
virtual int | total (BasicBlock *bb) |
This method is automatically called on each basic block to compute the total() result as the sum of total of each basic block. More... | |
Private Member Functions | |
virtual void | processCFG (Collector &collector, CFG *cfg) |
void | process (Collector &collector) |
Process basic block of the current CFG. More... | |
Private Attributes | |
WorkSpace * | _ws |
CFG * | _cfg |
int | _total |
This class alleviates the work of building a statistics collector.
It ensures the traversal of all basic blocks and calls collect() to let the inheriting class do specific work for a basic block.
otawa::BBStatCollector::BBStatCollector | ( | WorkSpace * | ws | ) |
Build the BB statistics collector.
ws | Current workspace. |
|
inlineprotected |
References _cfg.
Referenced by processCFG().
|
virtual |
Called to collect the statistics.
collector | Collector of statistics. |
Implements otawa::StatCollector.
References _cfg, otawa::CFGCollection::count(), otawa::CFGCollection::get(), otawa::INVOLVED_CFGS, process(), and ws().
Referenced by processCFG().
|
protectedpure virtual |
This method is called for each basic block in the current workspace (except for syntactic entry and exit blocks).
It must specialized by the inheriting class to provide specific work.
The methods ws(), cfg() and path() allows to get the current information about the processed blocks.
collector | The invoker collector to pass statistics information. |
bb | Current basic block. |
|
pure virtualinherited |
Test if the statistics concerns enumerated value.
If this method returns true, method valueName() can be called to collect names of enumerated values. The number of enumerated values is given by the total method.
|
pure virtualinherited |
This function allows to merge statistics when different blocks are aggregated.
|
pure virtualinherited |
This function allows to merge statistics of a same block in different contexts.
|
pure virtualinherited |
Name of the statistics (for human user, in english).
|
private |
Process basic block of the current CFG.
collector | Collector to use. |
References _cfg, _ws, otawa::CFGCollection::count(), otawa::CFGCollection::get(), otawa::INVOLVED_CFGS, and processCFG().
Referenced by collect().
References _cfg, otawa::ProgItem::address(), otawa::BasicBlock::address(), otawa::cfgio::bb(), otawa::Edge::CALL, otawa::ContextualStep::CALL, otawa::CALLED_CFG, cfg(), collect(), otawa::BasicBlock::controlInst(), otawa::CFG::countBB(), otawa::cfgio::edge(), otawa::StatCollector::Collector::enter(), otawa::CFG::entry(), otawa::CFG::exit(), otawa::ContextualStep::FUNCTION, otawa::BasicBlock::isEntry(), otawa::Edge::kind(), otawa::StatCollector::Collector::leave(), otawa::Edge::NONE, otawa::Edge::NOT_TAKEN, otawa::BasicBlock::number(), elm::genstruct::Vector< T >::pop(), elm::genstruct::Vector< T >::push(), otawa::Edge::source(), otawa::Edge::TAKEN, otawa::Edge::target(), elm::genstruct::Vector< T >::top(), otawa::Edge::VIRTUAL, otawa::Edge::VIRTUAL_CALL, otawa::Edge::VIRTUAL_RETURN, and otawa::VIRTUAL_RETURN_BLOCK.
Referenced by process().
|
protectedvirtual |
Default implementation of a total as the sum of the total of each basic block (method total(BasicBlock *).
It may be overriden if the default behavior does not match. As a default, entry and exit nodes are ignored.
Implements otawa::StatCollector.
References _cfg, _total, _ws, otawa::cfgio::bb(), otawa::CFGCollection::count(), otawa::CFGCollection::get(), and otawa::INVOLVED_CFGS.
|
protectedvirtual |
This method is automatically called on each basic block to compute the total() result as the sum of total of each basic block.
This methodmust be overriden to provide a customized behaviour. As a default, it returns 0.
bb | Current basic block. |
|
pure virtualinherited |
Name of statistics unit (for human user, in english).
|
pure virtualinherited |
Get the name of an enumerated value (for human user, in english).
May only be called if isEnum() returns true.
value | Enumerated value. |
|
inlineprotected |
|
private |
Referenced by cfg(), collect(), process(), processCFG(), and total().
|
private |
Referenced by total().