From e881f8ce2a68dcd13ad74c96efd58e6b2246d8a8 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Wed, 29 Mar 2006 14:27:10 -0500 Subject: [PATCH] Add some basic statistics to the disk model --HG-- extra : convert_revision : 0f3a45745b0122de64a2f434604a474df04f2938 --- dev/ide_disk.cc | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ dev/ide_disk.hh | 14 ++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/dev/ide_disk.cc b/dev/ide_disk.cc index 41400c590..c13556ed6 100644 --- a/dev/ide_disk.cc +++ b/dev/ide_disk.cc @@ -377,6 +377,37 @@ IdeDisk::dmaPrdReadDone() doDmaWrite(); } +void +IdeDisk::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 IdeDisk::doDmaRead() { @@ -399,6 +430,10 @@ IdeDisk::doDmaRead() dmaInterfaceBytes = bytesInPage; + if (bytesInPage == TheISA::VMPageSize) + dmaReadFullPages++; + dmaReadBytes += bytesInPage; + dmaReadTxs++; dmaInterface->doDMA(Read, dmaAddr, bytesInPage, curTick + totalDiskDelay, &dmaReadEvent); } else { @@ -430,6 +465,11 @@ IdeDisk::dmaReadDone() bytesInPage = bytesInDmaPage(curAddr, bytesLeft); dmaInterfaceBytes += bytesInPage; + if (bytesInPage == TheISA::VMPageSize) + dmaReadFullPages++; + dmaReadBytes += bytesInPage; + dmaReadTxs++; + dmaInterface->doDMA(Read, dmaAddr, bytesInPage, curTick, &dmaReadEvent); @@ -504,6 +544,11 @@ IdeDisk::doDmaWrite() dmaInterfaceBytes = bytesInPage; + if (bytesInPage == TheISA::VMPageSize) + dmaWriteFullPages++; + dmaWriteBytes += bytesInPage; + dmaWriteTxs++; + dmaInterface->doDMA(WriteInvalidate, dmaAddr, bytesInPage, curTick + totalDiskDelay, &dmaWriteEvent); @@ -535,6 +580,11 @@ IdeDisk::dmaWriteDone() bytesInPage = bytesInDmaPage(curAddr, bytesLeft); dmaInterfaceBytes += bytesInPage; + if (bytesInPage == TheISA::VMPageSize) + dmaWriteFullPages++; + dmaWriteBytes += bytesInPage; + dmaWriteTxs++; + dmaInterface->doDMA(WriteInvalidate, dmaAddr, bytesInPage, curTick, &dmaWriteEvent); diff --git a/dev/ide_disk.hh b/dev/ide_disk.hh index a656ca464..f743e7a45 100644 --- a/dev/ide_disk.hh +++ b/dev/ide_disk.hh @@ -33,6 +33,7 @@ #ifndef __IDE_DISK_HH__ #define __IDE_DISK_HH__ +#include "base/statistics.hh" #include "dev/disk_image.hh" #include "dev/ide_atareg.h" #include "dev/ide_ctrl.hh" @@ -237,6 +238,13 @@ class IdeDisk : public SimObject /** Interrupt pending */ bool intrPending; + Stats::Scalar<> dmaReadFullPages; + Stats::Scalar<> dmaReadBytes; + Stats::Scalar<> dmaReadTxs; + Stats::Scalar<> dmaWriteFullPages; + Stats::Scalar<> dmaWriteBytes; + Stats::Scalar<> dmaWriteTxs; + public: /** * Create and initialize this Disk. @@ -259,6 +267,12 @@ class IdeDisk : public SimObject */ void reset(int id); + /** + * Register statistics. + */ + void regStats(); + + /** * Set the controller for this device * @param c The IDE controller -- 2.30.2