Tuesday, December 9, 2014

Measure Real Time with TRACE32 (Lauterbach Debugger)

Measuring Real Time for a microcontroller using a Lauterbach Debugger and TRACE32 Software is very easy.
In the following image example, The execution time of the function UpdateCGI is measured:

  1. Put a breakpoint in the line of its call and another one at the line just after it.
  2. Open the RunTime tool from the Misc menu.
  3. Run the code, the debugger will stop at the first breakpoint.
  4. Then run again, so that it stops at the second breakpoint.
  5. Read the execution time from the RunTime window (laststart time).

Note:
This is assuming that, between the two breakpoints, no other code from another task is executed.
So, to guarantee the accuracy of your results,
it's preferred to either put the code you want to measure (code inside UpdateCGI in the above example) into a critical section or
grammatically stop the hardware timer at the start of that code and resume it again at the end of the code.

16 comments:

Anonymous said...

Thank you !

Sokkaree said...
This comment has been removed by the author.
Sokkaree said...

Thanks

Hesham Eraqi said...

You are welcome :-)

Hesham Eraqi said...

You are welcome :-)

Unknown said...

Give me different results for differentts run on the same function , why ?

Hesham Eraqi said...

Because in each run, different code is executed for the same function because of conditional checks (if conditions, conditional looping on some variable that change its value each run, ...).

Unknown said...

Thanks please can you tell me how to measure elapsed time from the first function call and the second call of the same function : i mean time spent before the function is being called again ?
Thanks a lot

Hesham Eraqi said...

Just put a single breakpoints at the start of that function, run, the debugger will hit the breakpoint, run again, the debugger will hit the breakpoint again, and then read "laststart time". It's the time you need.

Mostafa Taher said...
This comment has been removed by the author.
Mostafa Taher said...

Simple, To the point !

Thanks :)

Reda said...

Thank you

Anonymous said...

Thank you very much!

Anonymous said...

Thank you kind sir :)

Satheeshkumar said...

Can we able to do the same from cmm script?

Anonymous said...

Thank you. but please help clarify is the "laststart" the overall time spend btw breakpoint A and B? I'm trying to find documentation but couldn't if you have any reference please share it.