gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
activity.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Authors: Kevin Lim
29  */
30 
31 #ifndef __CPU_ACTIVITY_HH__
32 #define __CPU_ACTIVITY_HH__
33 
34 #include "base/trace.hh"
35 #include "cpu/timebuf.hh"
36 
53 {
54  public:
55  ActivityRecorder(const std::string &name, int num_stages,
56  int longest_latency, int count);
58 
60  void activity();
61 
66  void advance();
67 
69  void activateStage(const int idx);
70 
72  void deactivateStage(const int idx);
73 
75  bool getStageActive(const int idx) const { return stageActive[idx]; }
76 
78  int getNumStages() const { return numStages; }
79 
81  int getActivityCount() const { return activityCount; }
82 
86  void setActivityCount(int count)
87  { activityCount = count; }
88 
90  bool active() { return activityCount; }
91 
93  void reset();
94 
96  void dump();
97 
101  void validate();
102 
103  const std::string &name() const { return _name; }
104 
105  private:
106  // provide name() for DPRINTF.
107  std::string _name;
108 
118 
121 
132 
135 
137  bool *stageActive;
138 };
139 
140 #endif // __CPU_ACTIVITY_HH__
count
Definition: misc.hh:704
void validate()
Debug function to ensure that the activity count matches the contents of the time buffer...
Definition: activity.cc:153
TimeBuffer< bool > activityBuffer
Time buffer that tracks if any cycles has active communication in them.
Definition: activity.hh:117
bool * stageActive
Records which stages are active/inactive.
Definition: activity.hh:137
int activityCount
Tracks how many stages and cycles of time buffer have activity.
Definition: activity.hh:131
int numStages
Number of stages that can be marked as active or inactive.
Definition: activity.hh:134
const std::string & name() const
Definition: activity.hh:103
void activity()
Records that there is activity this cycle.
Definition: activity.cc:56
void reset()
Clears the time buffer and the activity count.
Definition: activity.cc:126
ActivityRecorder(const std::string &name, int num_stages, int longest_latency, int count)
Definition: activity.cc:40
int getActivityCount() const
Returns how many things are active within the recorder.
Definition: activity.hh:81
void deactivateStage(const int idx)
Deactivates a stage.
Definition: activity.cc:109
void dump()
Debug function to dump the contents of the time buffer.
Definition: activity.cc:135
int getNumStages() const
Returns the number of stages.
Definition: activity.hh:78
void activateStage(const int idx)
Marks a stage as active.
Definition: activity.cc:92
ActivityRecorder helper class that informs the CPU if it can switch over to being idle or not...
Definition: activity.hh:52
bool active()
Returns if the CPU should be active.
Definition: activity.hh:90
std::string _name
Definition: activity.hh:107
int longestLatency
Longest latency time buffer in the CPU.
Definition: activity.hh:120
bool getStageActive(const int idx) const
Returns the activity status of a stage.
Definition: activity.hh:75
void advance()
Advances the activity buffer, decrementing the activityCount if active communication just left the ti...
Definition: activity.cc:72
void setActivityCount(int count)
Sets the count to a starting value.
Definition: activity.hh:86

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