gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
base.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013,2016 ARM Limited
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2003-2005 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40  * Authors: Erik Hallnor
41  * Ron Dreslinski
42  */
43 
49 #include "mem/cache/tags/base.hh"
50 
51 #include "cpu/smt.hh" //maxThreadsPerCPU
52 #include "mem/cache/base.hh"
53 #include "sim/sim_exit.hh"
54 
55 using namespace std;
56 
58  : ClockedObject(p), blkSize(p->block_size), blkMask(blkSize - 1),
59  size(p->size),
60  lookupLatency(p->tag_latency),
61  accessLatency(p->sequential_access ?
62  p->tag_latency + p->data_latency :
63  std::max(p->tag_latency, p->data_latency)),
64  cache(nullptr), warmupBound(0),
65  warmedUp(false), numBlocks(0)
66 {
67 }
68 
69 void
71 {
72  assert(!cache);
73  cache = _cache;
74 }
75 
76 void
78 {
80 
81  using namespace Stats;
82 
85  .name(name() + ".replacements")
86  .desc("number of replacements")
87  .flags(total)
88  ;
89 
90  tagsInUse
91  .name(name() + ".tagsinuse")
92  .desc("Cycle average of tags in use")
93  ;
94 
95  totalRefs
96  .name(name() + ".total_refs")
97  .desc("Total number of references to valid blocks.")
98  ;
99 
101  .name(name() + ".sampled_refs")
102  .desc("Sample count of references to valid blocks.")
103  ;
104 
105  avgRefs
106  .name(name() + ".avg_refs")
107  .desc("Average number of references to valid blocks.")
108  ;
109 
111 
113  .name(name() + ".warmup_cycle")
114  .desc("Cycle when the warmup percentage was hit.")
115  ;
116 
119  .name(name() + ".occ_blocks")
120  .desc("Average occupied blocks per requestor")
121  .flags(nozero | nonan)
122  ;
123  for (int i = 0; i < cache->system->maxMasters(); i++) {
125  }
126 
127  avgOccs
128  .name(name() + ".occ_percent")
129  .desc("Average percentage of cache occupancy")
130  .flags(nozero | total)
131  ;
132  for (int i = 0; i < cache->system->maxMasters(); i++) {
134  }
135 
137 
140  .name(name() + ".occ_task_id_blocks")
141  .desc("Occupied blocks per task id")
142  .flags(nozero | nonan)
143  ;
144 
145  ageTaskId
147  .name(name() + ".age_task_id_blocks")
148  .desc("Occupied blocks per task id")
149  .flags(nozero | nonan)
150  ;
151 
153  .name(name() + ".occ_task_id_percent")
154  .desc("Percentage of cache occupancy per task id")
155  .flags(nozero)
156  ;
157 
159 
161  .name(name() + ".tag_accesses")
162  .desc("Number of tag accesses")
163  ;
164 
166  .name(name() + ".data_accesses")
167  .desc("Number of data accesses")
168  ;
169 
172 }
Declares a basic cache interface BaseCache.
Stats::Scalar sampledRefs
The number of reference counts sampled.
Definition: base.hh:115
Defines SMT_MAX_THREADS.
Derived & init(size_type _x, size_type _y)
Definition: statistics.hh:1253
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
Definition: statistics.hh:358
Bitfield< 7 > i
Definition: miscregs.hh:1378
std::string getMasterName(MasterID master_id)
Get the name of an object for a given request id.
Definition: system.cc:490
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:59
Stats::Average tagsInUse
Per cycle average of the number of tags that hold valid data.
Definition: base.hh:105
Stats::Scalar totalRefs
The total number of references to a block before it is replaced.
Definition: base.hh:108
System * system
System we are currently operating in.
Definition: base.hh:329
void regStats()
Register local statistics.
Definition: base.cc:77
Stats::Vector occupanciesTaskId
Occupancy of each context/cpu using the cache.
Definition: base.hh:133
void setCache(BaseCache *_cache)
Set the parent cache back pointer.
Definition: base.cc:70
Stats::Vector replacements
Number of replacements of valid blocks per thread.
Definition: base.hh:103
BaseTags(const Params *p)
Definition: base.cc:57
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:311
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1118
Stats::Formula percentOccsTaskId
Occ % of each context/cpu using the cache.
Definition: base.hh:139
Declaration of a common base class for cache tagstore objects.
BaseTagsParams Params
Definition: base.hh:151
unsigned numBlocks
the number of blocks in the cache
Definition: base.hh:94
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Stats::Scalar tagAccesses
Number of tags consulted over all accesses.
Definition: base.hh:142
Temp constant(T val)
Definition: statistics.hh:3211
void registerExitCallback(Callback *callback)
Register an exit callback.
Definition: core.cc:116
A basic cache interface.
Definition: base.hh:79
Stats::Scalar warmupCycle
The cycle that the warmup percentage was hit.
Definition: base.hh:124
Stats::Formula avgOccs
Average occ % of each requestor using the cache.
Definition: base.hh:130
Stats::Vector2d ageTaskId
Occupancy of each context/cpu using the cache.
Definition: base.hh:136
Stats::Formula avgRefs
Average number of references to a block before is was replaced.
Definition: base.hh:121
int maxThreadsPerCPU
The maximum number of active threads across all cpus.
Definition: base.cc:85
const FlagsType total
Print the total.
Definition: info.hh:49
void registerDumpCallback(Callback *cb)
Register a callback that should be called whenever statistics are about to be dumped.
Definition: statistics.cc:535
MasterID maxMasters()
Get the number of masters registered in the system.
Definition: system.hh:344
Stats::Scalar dataAccesses
Number of data blocks consulted over all accesses.
Definition: base.hh:144
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:254
BaseCache * cache
Pointer to the parent cache.
Definition: base.hh:83
int size()
Definition: pagetable.hh:146
virtual const std::string name() const
Definition: sim_object.hh:117
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:287
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:57
Bitfield< 0 > p
Stats::AverageVector occupancies
Average occupancy of each requestor using the cache.
Definition: base.hh:127
void regStats() override
Register statistics for this object.

Generated on Fri Jun 9 2017 13:03:41 for gem5 by doxygen 1.8.6