From 231e1d9cddeb5ad9036b89facb80860dd2d98441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Nilsson?= Date: Thu, 5 Nov 2020 12:19:34 +0100 Subject: Fix profiling problem with no PMU counters Change-Id: Ie981df16056ea0b72ed60f07bba9f39a7cb9a23f --- applications/inference_process/src/inference_process.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/applications/inference_process/src/inference_process.cc b/applications/inference_process/src/inference_process.cc index 759617a..7743f8c 100644 --- a/applications/inference_process/src/inference_process.cc +++ b/applications/inference_process/src/inference_process.cc @@ -17,6 +17,7 @@ */ #include "tensorflow/lite/micro/all_ops_resolver.h" +#include "tensorflow/lite/micro/cortex_m_generic/debug_log_callback.h" #include "tensorflow/lite/micro/micro_error_reporter.h" #include "tensorflow/lite/micro/micro_interpreter.h" #include "tensorflow/lite/schema/schema_generated.h" @@ -37,6 +38,11 @@ using namespace std; __attribute__((section(".bss.NoInit"), aligned(16))) uint8_t inferenceProcessTensorArena[TENSOR_ARENA_SIZE]; namespace { + +void tflu_debug_log(const char *s) { + fprintf(stderr, "%s", s); +} + void print_output_data(TfLiteTensor *output, size_t bytesToPrint) { const int numBytesToPrint = min(output->bytes, bytesToPrint); @@ -190,6 +196,9 @@ bool InferenceProcess::runJob(InferenceJob &job) { copy(static_cast(input.data), static_cast(input.data) + input.size, tensor->data.uint8); } + // Register debug log callback for profiling + RegisterDebugLogCallback(tflu_debug_log); + // Run the inference TfLiteStatus invoke_status = interpreter.Invoke(); if (invoke_status != kTfLiteOk) { -- cgit v1.2.1