From 54b9d49ec79b8c93ce914d4c3600661363e829d5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 13 Oct 2019 23:56:30 -0700 Subject: [PATCH] fastmodel: Implement getCurrentInstCount. 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 Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/arch/arm/fastmodel/iris/thread_context.cc | 9 +++++++++ src/arch/arm/fastmodel/iris/thread_context.hh | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/arch/arm/fastmodel/iris/thread_context.cc b/src/arch/arm/fastmodel/iris/thread_context.cc index 79c9062cb..43be17142 100644 --- a/src/arch/arm/fastmodel/iris/thread_context.cc +++ b/src/arch/arm/fastmodel/iris/thread_context.cc @@ -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 { diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh b/src/arch/arm/fastmodel/iris/thread_context.hh index c07c642fb..da9666161 100644 --- a/src/arch/arm/fastmodel/iris/thread_context.hh +++ b/src/arch/arm/fastmodel/iris/thread_context.hh @@ -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() -- 2.30.2