Stats updates.
authorKevin Lim <ktlim@umich.edu>
Thu, 24 Aug 2006 21:51:35 +0000 (17:51 -0400)
committerKevin Lim <ktlim@umich.edu>
Thu, 24 Aug 2006 21:51:35 +0000 (17:51 -0400)
dev/ide_disk.cc:
dev/ide_disk.hh:
    Add in stats.
sim/stat_control.cc:
sim/stat_control.hh:
    Allow setup event to be called with a specific queue.

--HG--
extra : convert_revision : 9310b132b70f967a198cb2e646433f3a5332671e

dev/ide_disk.cc
dev/ide_disk.hh
sim/stat_control.cc
sim/stat_control.hh

index c13556ed633568369b56dfa289dd781f30703e78..701d3bf7d6e86a98d84517f3861ca9caff98dee7 100644 (file)
@@ -406,6 +406,39 @@ IdeDisk::regStats()
         .name(name() + ".dma_write_txs")
         .desc("Number of DMA write transactions.")
         ;
+
+    rdBandwidth
+        .name(name() + ".rdBandwidth")
+        .desc("Read Bandwidth (bits/s)")
+        .precision(0)
+        .prereq(dmaReadBytes)
+        ;
+
+    wrBandwidth
+        .name(name() + ".wrBandwidth")
+        .desc("Write Bandwidth (bits/s)")
+        .precision(0)
+        .prereq(dmaWriteBytes)
+        ;
+
+    totBandwidth
+        .name(name() + ".totBandwidth")
+        .desc("Total Bandwidth (bits/s)")
+        .precision(0)
+        .prereq(totBytes)
+        ;
+
+    totBytes
+        .name(name() + ".totBytes")
+        .desc("Total Bytes")
+        .precision(0)
+        .prereq(totBytes)
+        ;
+
+    rdBandwidth = dmaReadBytes * Stats::constant(8) / simSeconds;
+    wrBandwidth = dmaWriteBytes * Stats::constant(8) / simSeconds;
+    totBandwidth = rdBandwidth + wrBandwidth;
+    totBytes = dmaReadBytes + dmaWriteBytes;
 }
 
 void
index 402ae44eeeb7e764b3437702d11acb9d5dca0ec1..91ea33f4ad34845400f8a8ee1fee4b6224c2f5b6 100644 (file)
@@ -244,6 +244,10 @@ class IdeDisk : public SimObject
     Stats::Scalar<> dmaWriteFullPages;
     Stats::Scalar<> dmaWriteBytes;
     Stats::Scalar<> dmaWriteTxs;
+    Stats::Formula rdBandwidth;
+    Stats::Formula wrBandwidth;
+    Stats::Formula totBandwidth;
+    Stats::Formula totBytes;
 
   public:
     /**
index e4394cfa3857a645c6d93439523ef2b31a2c0832..33b3ccdb6f90659c7defedac043025dc4019f126 100644 (file)
@@ -158,13 +158,13 @@ class StatEvent : public Event
     Tick repeat;
 
   public:
-    StatEvent(int _flags, Tick _when, Tick _repeat);
+    StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat);
     virtual void process();
     virtual const char *description();
 };
 
-StatEvent::StatEvent(int _flags, Tick _when, Tick _repeat)
-    : Event(&mainEventQueue, Stat_Event_Pri),
+StatEvent::StatEvent(EventQueue *queue, int _flags, Tick _when, Tick _repeat)
+    : Event(queue, Stat_Event_Pri),
       flags(_flags), repeat(_repeat)
 {
     setFlags(AutoDelete);
@@ -214,9 +214,12 @@ DumpNow()
 }
 
 void
-SetupEvent(int flags, Tick when, Tick repeat)
+SetupEvent(int flags, Tick when, Tick repeat, EventQueue *queue)
 {
-    new StatEvent(flags, when, repeat);
+    if (queue == NULL)
+        queue = &mainEventQueue;
+
+    new StatEvent(queue, flags, when, repeat);
 }
 
 /* namespace Stats */ }
index a22ce76af9fbd915d9d09f02dc5bff7078247d67..806c4be6b8549d53c30aa19c719da283790db5a2 100644 (file)
@@ -32,6 +32,8 @@
 #include <fstream>
 #include <list>
 
+class EventQueue;
+
 namespace Stats {
 
 enum {
@@ -43,7 +45,7 @@ class Output;
 extern std::list<Output *> OutputList;
 
 void DumpNow();
-void SetupEvent(int flags, Tick when, Tick repeat = 0);
+void SetupEvent(int flags, Tick when, Tick repeat = 0, EventQueue *queue = NULL);
 
 void InitSimStats();