comm_monitor.cc (10902:36b9241fa027) | comm_monitor.cc (10994:51ff41f6a4a5) |
---|---|
1/* 2 * Copyright (c) 2012-2013, 2015 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 --- 125 unchanged lines hidden (view full) --- 134 // Check the memory mode. We only record something when in 135 // timing mode. Warn accordingly. 136 if (!system->isTimingMode()) 137 warn("%s: Not in timing mode. No trace will be recorded.", name()); 138 } 139 140} 141 | 1/* 2 * Copyright (c) 2012-2013, 2015 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 --- 125 unchanged lines hidden (view full) --- 134 // Check the memory mode. We only record something when in 135 // timing mode. Warn accordingly. 136 if (!system->isTimingMode()) 137 warn("%s: Not in timing mode. No trace will be recorded.", name()); 138 } 139 140} 141 |
142void 143CommMonitor::regProbePoints() 144{ 145 ppPktReq.reset(new ProbePoints::Packet(getProbeManager(), "PktRequest")); 146 ppPktResp.reset(new ProbePoints::Packet(getProbeManager(), "PktResponse")); 147} 148 |
|
142BaseMasterPort& 143CommMonitor::getMasterPort(const std::string& if_name, PortID idx) 144{ 145 if (if_name == "master") { 146 return masterPort; 147 } else { 148 return MemObject::getMasterPort(if_name, idx); 149 } --- 19 unchanged lines hidden (view full) --- 169CommMonitor::recvFunctionalSnoop(PacketPtr pkt) 170{ 171 slavePort.sendFunctionalSnoop(pkt); 172} 173 174Tick 175CommMonitor::recvAtomic(PacketPtr pkt) 176{ | 149BaseMasterPort& 150CommMonitor::getMasterPort(const std::string& if_name, PortID idx) 151{ 152 if (if_name == "master") { 153 return masterPort; 154 } else { 155 return MemObject::getMasterPort(if_name, idx); 156 } --- 19 unchanged lines hidden (view full) --- 176CommMonitor::recvFunctionalSnoop(PacketPtr pkt) 177{ 178 slavePort.sendFunctionalSnoop(pkt); 179} 180 181Tick 182CommMonitor::recvAtomic(PacketPtr pkt) 183{ |
184 ppPktReq->notify(pkt); 185 |
|
177 // do stack distance calculations if enabled 178 if (stackDistCalc) 179 stackDistCalc->update(pkt->cmd, pkt->getAddr()); 180 181 // if tracing enabled, store the packet information 182 // to the trace stream 183 if (traceStream != NULL) { 184 ProtoMessage::Packet pkt_msg; 185 pkt_msg.set_tick(curTick()); 186 pkt_msg.set_cmd(pkt->cmdToIndex()); 187 pkt_msg.set_flags(pkt->req->getFlags()); 188 pkt_msg.set_addr(pkt->getAddr()); 189 pkt_msg.set_size(pkt->getSize()); 190 191 traceStream->write(pkt_msg); 192 } 193 | 186 // do stack distance calculations if enabled 187 if (stackDistCalc) 188 stackDistCalc->update(pkt->cmd, pkt->getAddr()); 189 190 // if tracing enabled, store the packet information 191 // to the trace stream 192 if (traceStream != NULL) { 193 ProtoMessage::Packet pkt_msg; 194 pkt_msg.set_tick(curTick()); 195 pkt_msg.set_cmd(pkt->cmdToIndex()); 196 pkt_msg.set_flags(pkt->req->getFlags()); 197 pkt_msg.set_addr(pkt->getAddr()); 198 pkt_msg.set_size(pkt->getSize()); 199 200 traceStream->write(pkt_msg); 201 } 202 |
194 return masterPort.sendAtomic(pkt); | 203 const Tick delay(masterPort.sendAtomic(pkt)); 204 assert(pkt->isResponse()); 205 ppPktResp->notify(pkt); 206 return delay; |
195} 196 197Tick 198CommMonitor::recvAtomicSnoop(PacketPtr pkt) 199{ 200 return slavePort.sendAtomicSnoop(pkt); 201} 202 203bool 204CommMonitor::recvTimingReq(PacketPtr pkt) 205{ 206 // should always see a request 207 assert(pkt->isRequest()); 208 209 // Store relevant fields of packet, because packet may be modified 210 // or even deleted when sendTiming() is called. | 207} 208 209Tick 210CommMonitor::recvAtomicSnoop(PacketPtr pkt) 211{ 212 return slavePort.sendAtomicSnoop(pkt); 213} 214 215bool 216CommMonitor::recvTimingReq(PacketPtr pkt) 217{ 218 // should always see a request 219 assert(pkt->isRequest()); 220 221 // Store relevant fields of packet, because packet may be modified 222 // or even deleted when sendTiming() is called. |
211 bool is_read = pkt->isRead(); 212 bool is_write = pkt->isWrite(); 213 MemCmd cmd = pkt->cmd; 214 int cmd_idx = pkt->cmdToIndex(); 215 Request::FlagsType req_flags = pkt->req->getFlags(); 216 unsigned size = pkt->getSize(); 217 Addr addr = pkt->getAddr(); 218 bool expects_response = pkt->needsResponse() && !pkt->memInhibitAsserted(); | 223 const bool is_read = pkt->isRead(); 224 const bool is_write = pkt->isWrite(); 225 const MemCmd cmd = pkt->cmd; 226 const int cmd_idx = pkt->cmdToIndex(); 227 const Request::FlagsType req_flags = pkt->req->getFlags(); 228 const unsigned size = pkt->getSize(); 229 const Addr addr = pkt->getAddr(); 230 const bool expects_response( 231 pkt->needsResponse() && !pkt->memInhibitAsserted()); |
219 220 // If a cache miss is served by a cache, a monitor near the memory 221 // would see a request which needs a response, but this response 222 // would be inhibited and not come back from the memory. Therefore 223 // we additionally have to check the inhibit flag. 224 if (expects_response && !stats.disableLatencyHists) { 225 pkt->pushSenderState(new CommMonitorSenderState(curTick())); 226 } 227 228 // Attempt to send the packet (always succeeds for inhibited 229 // packets) 230 bool successful = masterPort.sendTimingReq(pkt); 231 232 // If not successful, restore the sender state 233 if (!successful && expects_response && !stats.disableLatencyHists) { 234 delete pkt->popSenderState(); 235 } 236 | 232 233 // If a cache miss is served by a cache, a monitor near the memory 234 // would see a request which needs a response, but this response 235 // would be inhibited and not come back from the memory. Therefore 236 // we additionally have to check the inhibit flag. 237 if (expects_response && !stats.disableLatencyHists) { 238 pkt->pushSenderState(new CommMonitorSenderState(curTick())); 239 } 240 241 // Attempt to send the packet (always succeeds for inhibited 242 // packets) 243 bool successful = masterPort.sendTimingReq(pkt); 244 245 // If not successful, restore the sender state 246 if (!successful && expects_response && !stats.disableLatencyHists) { 247 delete pkt->popSenderState(); 248 } 249 |
250 if (successful) { 251 // The receiver might already have modified the packet. We 252 // want to give the probe access to the original packet, which 253 // means we need to fake the original packet by temporarily 254 // restoring the command. 255 const MemCmd response_cmd(pkt->cmd); 256 pkt->cmd = cmd; 257 ppPktReq->notify(pkt); 258 pkt->cmd = response_cmd; 259 } 260 |
|
237 // If successful and we are calculating stack distances, update 238 // the calculator 239 if (successful && stackDistCalc) 240 stackDistCalc->update(cmd, addr); 241 242 if (successful && traceStream != NULL) { 243 // Create a protobuf message representing the 244 // packet. Currently we do not preserve the flags in the --- 128 unchanged lines hidden (view full) --- 373 delete received_state; 374 } else { 375 // Don't delete anything and let the packet look like we 376 // did not touch it 377 pkt->senderState = received_state; 378 } 379 } 380 | 261 // If successful and we are calculating stack distances, update 262 // the calculator 263 if (successful && stackDistCalc) 264 stackDistCalc->update(cmd, addr); 265 266 if (successful && traceStream != NULL) { 267 // Create a protobuf message representing the 268 // packet. Currently we do not preserve the flags in the --- 128 unchanged lines hidden (view full) --- 397 delete received_state; 398 } else { 399 // Don't delete anything and let the packet look like we 400 // did not touch it 401 pkt->senderState = received_state; 402 } 403 } 404 |
405 if (successful) { 406 assert(pkt->isResponse()); 407 ppPktResp->notify(pkt); 408 } 409 |
|
381 if (successful && is_read) { 382 // Decrement number of outstanding read requests 383 DPRINTF(CommMonitor, "Received read response\n"); 384 if (!stats.disableOutstandingHists) { 385 assert(stats.outstandingReadReqs != 0); 386 --stats.outstandingReadReqs; 387 } 388 --- 240 unchanged lines hidden --- | 410 if (successful && is_read) { 411 // Decrement number of outstanding read requests 412 DPRINTF(CommMonitor, "Received read response\n"); 413 if (!stats.disableOutstandingHists) { 414 assert(stats.outstandingReadReqs != 0); 415 --stats.outstandingReadReqs; 416 } 417 --- 240 unchanged lines hidden --- |