Otawa  0.10
categories.h
Go to the documentation of this file.
1 /*
2  * categories module interface
3  * Copyright (c) 2012, IRIT UPS.
4  *
5  * This file is part of OTAWA
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 #ifndef OTAWA_CACHE_CATEGORIES_H_
23 #define OTAWA_CACHE_CATEGORIES_H_
24 
25 #include <elm/assert.h>
26 #include <otawa/prop/Identifier.h>
27 #include <otawa/proc/Feature.h>
28 
29 namespace otawa {
30 
31 using namespace elm;
32 class BasicBlock;
33 
34 namespace cache {
35 
36 // categories
37 typedef enum category_t {
40  FIRST_HIT = 2,
44 } category_t;
46 
47 
48 // category stats
50 public:
51  CategoryStats(void);
52  void reset(void);
53  inline void add(category_t cat)
54  { ASSERT(cat <= NOT_CLASSIFIED); counts[cat]++; _total++; }
55  inline void addLinked(void) { _linked++; }
56 
57  inline int get(category_t cat) const
58  { ASSERT(cat <= NOT_CLASSIFIED); return counts[cat]; }
59  inline int total(void) const { return _total; }
60  inline int linked(void) const { return _linked; }
61 
62 private:
63  int counts[NOT_CLASSIFIED + 1];
64  int _total, _linked;
65 };
67 
68 // stats
73 
74 }
75 
76 // deprecation
88 
89 } // otawa::cache
90 
91 #endif // OTAWA_CACHE_FEATURES_H_
Definition: categories.h:39
void add(category_t cat)
Definition: categories.h:53
const category_t FIRST_HIT
Definition: categories.h:80
This class is used to store statistics about the categories about cache accesses. ...
Definition: categories.h:49
Definition: categories.h:40
Definition: categories.h:38
int _total
Definition: categories.h:64
int total(void) const
Get the total count of categories.
Definition: categories.h:59
Definition: categories.h:41
Identifier< CategoryStats * > & CATEGORY_STATS
Definition: cache_categories.cpp:162
p::feature ICACHE_CATEGORY_FEATURE
This feature asserts that a category is assigned at each l-block involved in the current task...
const category_t NOT_CLASSIFIED
Definition: categories.h:83
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
int linked(void) const
Get the count of linked statistics.
Definition: categories.h:60
Definition: categories.h:43
const category_t INVALID_CATEGORY
Definition: categories.h:78
const category_t ALWAYS_MISS
Definition: categories.h:82
category_t
Definition: categories.h:37
StringOption cache(command, 'c',"cache","used cache","path","")
void addLinked(void)
Add a new linked l-block to the statistics.
Definition: categories.h:55
const category_t FIRST_MISS
Definition: categories.h:81
const category_t ALWAYS_HIT
Definition: categories.h:79
sys::SystemOutStream & out
cache::CategoryStats CategoryStats
Definition: categories.h:86
Identifier< category_t > & CATEGORY
Definition: cache_categories.cpp:160
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
Identifier< BasicBlock * > & CATEGORY_HEADER
Definition: cache_categories.cpp:161
otawa::cache::category_t category_t
Definition: categories.h:77
Definition: categories.h:42
Shortcut to create a feature with a maker (without the mess of SilentFeature).
Definition: AbstractFeature.h:51