Explaining the concept of "execution time"
The execution time of a piece of code (say an RTOS task) is the amount of time that the processor spends executing that code.
Execution time must exclude any time spent doing "other things" such as handling interrupts and, in the case of RTOS-based systems, executing other tasks.
The concept is different to elapsed or "wall clock time". This measures how long the task takes from beginning to end, ignoring internal issues like context switches and interrupts. Yet another name for elapsed time is "response time".
It's much easier to measure elapsed time: you simply record the difference between the start time and the end time of the task.
Effective execution time measurement relies on the accurate exclusion of time ''not spent'' executing the task. How we do this exactly depends on:
- how the execution time is measured
- the architecture of the processor, and how interrupts are handled by it
- what RTOS is used (if any), and how context switches work
- rapita's blog
- Log in or register to post comments

Comments
Start and End
One of the challenging things of course is determining what the start and end times mean.
For "one-shot" tasks, it's a bit clearer, but where there is an infinite loop with more than one blocking calls (is increasingly the case) we need to be quite careful what the "start" and "end" are.