diff options
-rw-r--r-- | applications/baremetal/main.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/applications/baremetal/main.cpp b/applications/baremetal/main.cpp index 6ed7cbe..d27e4a4 100644 --- a/applications/baremetal/main.cpp +++ b/applications/baremetal/main.cpp @@ -78,7 +78,7 @@ std::vector<ethosu_pmu_event_type> pmuEventConfig{ethosu_pmu_event_type(ETHOSU_P ethosu_pmu_event_type(ETHOSU_PMU_EVENT_2), ethosu_pmu_event_type(ETHOSU_PMU_EVENT_3)}; -const uint32_t delayMs = SystemCoreClock / 1000ul; +const uint32_t delay = 250ul; struct ethosu_driver *ethosuDrv; EthosUMonitor ethosuMonitor(EthosUMonitor::Backend::EVENT_RECORDER); } // namespace @@ -86,15 +86,19 @@ EthosUMonitor ethosuMonitor(EthosUMonitor::Backend::EVENT_RECORDER); extern "C" { void SysTick_Handler(void) { + // Disable systick, preventing new systick interrupt to fire while we call the Ethos-U monitor + SysTick->CTRL = 0; + ethosuMonitor.monitorSample(ethosuDrv); + + // Restart the systick timer + SysTick_Config(delay); } void ethosu_inference_begin(struct ethosu_driver *drv, void *) { ethosuDrv = drv; ethosuMonitor.configure(drv, pmuEventConfig); - - // Enable polling - SysTick_Config(delayMs); + SysTick_Config(delay); } void ethosu_inference_end(struct ethosu_driver *drv, void *) { @@ -121,6 +125,7 @@ int runInference() { bool failed = inferenceProcess.runJob(job); printf("Status of executed job: "); printf(failed ? "Failed\n" : "Success\n"); + printf("Performance monitor merge count %zu\n", ethosuMonitor.getMergeCount()); return failed; } |