/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012-2013, 2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#define __MEM_COMM_MONITOR_HH__
#include "base/statistics.hh"
-#include "base/time.hh"
#include "mem/mem_object.hh"
#include "params/CommMonitor.hh"
-#include "proto/protoio.hh"
+#include "sim/probe/mem.hh"
/**
* The communication monitor is a MemObject which can monitor statistics of
class CommMonitor : public MemObject
{
- public:
+ public: // Construction & SimObject interfaces
/** Parameters of communication monitor */
typedef CommMonitorParams Params;
*/
CommMonitor(Params* params);
- /** Destructor */
- ~CommMonitor() {}
+ void init() override;
+ void regStats() override;
+ void startup() override;
+ void regProbePoints() override;
- /**
- * Callback to flush and close all open output streams on exit. If
- * we were calling the destructor it could be done there.
- */
- void closeStreams();
-
- virtual BaseMasterPort& getMasterPort(const std::string& if_name,
- PortID idx = InvalidPortID);
+ public: // MemObject interfaces
+ BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID) override;
- virtual BaseSlavePort& getSlavePort(const std::string& if_name,
- PortID idx = InvalidPortID);
-
- virtual void init();
-
- /** Register statistics */
- void regStats();
+ BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID) override;
private:
public:
/**
- * Construct a new sender state and remember the original one
- * so that we can implement a stack.
+ * Construct a new sender state and store the time so we can
+ * calculate round-trip latency.
*
- * @param _origSenderState Sender state to remember
* @param _transmitTime Time of packet transmission
*/
- CommMonitorSenderState(SenderState* _origSenderState,
- Tick _transmitTime)
- : origSenderState(_origSenderState), transmitTime(_transmitTime)
+ CommMonitorSenderState(Tick _transmitTime)
+ : transmitTime(_transmitTime)
{ }
/** Destructor */
~CommMonitorSenderState() { }
- /** Pointer to old sender state of packet */
- SenderState* origSenderState;
-
/** Tick when request is transmitted */
Tick transmitTime;
return mon.isSnooping();
}
- unsigned deviceBlockSize() const
+ void recvReqRetry()
{
- return mon.deviceBlockSizeMaster();
+ mon.recvReqRetry();
}
- void recvRetry()
+ void recvRetrySnoopResp()
{
- mon.recvRetryMaster();
+ mon.recvRetrySnoopResp();
}
private:
return mon.recvTimingSnoopResp(pkt);
}
- unsigned deviceBlockSize() const
- {
- return mon.deviceBlockSizeSlave();
- }
-
AddrRangeList getAddrRanges() const
{
return mon.getAddrRanges();
}
- void recvRetry()
+ void recvRespRetry()
{
- mon.recvRetrySlave();
+ mon.recvRespRetry();
}
private:
bool recvTimingSnoopResp(PacketPtr pkt);
- unsigned deviceBlockSizeMaster();
-
- unsigned deviceBlockSizeSlave();
+ void recvRetrySnoopResp();
AddrRangeList getAddrRanges() const;
bool isSnooping() const;
- void recvRetryMaster();
+ void recvReqRetry();
- void recvRetrySlave();
+ void recvRespRetry();
void recvRangeChange();
- void periodicTraceDump();
-
/** Stats declarations, all in a struct for convenience. */
struct MonitorStats
{
/** This function is called periodically at the end of each time bin */
void samplePeriodic();
- /** Schedule the first periodic event */
- void startup();
-
/** Periodic event called at the end of each simulation time bin */
EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent;
+ /**
+ *@{
+ * @name Configuration
+ */
+
/** Length of simulation time bin*/
- Tick samplePeriodTicks;
- Time samplePeriod;
+ const Tick samplePeriodTicks;
+ /** Sample period in seconds */
+ const double samplePeriod;
/** Address mask for sources of read accesses to be captured */
- Addr readAddrMask;
+ const Addr readAddrMask;
/** Address mask for sources of write accesses to be captured */
- Addr writeAddrMask;
+ const Addr writeAddrMask;
+
+ /** @} */
/** Instantiate stats */
MonitorStats stats;
- /** Output stream for a potential trace. */
- ProtoOutputStream* traceStream;
+ protected: // Probe points
+ /**
+ * @{
+ * @name Memory system probe points
+ */
+
+ /** Successfully forwarded request packet */
+ ProbePoints::PacketUPtr ppPktReq;
+
+ /** Successfully forwarded response packet */
+ ProbePoints::PacketUPtr ppPktResp;
+
+ /** @} */
};
#endif //__MEM_COMM_MONITOR_HH__