Otawa  0.10
BBStatCollector.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * BBStatCollector class interface
4  *
5  * This file is part of OTAWA
6  * Copyright (c) 2011, IRIT UPS.
7  *
8  * OTAWA is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * OTAWA is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with OTAWA; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 #ifndef OTAWA_STATS_BBSTATCOLLECTOR_H_
23 #define OTAWA_STATS_BBSTATCOLLECTOR_H_
24 
25 #include <otawa/cfg.h>
26 #include "StatCollector.h"
27 
28 namespace otawa {
29 
31 public:
33  virtual void collect(Collector& collector);
34 
35 protected:
36  inline WorkSpace *ws(void) const { return _ws; }
37  inline CFG *cfg(void) const { return _cfg; }
38  virtual int total(void);
39  virtual void collect(Collector& collector, BasicBlock *bb) = 0;
40  virtual int total(BasicBlock *bb);
41 
42 private:
43  virtual void processCFG(Collector& collector, CFG *cfg);
44  void process(Collector& collector);
47  int _total;
48 };
49 
50 } // otawa
51 
52 #endif /* OTAWA_STATS_BBSTATCOLLECTOR_H_ */
This interface class must be implemented by any program that wants to collect statistics for the curr...
Definition: StatCollector.h:43
This class alleviates the work of building a statistics collector.
Definition: BBStatCollector.h:30
virtual void processCFG(Collector &collector, CFG *cfg)
Definition: stats_BBStatCollector.cpp:73
CFG * _cfg
Definition: BBStatCollector.h:46
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
Control Flow Graph representation.
Definition: CFG.h:42
virtual void collect(Collector &collector)
Called to collect the statistics.
Definition: stats_BBStatCollector.cpp:51
BBStatCollector(WorkSpace *ws)
Build the BB statistics collector.
Definition: stats_BBStatCollector.cpp:45
A statistics collector allows to access statistics produced by an analysis.
Definition: StatCollector.h:30
A workspace represents a program, its run-time and all information about WCET computation or any othe...
Definition: WorkSpace.h:67
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
virtual int total(void)
Default implementation of a total as the sum of the total of each basic block (method total(BasicBloc...
Definition: stats_BBStatCollector.cpp:205
int _total
Definition: BBStatCollector.h:47
void process(Collector &collector)
Process basic block of the current CFG.
Definition: stats_BBStatCollector.cpp:64
CFG * cfg(void) const
Definition: BBStatCollector.h:37
WorkSpace * _ws
Definition: BBStatCollector.h:45
WorkSpace * ws(void) const
Definition: BBStatCollector.h:36