Hi Walter,
I'm using the Segger SystemViewer (see https://mcuoneclipse.com/2015/11/16/segger-systemview-realtime-analysis-and-visualization-for-freert... ) for this kind of measurement. With
SEGGER_SYSVIEW_OnUserStart(id)
I can start a measurement point, and with
SEGGER_SYSVIEW_OnUserStop(id)
I have the corresponding end point. You can have multiple different IDs so you can measure different spans. Using the SystemViewer I get the exact timing. I hope you are using a Cortex-M4(F) core, then you get the number of cycles. Otherwise on an a M0+ (because it does not have a cycle counter in hardware) the timing is measured with the SysTick ticks.
I hope this helps,
Erich