Otawa  0.10
StatCollector.h
Go to the documentation of this file.
1 /*
2  * $Id$
3  * StatCollector 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_STATCOLLECTOR_H_
23 #define OTAWA_STATS_STATCOLLECTOR_H_
24 
25 #include <otawa/base.h>
27 
28 namespace otawa {
29 
31 public:
32  virtual ~StatCollector(void);
33 
34  virtual cstring name(void) const = 0;
35  virtual cstring unit(void) const = 0;
36 
37  // value processing
38  virtual bool isEnum(void) const = 0;
39  virtual const cstring valueName(int value) = 0;
40  virtual int total(void) = 0;
41 
42  // collection
43  class Collector {
44  public:
45  virtual void enter(const ContextualStep& step) = 0;
46  virtual void collect(const Address& address, t::uint32 size, int value) = 0;
47  virtual void leave(void) = 0;
48  };
49  virtual void collect(Collector& collector) = 0;
50 
51  // statistics merge
52  virtual int mergeContext(int v1, int v2) = 0;
53  virtual int mergeAgreg(int v1, int v2) = 0;
54 };
55 
56 } // otawa
57 
58 #endif /* OTAWA_STATS_STATCOLLECTOR_H_ */
Definition: ContextualProperty.h:38
virtual bool isEnum(void) const =0
Test if the statistics concerns enumerated value.
This interface class must be implemented by any program that wants to collect statistics for the curr...
Definition: StatCollector.h:43
virtual void collect(const Address &address, t::uint32 size, int value)=0
Called for each program block for which a statistics exists.
virtual const cstring valueName(int value)=0
Get the name of an enumerated value (for human user, in english).
virtual cstring name(void) const =0
Name of the statistics (for human user, in english).
virtual ~StatCollector(void)
Definition: stats.cpp:30
uint32 size
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
virtual void collect(Collector &collector)=0
Called to collect the statistics.
virtual int total(void)=0
value_t value(CString name, int value)
A statistics collector allows to access statistics produced by an analysis.
Definition: StatCollector.h:30
The representation of an address in OTAWA.
Definition: base.h:54
virtual void enter(const ContextualStep &step)=0
virtual cstring unit(void) const =0
Name of statistics unit (for human user, in english).
virtual void leave(void)=0
virtual int mergeContext(int v1, int v2)=0
This function allows to merge statistics of a same block in different contexts.
uint32_t uint32
virtual int mergeAgreg(int v1, int v2)=0
This function allows to merge statistics when different blocks are aggregated.