Interrupt Latency Calculator
Calculate interrupt latency from CPU frequency and execution-cycle delays. Estimate hardware exception-entry time, interrupt-disabled blocking, higher-priority ISR delay, software dispatch overhead, total response time and practical interrupt-rate limits.
Total latency cycles = current-instruction delay + critical-section blocking + higher-priority ISR blocking + hardware entry + software dispatch + ISR prologue.
This models time until the ISR reaches its useful work. CPU architecture,
memory wait states, cache behavior, bus contention and interrupt-controller
details can add further variation.
—
What Is Interrupt Latency?
Interrupt latency is the delay between an interrupt event becoming eligible for service and the processor reaching the code that responds to that event. It is an important timing parameter in real-time and embedded systems.
Latency can include processor exception-entry overhead, completion of the current instruction, temporarily disabled interrupts, higher-priority interrupts and software dispatch overhead.
Interrupt Latency Formula
Total Latency Cycles =
Current Instruction Delay
+ Critical-Section Blocking
+ Higher-Priority ISR Blocking
+ Hardware Interrupt Entry
+ Software Dispatch
+ ISR PrologueThe corresponding time is found by dividing the total number of cycles by the CPU clock frequency.
Convert CPU Cycles to Time
Cycle Time = 1 / CPU Frequency
Time =
Cycles / CPU FrequencyFor a 120 MHz processor, one ideal CPU cycle is approximately 8.333 nanoseconds.
120 MHz Example
CPU:
120 MHz
Current instruction:
3 cycles
Hardware interrupt entry:
12 cycles
Software dispatch:
8 cycles
ISR prologue:
10 cycles
No additional blocking
Latency cycles:
3 + 12 + 8 + 10
= 33 cycles
Latency:
33 / 120,000,000
= 275 nsCurrent Instruction Completion
An interrupt may arrive while the processor is already executing another instruction. Depending on the architecture and instruction, the processor may have to complete or reach an interruptible boundary before exception handling starts.
For deterministic analysis, use the worst-case relevant instruction delay rather than only the average instruction duration.
Critical Sections and Disabled Interrupts
Software can temporarily mask interrupts while manipulating shared data or performing timing-sensitive operations. An interrupt arriving during such a section cannot be serviced until the blocking interval ends.
Critical section:
500 cycles
CPU:
100 MHz
Blocking time:
500 / 100,000,000
= 5 µsA long critical section can therefore dominate interrupt latency even when the processor’s native hardware interrupt-entry time is very short.
Higher-Priority Interrupt Blocking
In a prioritized interrupt system, a higher-priority ISR can run before the target interrupt. The target ISR’s response can therefore be delayed by the execution of higher-priority interrupt work.
Worst-case real-time analysis can require accounting for more than one higher-priority interrupt arrival, depending on the scheduling and interrupt model.
Hardware Interrupt Entry Cycles
Hardware interrupt entry commonly includes interrupt recognition, state saving, vector lookup and pipeline changes. The exact cycle count is processor-specific.
Do not assume that one architectural headline latency number applies under all conditions. Flash wait states, memory placement, stacking behavior and bus activity can alter actual measurements.
ISR Prologue Overhead
After the CPU reaches the interrupt vector, compiler-generated code may save additional registers or create a stack frame before the first useful application instruction executes.
Hardware entry:
12 cycles
Compiler prologue:
10 cycles
Actual application work begins after:
22 cycles
before considering other blocking.Software Interrupt Dispatch
Some systems enter a generic interrupt handler before branching to a device-specific function. RTOS interrupt wrappers, vector trampolines and software dispatch tables can therefore add extra latency.
Enter those cycles in the Software Dispatch field when modeling such a system.
ISR Execution Time
Interrupt latency and ISR execution time are related but different. Latency describes how long the system waits before useful interrupt servicing starts, while execution time describes how long the ISR itself occupies the processor.
ISR execution cycles =
Prologue
+ Useful ISR Work
+ EpilogueFull Interrupt Occupancy
For a simplified single-interrupt event, full processor occupancy can include the latency path plus the useful ISR work and return overhead.
Full IRQ Occupancy =
Instruction Delay
+ Blocking
+ Hardware Entry
+ Software Dispatch
+ Prologue
+ Useful Work
+ EpilogueThis is useful when estimating how frequently an ISR could run before consuming excessive CPU time.
Maximum Interrupt Rate
A purely theoretical rate can be estimated by assuming the processor does nothing except execute the modeled ISR path:
Theoretical Maximum Rate =
1
-------------------
Full ISR OccupancyReal applications should operate well below this limit because foreground software, other interrupts, RTOS activity and timing margin also consume CPU.
Interrupt CPU Budget
The calculator also estimates an interrupt frequency corresponding to the selected percentage of CPU time.
Budgeted IRQ Rate =
CPU Budget Fraction
-------------------
ISR Execution TimeFor example, allowing an ISR to consume no more than 20% of CPU time produces a much lower frequency limit than assuming 100% CPU occupancy.
Interrupt CPU Load Formula
CPU Load =
ISR Rate × ISR Time × 100%If a complete ISR execution occupies 5 µs and runs 1,000 times per second, the ISR consumes approximately 0.5% of one CPU.
Interrupt Latency vs Response Time
Interrupt latency normally ends when the ISR begins servicing the event. Application response time can be longer if useful work occurs later inside the ISR or is deferred to a task, thread, DMA completion or scheduler.
When the requirement specifies time until an actual device action occurs, include all processing between the interrupt event and that action.
Interrupt Jitter
Interrupt latency can vary from event to event. That variation is commonly described as latency jitter. Sources include different instruction boundaries, nested interrupts, cache state, memory wait states, DMA or bus contention and critical-section timing.
This calculator produces a deterministic value from the delays you enter. For worst-case analysis, enter worst-case rather than average cycle counts.
Interrupt Latency Measurement
A common practical measurement technique is to trigger an external event, toggle a GPIO near the start of the ISR and measure the delay with an oscilloscope or logic analyzer.
Measurement captures hardware and software effects that can be difficult to derive from nominal instruction-cycle counts alone.
DMA vs Interrupt Processing
DMA can reduce the number of interrupts required for high-rate data transfer by moving blocks of data without processor intervention for every individual item.
The CPU can then service completion or threshold events instead of responding to every byte, sample or peripheral transaction.
Interrupt Latency Calculator FAQs
How do I calculate interrupt latency from CPU cycles?
What is the cycle time of a 100 MHz CPU?
What is the cycle time of a 120 MHz CPU?
Does interrupt latency include ISR execution time?
Do disabled interrupts increase latency?
Can another ISR increase latency?
Why can measured interrupt latency vary?
How can I measure interrupt latency?
What is interrupt jitter?
Can this calculator model an RTOS interrupt wrapper?
Calculate MCU Interrupt Latency and ISR Response
Convert processor cycles into interrupt delay, ISR execution time, total CPU occupancy and practical interrupt-rate estimates for embedded and real-time systems.