Negative timing measured for model performance


After I integrated the inference as given in the mbed standalone project, I am getting the timing performance in negative timing as follows.

Predictions (DSP: 17 ms., Classification: 1 ms., Anomaly: -41 ms.): 

I used the following snippet

printf("\r\nPredictions (DSP: %d ms., Classification: %d ms., Anomaly: %d ms.): \n",
        result.timing.dsp, result.timing.classification, result.timing.anomaly);

@janjongboom Please advise.

@paulphilip How are you declaring your ei_impulse_result_t structure? Are you missing { 0 }? In that case you will be reading uninitialized memory.

    ei_impulse_result_t result = { 0 };

@janjongboom I have declared

ei_impulse_result_t result = { 0 }; 

as given in the mbed example.

@paulphilip, that’s quite random then. Do you have an anomaly block in your impulse?

@janjongboom Yes I have an anomaly block in my impulse. I started seeing this only after I build the block with anomaly block.

@paulphilip, Which target and Mbed OS version? Mbed OS 5.15 on the ST IoT Discovery Kit seems to work nicely. The code is also very straightforward, it just wraps around us_ticker_read() calls.

@janjongboom The Mbed version is

- mbed-os (#e642a7d8b360, tag: mbed-os-5.15.1)

and I am using NUCLEO_WB55 for my testing.
Please advise.