The invention discloses a method for measuring
interruption duration of an
embedded system with high precision, and relates to the technical field of computers. Comprising the following steps: S1, specifying an interrupt exception type corresponding to an exception vector number; s2, when the interrupt exception occurs, the
system jumps to a general exception entry function of the
system; s3, the general exception entry function judges exception types through exception type numerical values; s4, calling an interrupt vector
processing macro function in the interrupt entry function; s5, at the inlet of the interrupt vector
processing macro function, firstly executing the interrupt duration measurement starting
macro function to obtain an input interrupt
timestamp, then calling and executing the interrupt
processing function to obtain an output interrupt
timestamp, and finally executing the interrupt duration measurement ending timing and data statistics function macro function at the outlet of the interrupt vector processing macro function; and S6, after the interrupt processing is completed, returning to a
system state. According to the non-invasive performance
analysis method, hardware resources can be fully utilized and the debugging efficiency can be improved on the premise of not modifying a program function flow.