How long the piece of code is executed?
Hello, Does anyone know how long piece of code is executed? Today I will teach you how to check it. To measure time there are needed two timestamps t1 and t2. Timestamp t1 describes time when the measurment is started, t2 when the measurment is finished. For this puprpose one gpio will be used. Speaking more precisely: t1 is when the rising edge occured t2 is when the falling edged occured Time of execution doSomething2 function equal is t2 - t1. It is showed at the picture below: Time will be measured by logic analyzer like this: This is one of the cheapest logic analyzer, but for this purpose is excellent. The oscilloscope can be used also. What will happen if the interrupt occurred during measurement? An interrupt breaks the execution of instructions and diverts its execution to interrupt service ...