From 4c675f63b03b0a4db2a37e35bebde5464d9c5f79 Mon Sep 17 00:00:00 2001 From: Mikael Olsson Date: Fri, 15 Dec 2023 17:25:53 +0100 Subject: Change to accumulate PMU values in message handler Currently the message_handler_openamp overwrites the PMU values in the response message each time operators are offloaded the NPU in an inference request. To instead get the total PMU values for all the times the NPU was used during the inference, the PMU values are now accumulated instead. Change-Id: I7fb8697e441b362f2f6da8a26536ba51d17c6b4c Signed-off-by: Mikael Olsson --- applications/message_handler_openamp/inference_runner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/message_handler_openamp/inference_runner.cpp b/applications/message_handler_openamp/inference_runner.cpp index c290773..b462b44 100644 --- a/applications/message_handler_openamp/inference_runner.cpp +++ b/applications/message_handler_openamp/inference_runner.cpp @@ -191,8 +191,8 @@ void ethosu_inference_end(ethosu_driver *drv, void *userArg) { // Get cycle counter if (response.pmu_cycle_counter_enable) { - uint64_t cycleCount = ETHOSU_PMU_Get_CCNTR(drv); - response.pmu_cycle_counter_count = cycleCount; + uint64_t cycleCount = ETHOSU_PMU_Get_CCNTR(drv); + response.pmu_cycle_counter_count += cycleCount; ethosu_profiler_add_to_pmu_cycles(&context->profiler_context, cycleCount); } @@ -202,8 +202,8 @@ void ethosu_inference_end(ethosu_driver *drv, void *userArg) { // Get event counters int i; for (i = 0; i < numEvents; i++) { - uint32_t eventValue = ETHOSU_PMU_Get_EVCNTR(drv, i); - response.pmu_event_count[i] = eventValue; + uint32_t eventValue = ETHOSU_PMU_Get_EVCNTR(drv, i); + response.pmu_event_count[i] += eventValue; ethosu_profiler_add_to_pmu_event(&context->profiler_context, i, eventValue); } -- cgit v1.2.1