I have been developing control software and I need to know how much time it takes to execute an interrupt service routine (ISR).
I have decided to use a dedicated GPIO pin of my microcontroller and an oscilloscope for that purpose. I set the pin to high at the beginning of the ISR execution and then reset it to low at the end of the ISR. I have configured my oscilloscope in such a manner that the trace record is triggered by the rising edge of the specified channel.
My idea was that, in case I measure the pulse duration via the oscilloscope, I will have the actual execution time of the ISR. This method works but I have found that the execution time fluctuates due to the internal logic in the ISR.
I would like to measure the worst case execution time but I am not sure how to set the trigger on my oscilloscope to be able to record the longest pulse. How can I do that?