summaryrefslogtreecommitdiff
path: root/src/cpu/testers
diff options
context:
space:
mode:
authorTiago Muck <tiago.muck@arm.com>2019-01-29 14:25:22 -0600
committerTiago Mück <tiago.muck@arm.com>2019-06-11 18:43:23 +0000
commitb871f124c410a82b944e3db58f6b9ded5c77f432 (patch)
tree7abd469d9e2382165ef1676011d9ad378c7d403d /src/cpu/testers
parent8be59c268c548cc3098fed05395075b3c8a92e8c (diff)
downloadgem5-b871f124c410a82b944e3db58f6b9ded5c77f432.tar.xz
cpu: Additional TrafficGen stats
Additional stats to keep track of read/write latencies and throughput. Change-Id: I7684cd33cf68fffdef4ca9c3a6db360a0f531c18 Signed-off-by: Tiago Muck <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18418 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/cpu/testers')
-rw-r--r--src/cpu/testers/traffic_gen/base.cc55
-rw-r--r--src/cpu/testers/traffic_gen/base.hh30
2 files changed, 85 insertions, 0 deletions
diff --git a/src/cpu/testers/traffic_gen/base.cc b/src/cpu/testers/traffic_gen/base.cc
index f2385a49c..154b1bded 100644
--- a/src/cpu/testers/traffic_gen/base.cc
+++ b/src/cpu/testers/traffic_gen/base.cc
@@ -354,6 +354,51 @@ BaseTrafficGen::regStats()
retryTicks
.name(name() + ".retryTicks")
.desc("Time spent waiting due to back-pressure (ticks)");
+
+ bytesRead
+ .name(name() + ".bytesRead")
+ .desc("Number of bytes read");
+
+ bytesWritten
+ .name(name() + ".bytesWritten")
+ .desc("Number of bytes written");
+
+ totalReadLatency
+ .name(name() + ".totalReadLatency")
+ .desc("Total latency of read requests");
+
+ totalWriteLatency
+ .name(name() + ".totalWriteLatency")
+ .desc("Total latency of write requests");
+
+ totalReads
+ .name(name() + ".totalReads")
+ .desc("Total num of reads");
+
+ totalWrites
+ .name(name() + ".totalWrites")
+ .desc("Total num of writes");
+
+ avgReadLatency
+ .name(name() + ".avgReadLatency")
+ .desc("Avg latency of read requests");
+ avgReadLatency = totalReadLatency / totalReads;
+
+ avgWriteLatency
+ .name(name() + ".avgWriteLatency")
+ .desc("Avg latency of write requests");
+ avgWriteLatency = totalWriteLatency / totalWrites;
+
+ readBW
+ .name(name() + ".readBW")
+ .desc("Read bandwidth in bytes/s");
+ readBW = bytesRead / simSeconds;
+
+ writeBW
+ .name(name() + ".writeBW")
+ .desc("Write bandwidth in bytes/s");
+ writeBW = bytesWritten / simSeconds;
+
}
std::shared_ptr<BaseGen>
@@ -470,6 +515,16 @@ BaseTrafficGen::recvTimingResp(PacketPtr pkt)
assert(iter->second <= curTick());
+ if (pkt->isWrite()) {
+ ++totalWrites;
+ bytesWritten += pkt->req->getSize();
+ totalWriteLatency += curTick() - iter->second;
+ } else {
+ ++totalReads;
+ bytesRead += pkt->req->getSize();
+ totalReadLatency += curTick() - iter->second;
+ }
+
waitingResp.erase(iter);
delete pkt;
diff --git a/src/cpu/testers/traffic_gen/base.hh b/src/cpu/testers/traffic_gen/base.hh
index 5ffe508a7..985ab5d4c 100644
--- a/src/cpu/testers/traffic_gen/base.hh
+++ b/src/cpu/testers/traffic_gen/base.hh
@@ -206,6 +206,36 @@ class BaseTrafficGen : public ClockedObject
/** Reqs waiting for response **/
std::unordered_map<RequestPtr,Tick> waitingResp;
+ /** Count the number of bytes read. */
+ Stats::Scalar bytesRead;
+
+ /** Count the number of bytes written. */
+ Stats::Scalar bytesWritten;
+
+ /** Total num of ticks read reqs took to complete */
+ Stats::Scalar totalReadLatency;
+
+ /** Total num of ticks write reqs took to complete */
+ Stats::Scalar totalWriteLatency;
+
+ /** Count the number reads. */
+ Stats::Scalar totalReads;
+
+ /** Count the number writes. */
+ Stats::Scalar totalWrites;
+
+ /** Avg num of ticks each read req took to complete */
+ Stats::Formula avgReadLatency;
+
+ /** Avg num of ticks each write reqs took to complete */
+ Stats::Formula avgWriteLatency;
+
+ /** Read bandwidth in bytes/s */
+ Stats::Formula readBW;
+
+ /** Write bandwidth in bytes/s */
+ Stats::Formula writeBW;
+
public:
BaseTrafficGen(const BaseTrafficGenParams* p);