diff -r aa9434a8c73e -r d5e71bf0fd0f src/mem/abstract_mem.hh --- a/src/mem/abstract_mem.hh Wed May 02 16:09:48 2012 -0400 +++ b/src/mem/abstract_mem.hh Wed May 02 16:10:33 2012 -0400 @@ -53,6 +53,9 @@ #include "params/AbstractMemory.hh" #include "sim/stats.hh" + +class System; + /** * An abstract memory represents a contiguous block of physical * memory, with an associated address range, and also provides basic @@ -140,17 +143,17 @@ } /** Number of total bytes read from this memory */ - Stats::Scalar bytesRead; + Stats::Vector bytesRead; /** Number of instruction bytes read from this memory */ - Stats::Scalar bytesInstRead; + Stats::Vector bytesInstRead; /** Number of bytes written to this memory */ - Stats::Scalar bytesWritten; + Stats::Vector bytesWritten; /** Number of read requests */ - Stats::Scalar numReads; + Stats::Vector numReads; /** Number of write requests */ - Stats::Scalar numWrites; + Stats::Vector numWrites; /** Number of other requests */ - Stats::Scalar numOther; + Stats::Vector numOther; /** Read bandwidth from this memory */ Stats::Formula bwRead; /** Read bandwidth from this memory */ @@ -172,6 +175,9 @@ typedef AbstractMemoryParams Params; + // Pointor to the System object + System *system; + AbstractMemory(const Params* p); virtual ~AbstractMemory(); diff -r aa9434a8c73e -r d5e71bf0fd0f src/mem/abstract_mem.cc --- a/src/mem/abstract_mem.cc Wed May 02 16:09:48 2012 -0400 +++ b/src/mem/abstract_mem.cc Wed May 02 16:10:33 2012 -0400 @@ -60,6 +60,7 @@ #include "debug/MemoryAccess.hh" #include "mem/abstract_mem.hh" #include "mem/packet_access.hh" +#include "sim/system.hh" using namespace std; @@ -117,53 +118,100 @@ using namespace Stats; bytesRead + .init(system->maxMasters()) .name(name() + ".bytes_read") .desc("Number of bytes read from this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bytesRead.subname(i, system->getMasterName(i)); + } bytesInstRead + .init(system->maxMasters()) .name(name() + ".bytes_inst_read") .desc("Number of instructions bytes read from this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bytesInstRead.subname(i, system->getMasterName(i)); + } bytesWritten + .init(system->maxMasters()) .name(name() + ".bytes_written") .desc("Number of bytes written to this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bytesWritten.subname(i, system->getMasterName(i)); + } numReads + .init(system->maxMasters()) .name(name() + ".num_reads") .desc("Number of read requests responded to by this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + numReads.subname(i, system->getMasterName(i)); + } numWrites + .init(system->maxMasters()) .name(name() + ".num_writes") .desc("Number of write requests responded to by this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + numWrites.subname(i, system->getMasterName(i)); + } numOther + .init(system->maxMasters()) .name(name() + ".num_other") .desc("Number of other requests responded to by this memory") + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + numOther.subname(i, system->getMasterName(i)); + } bwRead .name(name() + ".bw_read") .desc("Total read bandwidth from this memory (bytes/s)") .precision(0) .prereq(bytesRead) + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bwRead.subname(i, system->getMasterName(i)); + } + bwInstRead .name(name() + ".bw_inst_read") .desc("Instruction read bandwidth from this memory (bytes/s)") .precision(0) .prereq(bytesInstRead) + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bwInstRead.subname(i, system->getMasterName(i)); + } bwWrite .name(name() + ".bw_write") .desc("Write bandwidth from this memory (bytes/s)") .precision(0) .prereq(bytesWritten) + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bwWrite.subname(i, system->getMasterName(i)); + } bwTotal .name(name() + ".bw_total") .desc("Total bandwidth to/from this memory (bytes/s)") .precision(0) .prereq(bwTotal) + .flags(total | nozero | nonan) ; + for (int i = 0; i < system->maxMasters(); i++) { + bwTotal.subname(i, system->getMasterName(i)); + } bwRead = bytesRead / simSeconds; bwInstRead = bytesInstRead / simSeconds; bwWrite = bytesWritten / simSeconds; @@ -336,7 +384,7 @@ assert(!pkt->req->isInstFetch()); TRACE_PACKET("Read/Write"); - numOther++; + numOther[pkt->req->masterId()]++; } else if (pkt->isRead()) { assert(!pkt->isWrite()); if (pkt->isLLSC()) { @@ -345,18 +393,18 @@ if (pmemAddr) memcpy(pkt->getPtr(), hostAddr, pkt->getSize()); TRACE_PACKET(pkt->req->isInstFetch() ? "IFetch" : "Read"); - numReads++; - bytesRead += pkt->getSize(); + numReads[pkt->req->masterId()]++; + bytesRead[pkt->req->masterId()] += pkt->getSize(); if (pkt->req->isInstFetch()) - bytesInstRead += pkt->getSize(); + bytesInstRead[pkt->req->masterId()] += pkt->getSize(); } else if (pkt->isWrite()) { if (writeOK(pkt)) { if (pmemAddr) memcpy(hostAddr, pkt->getPtr(), pkt->getSize()); assert(!pkt->req->isInstFetch()); TRACE_PACKET("Write"); - numWrites++; - bytesWritten += pkt->getSize(); + numWrites[pkt->req->masterId()]++; + bytesWritten[pkt->req->masterId()] += pkt->getSize(); } } else if (pkt->isInvalidate()) { // no need to do anything diff -r aa9434a8c73e -r d5e71bf0fd0f src/sim/system.cc --- a/src/sim/system.cc Wed May 02 16:09:48 2012 -0400 +++ b/src/sim/system.cc Wed May 02 16:10:33 2012 -0400 @@ -145,6 +145,8 @@ // increment the number of running systms numSystemsRunning++; + for (int x = 0; x < params()->memories.size(); x++) + params()->memories[x]->system = this; } System::~System()