summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Dreslinski <rdreslin@umich.edu>2006-03-29 14:27:10 -0500
committerRon Dreslinski <rdreslin@umich.edu>2006-03-29 14:27:10 -0500
commite881f8ce2a68dcd13ad74c96efd58e6b2246d8a8 (patch)
tree9c0de78a3697942d07f02e70bbea3616e2ee76be
parent9e39454f5805a1a26344c9861f679816375e2955 (diff)
downloadgem5-e881f8ce2a68dcd13ad74c96efd58e6b2246d8a8.tar.xz
Add some basic statistics to the disk model
--HG-- extra : convert_revision : 0f3a45745b0122de64a2f434604a474df04f2938
-rw-r--r--dev/ide_disk.cc50
-rw-r--r--dev/ide_disk.hh14
2 files changed, 64 insertions, 0 deletions
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
@@ -378,6 +378,37 @@ IdeDisk::dmaPrdReadDone()
}
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()
{
/** @todo we need to figure out what the delay actually will be */
@@ -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.
@@ -260,6 +268,12 @@ class IdeDisk : public SimObject
void reset(int id);
/**
+ * Register statistics.
+ */
+ void regStats();
+
+
+ /**
* Set the controller for this device
* @param c The IDE controller
*/