gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sequencer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
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 
29 #ifndef __MEM_RUBY_SYSTEM_SEQUENCER_HH__
30 #define __MEM_RUBY_SYSTEM_SEQUENCER_HH__
31 
32 #include <iostream>
33 #include <unordered_map>
34 
35 #include "mem/protocol/MachineType.hh"
36 #include "mem/protocol/RubyRequestType.hh"
37 #include "mem/protocol/SequencerRequestType.hh"
41 #include "params/RubySequencer.hh"
42 
44 {
46  RubyRequestType m_type;
48 
49  SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type,
50  Cycles _issue_time)
51  : pkt(_pkt), m_type(_m_type), issue_time(_issue_time)
52  {}
53 };
54 
55 std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj);
56 
57 class Sequencer : public RubyPort
58 {
59  public:
60  typedef RubySequencerParams Params;
61  Sequencer(const Params *);
62  ~Sequencer();
63 
64  // Public Methods
65  void wakeup(); // Used only for deadlock detection
66  void resetStats();
67  void collateStats();
68  void regStats();
69 
70  void writeCallback(Addr address,
71  DataBlock& data,
72  const bool externalHit = false,
73  const MachineType mach = MachineType_NUM,
74  const Cycles initialRequestTime = Cycles(0),
75  const Cycles forwardRequestTime = Cycles(0),
76  const Cycles firstResponseTime = Cycles(0));
77 
78  void readCallback(Addr address,
79  DataBlock& data,
80  const bool externalHit = false,
81  const MachineType mach = MachineType_NUM,
82  const Cycles initialRequestTime = Cycles(0),
83  const Cycles forwardRequestTime = Cycles(0),
84  const Cycles firstResponseTime = Cycles(0));
85 
86  RequestStatus makeRequest(PacketPtr pkt);
87  bool empty() const;
88  int outstandingCount() const { return m_outstanding_count; }
89 
91  { return deadlockCheckEvent.scheduled(); }
92 
95 
96  void print(std::ostream& out) const;
97  void checkCoherence(Addr address);
98 
99  void markRemoved();
100  void evictionCallback(Addr address);
101  void invalidateSC(Addr address);
102  int coreId() const { return m_coreId; }
103 
104  void recordRequestType(SequencerRequestType requestType);
106 
109  { return *m_typeLatencyHist[t]; }
110 
113  { return *m_hitTypeLatencyHist[t]; }
114 
116  { return *m_hitMachLatencyHist[t]; }
117 
119  { return *m_hitTypeMachLatencyHist[r][t]; }
120 
122  { return m_missLatencyHist; }
124  { return *m_missTypeLatencyHist[t]; }
125 
127  { return *m_missMachLatencyHist[t]; }
128 
130  getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
131  { return *m_missTypeMachLatencyHist[r][t]; }
132 
134  { return *m_IssueToInitialDelayHist[t]; }
135 
137  getInitialToForwardDelayHist(const MachineType t) const
138  { return *m_InitialToForwardDelayHist[t]; }
139 
141  getForwardRequestToFirstResponseHist(const MachineType t) const
143 
145  getFirstResponseToCompletionDelayHist(const MachineType t) const
147 
148  Stats::Counter getIncompleteTimes(const MachineType t) const
149  { return m_IncompleteTimes[t]; }
150 
151  private:
152  void issueRequest(PacketPtr pkt, RubyRequestType type);
153 
154  void hitCallback(SequencerRequest* request, DataBlock& data,
155  bool llscSuccess,
156  const MachineType mach, const bool externalHit,
157  const Cycles initialRequestTime,
158  const Cycles forwardRequestTime,
159  const Cycles firstResponseTime);
160 
161  void recordMissLatency(const Cycles t, const RubyRequestType type,
162  const MachineType respondingMach,
163  bool isExternalHit, Cycles issuedTime,
164  Cycles initialRequestTime,
165  Cycles forwardRequestTime, Cycles firstResponseTime,
166  Cycles completionTime);
167 
168  RequestStatus insertRequest(PacketPtr pkt, RubyRequestType request_type);
169  bool handleLlsc(Addr address, SequencerRequest* request);
170 
171  // Private copy constructor and assignment operator
172  Sequencer(const Sequencer& obj);
173  Sequencer& operator=(const Sequencer& obj);
174 
175  private:
178 
181 
182  // The cache access latency for top-level caches (L0/L1). These are
183  // currently assessed at the beginning of each memory access through the
184  // sequencer.
185  // TODO: Migrate these latencies into top-level cache controllers.
188 
189  typedef std::unordered_map<Addr, SequencerRequest*> RequestTable;
192  // Global outstanding request count, across all request tables
195 
201 
202  int m_coreId;
203 
205 
208 
212 
217 
222 
227 
232 
239 
240 
242  {
243  private:
245 
246  public:
249  const char *description() const { return "Sequencer deadlock check"; }
250  };
251 
253 };
254 
255 inline std::ostream&
256 operator<<(std::ostream& out, const Sequencer& obj)
257 {
258  obj.print(out);
259  out << std::flush;
260  return out;
261 }
262 
263 #endif // __MEM_RUBY_SYSTEM_SEQUENCER_HH__
Stats::Histogram & getIssueToInitialDelayHist(uint32_t t) const
Definition: Sequencer.hh:133
Stats::Scalar m_store_waiting_on_load
Counters for recording aliasing information.
Definition: Sequencer.hh:197
Stats::Histogram & getMissLatencyHist()
Definition: Sequencer.hh:121
Stats::Histogram & getHitTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:112
int m_max_outstanding_requests
Definition: Sequencer.hh:176
void resetStats()
Reset statistics associated with this object.
Definition: Sequencer.cc:134
void hitCallback(SequencerRequest *request, DataBlock &data, bool llscSuccess, const MachineType mach, const bool externalHit, const Cycles initialRequestTime, const Cycles forwardRequestTime, const Cycles firstResponseTime)
Definition: Sequencer.cc:439
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
SequencerWakeupEvent deadlockCheckEvent
Definition: Sequencer.hh:252
Cycles issue_time
Definition: Sequencer.hh:47
void print(std::ostream &out) const
Definition: Sequencer.cc:691
std::vector< Stats::Histogram * > m_missTypeLatencyHist
Definition: Sequencer.hh:226
Stats::Histogram & getTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:108
~Sequencer()
Definition: Sequencer.cc:78
Stats::Histogram & getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
Definition: Sequencer.hh:130
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:381
PacketPtr pkt
Definition: Sequencer.hh:45
std::vector< Stats::Histogram * > m_FirstResponseToCompletionDelayHist
Definition: Sequencer.hh:237
RequestStatus insertRequest(PacketPtr pkt, RubyRequestType request_type)
Definition: Sequencer.cc:165
void recordRequestType(SequencerRequestType requestType)
Definition: Sequencer.cc:712
Stats::Histogram m_missLatencyHist
Histogram for holding latency profile of all requests that miss in the controller connected to this s...
Definition: Sequencer.hh:225
Stats::Histogram m_latencyHist
Histogram for holding latency profile of all requests.
Definition: Sequencer.hh:210
Stats::Histogram & getHitTypeMachLatencyHist(uint32_t r, uint32_t t)
Definition: Sequencer.hh:118
CacheMemory * m_dataCache_ptr
Definition: Sequencer.hh:179
void recordMissLatency(const Cycles t, const RubyRequestType type, const MachineType respondingMach, bool isExternalHit, Cycles issuedTime, Cycles initialRequestTime, Cycles forwardRequestTime, Cycles firstResponseTime, Cycles completionTime)
Definition: Sequencer.cc:313
Cycles m_inst_cache_hit_latency
Definition: Sequencer.hh:187
std::vector< Stats::Histogram * > m_typeLatencyHist
Definition: Sequencer.hh:211
RequestTable m_readRequestTable
Definition: Sequencer.hh:191
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2475
Stats::Histogram m_outstandReqHist
Histogram for number of outstanding requests per cycle.
Definition: Sequencer.hh:207
void deschedule(Event &event)
Definition: eventq.hh:734
std::vector< Stats::Histogram * > m_ForwardToFirstResponseDelayHist
Definition: Sequencer.hh:236
CacheMemory * m_instCache_ptr
Definition: Sequencer.hh:180
const char data[]
Definition: circlebuf.cc:43
double Counter
All counters are of 64-bit values.
Definition: types.hh:43
RubyRequestType m_type
Definition: Sequencer.hh:46
std::vector< Stats::Histogram * > m_InitialToForwardDelayHist
Definition: Sequencer.hh:235
RequestTable m_writeRequestTable
Definition: Sequencer.hh:190
Stats::Histogram & getMissMachLatencyHist(uint32_t t) const
Definition: Sequencer.hh:126
int coreId() const
Definition: Sequencer.hh:102
bool m_deadlock_check_scheduled
Definition: Sequencer.hh:194
void invalidateSC(Addr address)
Definition: Sequencer.cc:257
SequencerWakeupEvent(Sequencer *_seq)
Definition: Sequencer.hh:247
void evictionCallback(Addr address)
Definition: Sequencer.cc:719
std::vector< Stats::Histogram * > m_hitTypeLatencyHist
Definition: Sequencer.hh:216
std::vector< Stats::Histogram * > m_IssueToInitialDelayHist
Histograms for recording the breakdown of miss latency.
Definition: Sequencer.hh:234
Stats::Histogram & getOutstandReqHist()
Definition: Sequencer.hh:105
Stats::Histogram & getHitLatencyHist()
Definition: Sequencer.hh:111
Stats::Histogram & getLatencyHist()
Definition: Sequencer.hh:107
bool handleLlsc(Addr address, SequencerRequest *request)
Definition: Sequencer.cc:268
A simple histogram stat.
Definition: statistics.hh:2551
Stats::Histogram & getHitMachLatencyHist(uint32_t t)
Definition: Sequencer.hh:115
MemObjectParams Params
Definition: mem_object.hh:63
std::vector< Stats::Histogram * > m_missMachLatencyHist
Histograms for profiling the latencies for requests that required external messages.
Definition: Sequencer.hh:230
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
void issueRequest(PacketPtr pkt, RubyRequestType type)
Definition: Sequencer.cc:627
Sequencer & operator=(const Sequencer &obj)
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
int m_coreId
Definition: Sequencer.hh:202
Stats::Histogram & getInitialToForwardDelayHist(const MachineType t) const
Definition: Sequencer.hh:137
const char * description() const
Return a C string describing the event.
Definition: Sequencer.hh:249
bool isDeadlockEventScheduled() const
Definition: Sequencer.hh:90
std::vector< std::vector< Stats::Histogram * > > m_missTypeMachLatencyHist
Definition: Sequencer.hh:231
std::vector< Stats::Counter > m_IncompleteTimes
Definition: Sequencer.hh:238
void regStats()
Register statistics for this object.
Definition: Sequencer.cc:725
type
Definition: misc.hh:728
std::unordered_map< Addr, SequencerRequest * > RequestTable
Definition: Sequencer.hh:189
Stats::Counter getIncompleteTimes(const MachineType t) const
Definition: Sequencer.hh:148
Cycles m_data_cache_hit_latency
Definition: Sequencer.hh:186
Stats::Histogram & getFirstResponseToCompletionDelayHist(const MachineType t) const
Definition: Sequencer.hh:145
Definition: eventq.hh:185
void descheduleDeadlockEvent()
Definition: Sequencer.hh:93
bool m_runningGarnetStandalone
Definition: Sequencer.hh:204
Stats::Histogram & getForwardRequestToFirstResponseHist(const MachineType t) const
Definition: Sequencer.hh:141
std::ostream & operator<<(std::ostream &out, const SequencerRequest &obj)
void markRemoved()
Definition: Sequencer.cc:249
Stats::Scalar m_store_waiting_on_store
Definition: Sequencer.hh:198
Stats::Scalar m_load_waiting_on_load
Definition: Sequencer.hh:200
std::vector< Stats::Histogram * > m_hitMachLatencyHist
Histograms for profiling the latencies for requests that did not required external messages...
Definition: Sequencer.hh:220
Stats::Histogram & getMissTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:123
Cycles m_deadlock_threshold
Definition: Sequencer.hh:177
Bitfield< 5 > t
Definition: miscregs.hh:1382
void wakeup()
Definition: Sequencer.cc:83
RubySequencerParams Params
Definition: Sequencer.hh:60
void readCallback(Addr address, DataBlock &data, const bool externalHit=false, const MachineType mach=MachineType_NUM, const Cycles initialRequestTime=Cycles(0), const Cycles forwardRequestTime=Cycles(0), const Cycles firstResponseTime=Cycles(0))
Definition: Sequencer.cc:415
bool empty() const
Definition: Sequencer.cc:531
RequestStatus makeRequest(PacketPtr pkt)
Definition: Sequencer.cc:537
SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type, Cycles _issue_time)
Definition: Sequencer.hh:49
void collateStats()
void writeCallback(Addr address, DataBlock &data, const bool externalHit=false, const MachineType mach=MachineType_NUM, const Cycles initialRequestTime=Cycles(0), const Cycles forwardRequestTime=Cycles(0), const Cycles firstResponseTime=Cycles(0))
Definition: Sequencer.cc:360
int m_outstanding_count
Definition: Sequencer.hh:193
Stats::Histogram m_hitLatencyHist
Histogram for holding latency profile of all requests that hit in the controller connected to this se...
Definition: Sequencer.hh:215
void checkCoherence(Addr address)
Definition: Sequencer.cc:704
Stats::Scalar m_load_waiting_on_store
Definition: Sequencer.hh:199
int outstandingCount() const
Definition: Sequencer.hh:88
std::vector< std::vector< Stats::Histogram * > > m_hitTypeMachLatencyHist
Definition: Sequencer.hh:221
Sequencer(const Params *)
Definition: Sequencer.cc:55

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