slavePort(name() + "-slave", *this),
samplePeriodicEvent(this),
samplePeriodTicks(params->sample_period),
+ samplePeriod(params->sample_period / SimClock::Float::s),
readAddrMask(params->read_addr_mask),
writeAddrMask(params->write_addr_mask),
- stats(params),
stackDistCalc(params->stack_dist_calc),
- traceStream(NULL),
- system(params->system)
+ system(params->system),
+ traceStream(nullptr),
+ stats(params)
{
// If we are using a trace file, then open the file
if (params->trace_enable) {
registerExitCallback(cb);
}
- // keep track of the sample period both in ticks and absolute time
- samplePeriod.setTick(params->sample_period);
-
DPRINTF(CommMonitor,
"Created monitor %s with sample period %d ticks (%f ms)\n",
- name(), samplePeriodTicks, samplePeriod.msec());
+ name(), samplePeriodTicks, samplePeriod * 1E3);
}
CommMonitor::~CommMonitor()
if (stackDistCalc)
stackDistCalc->update(pkt->cmd, pkt->getAddr());
- // if tracing enabled, store the packet information
- // to the trace stream
- if (traceStream != NULL) {
+ // if tracing enabled, store the packet information
+ // to the trace stream
+ if (traceStream != NULL) {
ProtoMessage::Packet pkt_msg;
pkt_msg.set_tick(curTick());
pkt_msg.set_cmd(pkt->cmdToIndex());
/*
- * Copyright (c) 2012-2013 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 "mem/stack_dist_calc.hh"
#include "params/CommMonitor.hh"
class CommMonitor : public MemObject
{
- public:
+ public: // Construction & SimObject interfaces
/** Parameters of communication monitor */
typedef CommMonitorParams Params;
/** Destructor */
~CommMonitor();
- /**
- * 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);
+ void init() M5_ATTR_OVERRIDE;
+ void regStats() M5_ATTR_OVERRIDE;
+ void startup() M5_ATTR_OVERRIDE;
- virtual BaseSlavePort& getSlavePort(const std::string& if_name,
- PortID idx = InvalidPortID);
+ public: // MemObject interfaces
+ BaseMasterPort& getMasterPort(const std::string& if_name,
+ PortID idx = InvalidPortID) M5_ATTR_OVERRIDE;
- virtual void init();
-
- /** Register statistics */
- void regStats();
+ BaseSlavePort& getSlavePort(const std::string& if_name,
+ PortID idx = InvalidPortID) M5_ATTR_OVERRIDE;
private:
/** This function is called periodically at the end of each time bin */
void samplePeriodic();
- /** Schedule the first periodic event */
- void startup();
+ /**
+ * Callback to flush and close all open output streams on exit. If
+ * we were calling the destructor it could be done there.
+ */
+ void closeStreams();
/** 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;
-
- /** Instantiate stats */
- MonitorStats stats;
+ const Addr writeAddrMask;
/** Optional stack distance calculator */
- StackDistCalc* stackDistCalc;
+ StackDistCalc *const stackDistCalc;
+
+ /** The system in which the monitor lives */
+ System *const system;
+
+ /** @} */
/** Output stream for a potential trace. */
- ProtoOutputStream* traceStream;
+ ProtoOutputStream *traceStream;
- /** The system in which the monitor lives */
- System *system;
+ /** Instantiate stats */
+ MonitorStats stats;
};
#endif //__MEM_COMM_MONITOR_HH__