fastmodel: Implement getCurrentInstCount.
authorGabe Black <gabeblack@google.com>
Mon, 14 Oct 2019 06:56:30 +0000 (23:56 -0700)
committerGabe Black <gabeblack@google.com>
Fri, 25 Oct 2019 22:42:31 +0000 (22:42 +0000)
This uses the step counter the iris API provides.

Change-Id: Ic916888fa256d0aa65042d3e6695d9bf4ba32c86
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22111
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/arch/arm/fastmodel/iris/thread_context.cc
src/arch/arm/fastmodel/iris/thread_context.hh

index 79c9062cb45c39cb7770aab5e43f8171c18863ca..43be1714211e60a1f542194f4530224773852764 100644 (file)
@@ -163,6 +163,15 @@ ThreadContext::~ThreadContext()
     client.unregisterEventCallback("ec_IRIS_INSTANCE_REGISTRY_CHANGED");
 }
 
+Tick
+ThreadContext::getCurrentInstCount()
+{
+    uint64_t count;
+    auto ret = call().step_getStepCounterValue(_instId, count, "instruction");
+    panic_if(ret != iris::E_ok, "Failed to get instruction count.");
+    return count;
+}
+
 ThreadContext::Status
 ThreadContext::status() const
 {
index c07c642fbd6ee7f25057f84e6abd0c4a23166dbd..da96661617d90412bb4b020ff140788725ddd1e7 100644 (file)
@@ -100,7 +100,7 @@ class ThreadContext : public ::ThreadContext
     void serviceInstCountEvents(Tick count) override {}
     void scheduleInstCountEvent(Event *event, Tick count) override {}
     void descheduleInstCountEvent(Event *event) override {}
-    Tick getCurrentInstCount() override { return 0; }
+    Tick getCurrentInstCount() override;
 
     virtual Counter
     totalInsts()