using namespace CopyEngineReg;
CopyEngine::CopyEngine(const Params &p)
- : PciDevice(p)
+ : PciDevice(p),
+ copyEngineStats(this, p.ChanCnt)
{
// All Reg regs are initialized to 0 by default
regs.chanCount = p.ChanCnt;
}
}
-void
-CopyEngine::regStats()
+CopyEngine::
+CopyEngineStats::CopyEngineStats(Stats::Group *parent,
+ const uint8_t &channel_count)
+ : Stats::Group(parent, "CopyEngine"),
+ ADD_STAT(bytesCopied, "Number of bytes copied by each engine"),
+ ADD_STAT(copiesProcessed, "Number of copies processed by each engine")
{
- PciDevice::regStats();
-
- using namespace Stats;
bytesCopied
- .init(regs.chanCount)
- .name(name() + ".bytes_copied")
- .desc("Number of bytes copied by each engine")
- .flags(total)
+ .init(channel_count)
+ .flags(Stats::total)
;
copiesProcessed
- .init(regs.chanCount)
- .name(name() + ".copies_processed")
- .desc("Number of copies processed by each engine")
- .flags(total)
+ .init(channel_count)
+ .flags(Stats::total)
;
}
cePort.dmaAction(MemCmd::WriteReq, ce->pciToDma(curDmaDesc->dest),
curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0);
- ce->bytesCopied[channelId] += curDmaDesc->len;
- ce->copiesProcessed[channelId]++;
+ ce->copyEngineStats.bytesCopied[channelId] += curDmaDesc->len;
+ ce->copyEngineStats.copiesProcessed[channelId]++;
}
void
private:
- Stats::Vector bytesCopied;
- Stats::Vector copiesProcessed;
+ struct CopyEngineStats : public Stats::Group
+ {
+ CopyEngineStats(Stats::Group *parent, const uint8_t& channel_count);
+
+ Stats::Vector bytesCopied;
+ Stats::Vector copiesProcessed;
+ } copyEngineStats;
// device registers
CopyEngineReg::Regs regs;
CopyEngine(const Params ¶ms);
~CopyEngine();
- void regStats() override;
-
Port &getPort(const std::string &if_name,
PortID idx = InvalidPortID) override;
IdeDisk::IdeDisk(const Params &p)
: SimObject(p), ctrl(NULL), image(p.image), diskDelay(p.delay),
+ ideDiskStats(this),
dmaTransferEvent([this]{ doDmaTransfer(); }, name()),
dmaReadCG(NULL),
dmaReadWaitEvent([this]{ doDmaRead(); }, name()),
schedule(dmaReadWaitEvent, curTick() + totalDiskDelay);
}
-void
-IdeDisk::regStats()
+IdeDisk::
+IdeDiskStats::IdeDiskStats(Stats::Group *parent)
+ : Stats::Group(parent, "IdeDisk"),
+ ADD_STAT(dmaReadFullPages,
+ "Number of full page size DMA reads (not PRD)."),
+ ADD_STAT(dmaReadBytes,
+ "Number of bytes transfered via DMA reads (not PRD)."),
+ ADD_STAT(dmaReadTxs, "Number of DMA read transactions (not PRD)."),
+ ADD_STAT(dmaWriteFullPages, "Number of full page size DMA writes."),
+ ADD_STAT(dmaWriteBytes, "Number of bytes transfered via DMA writes."),
+ ADD_STAT(dmaWriteTxs, "Number of DMA write transactions.")
{
- SimObject::regStats();
-
- using namespace Stats;
- dmaReadFullPages
- .name(name() + ".dma_read_full_pages")
- .desc("Number of full page size DMA reads (not PRD).")
- ;
- dmaReadBytes
- .name(name() + ".dma_read_bytes")
- .desc("Number of bytes transfered via DMA reads (not PRD).")
- ;
- dmaReadTxs
- .name(name() + ".dma_read_txs")
- .desc("Number of DMA read transactions (not PRD).")
- ;
-
- dmaWriteFullPages
- .name(name() + ".dma_write_full_pages")
- .desc("Number of full page size DMA writes.")
- ;
- dmaWriteBytes
- .name(name() + ".dma_write_bytes")
- .desc("Number of bytes transfered via DMA writes.")
- ;
- dmaWriteTxs
- .name(name() + ".dma_write_txs")
- .desc("Number of DMA write transactions.")
- ;
}
void
assert(dmaReadCG->complete() < MAX_DMA_SIZE);
ctrl->dmaRead(pciToDma(dmaReadCG->addr()), dmaReadCG->size(),
&dmaReadWaitEvent, dataBuffer + dmaReadCG->complete());
- dmaReadBytes += dmaReadCG->size();
- dmaReadTxs++;
+ ideDiskStats.dmaReadBytes += dmaReadCG->size();
+ ideDiskStats.dmaReadTxs++;
if (dmaReadCG->size() == chunkBytes)
- dmaReadFullPages++;
+ ideDiskStats.dmaReadFullPages++;
dmaReadCG->next();
} else {
assert(dmaReadCG->done());
&dmaWriteWaitEvent, dataBuffer + dmaWriteCG->complete());
DPRINTF(IdeDisk, "doDmaWrite: not done curPrd byte count %d, eot %#x\n",
curPrd.getByteCount(), curPrd.getEOT());
- dmaWriteBytes += dmaWriteCG->size();
- dmaWriteTxs++;
+ ideDiskStats.dmaWriteBytes += dmaWriteCG->size();
+ ideDiskStats.dmaWriteTxs++;
if (dmaWriteCG->size() == chunkBytes)
- dmaWriteFullPages++;
+ ideDiskStats.dmaWriteFullPages++;
dmaWriteCG->next();
} else {
DPRINTF(IdeDisk, "doDmaWrite: done curPrd byte count %d, eot %#x\n",
/** DMA Aborted */
bool dmaAborted;
- Stats::Scalar dmaReadFullPages;
- Stats::Scalar dmaReadBytes;
- Stats::Scalar dmaReadTxs;
- Stats::Scalar dmaWriteFullPages;
- Stats::Scalar dmaWriteBytes;
- Stats::Scalar dmaWriteTxs;
+ struct IdeDiskStats : public Stats::Group
+ {
+ IdeDiskStats(Stats::Group *parent);
+
+ Stats::Scalar dmaReadFullPages;
+ Stats::Scalar dmaReadBytes;
+ Stats::Scalar dmaReadTxs;
+ Stats::Scalar dmaWriteFullPages;
+ Stats::Scalar dmaWriteBytes;
+ Stats::Scalar dmaWriteTxs;
+ } ideDiskStats;
public:
typedef IdeDiskParams Params;
*/
void reset(int id);
- /**
- * Register Statistics
- */
- void regStats() override;
-
/**
* Set the controller for this device
* @param c The IDE controller