From 955288a1b08bbfb0ea5fc0c5994b1a3a6ff8506e Mon Sep 17 00:00:00 2001 From: Jens Elofsson Date: Thu, 22 Apr 2021 20:57:15 +0200 Subject: Add EthosuProfiler to perform layer-by-layer profiling on Ethos-U. Change-Id: Idae34fd8ab6b17b0bc21db658fff135a5ddf5461 --- applications/inference_process/src/inference_process.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'applications/inference_process/src') diff --git a/applications/inference_process/src/inference_process.cpp b/applications/inference_process/src/inference_process.cpp index 743ed64..fa38290 100644 --- a/applications/inference_process/src/inference_process.cpp +++ b/applications/inference_process/src/inference_process.cpp @@ -24,6 +24,11 @@ #include "tensorflow/lite/schema/schema_generated.h" #include "tensorflow/lite/version.h" +#include "arm_profiler.hpp" +#ifdef ETHOSU +#include "ethosu_profiler.hpp" +#endif + #include "inference_process.hpp" #include "cmsis_compiler.h" @@ -200,15 +205,15 @@ bool InferenceProcess::runJob(InferenceJob &job) { // Create the TFL micro interpreter tflite::AllOpsResolver resolver; - tflite::MicroProfiler profiler; - -#if defined(INFERENCE_PROC_TFLU_PROFILER) && defined(ETHOSU) +#ifdef ETHOSU vector pmu_events(ETHOSU_PMU_NCOUNTERS, ETHOSU_PMU_NO_EVENT); for (size_t i = 0; i < job.pmuEventConfig.size(); i++) { pmu_events[i] = ethosu_pmu_event_type(job.pmuEventConfig[i]); } - profiler.MonitorEthosuPMUEvents(pmu_events[0], pmu_events[1], pmu_events[2], pmu_events[3]); + tflite::EthosUProfiler profiler(pmu_events[0], pmu_events[1], pmu_events[2], pmu_events[3]); +#else + tflite::ArmProfiler profiler; #endif tflite::MicroInterpreter interpreter(model, resolver, tensorArena, tensorArenaSize, reporter, &profiler); -- cgit v1.2.1