Add some basic statistics to the disk model

--HG--
extra : convert_revision : 0f3a45745b0122de64a2f434604a474df04f2938
This commit is contained in:
Ron Dreslinski 2006-03-29 14:27:10 -05:00
parent 9e39454f58
commit e881f8ce2a
2 changed files with 64 additions and 0 deletions

View file

@ -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);

View file

@ -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