aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMåns Nilsson <mans.nilsson@arm.com>2020-11-05 12:19:34 +0100
committerMåns Nilsson <mans.nilsson@arm.com>2020-11-09 17:11:24 +0100
commit231e1d9cddeb5ad9036b89facb80860dd2d98441 (patch)
treef6d3bb7ae28fcc3be387e34bc5b4ddc6b33ab781
parent1aa56dd14d9b1979e02f566b7f59ddfaccf62f5f (diff)
downloadethos-u-core-software-20.11-rc1.tar.gz
Fix profiling problem with no PMU counters20.11-rc1
Change-Id: Ie981df16056ea0b72ed60f07bba9f39a7cb9a23f
-rw-r--r--applications/inference_process/src/inference_process.cc9
1 files changed, 9 insertions, 0 deletions
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<char *>(input.data), static_cast<char *>(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) {