[go: up one dir, main page]

CN106201802A - The CPU internal interrupt response time of logic-based analyser and the measuring method of recovery time - Google Patents

The CPU internal interrupt response time of logic-based analyser and the measuring method of recovery time Download PDF

Info

Publication number
CN106201802A
CN106201802A CN201610576805.XA CN201610576805A CN106201802A CN 106201802 A CN106201802 A CN 106201802A CN 201610576805 A CN201610576805 A CN 201610576805A CN 106201802 A CN106201802 A CN 106201802A
Authority
CN
China
Prior art keywords
interrupt
port
gpio1
cpu
level
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610576805.XA
Other languages
Chinese (zh)
Other versions
CN106201802B (en
Inventor
谢娟
胡豪东
羽加霙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuxi Dynamic Control Technology Co.,Ltd.
Original Assignee
AVIATION POWER CONTROL SYSTEM RESEARCH INSTITUTE OF AVIATION INDUSTRY Corp OF CHINA
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by AVIATION POWER CONTROL SYSTEM RESEARCH INSTITUTE OF AVIATION INDUSTRY Corp OF CHINA filed Critical AVIATION POWER CONTROL SYSTEM RESEARCH INSTITUTE OF AVIATION INDUSTRY Corp OF CHINA
Priority to CN201610576805.XA priority Critical patent/CN106201802B/en
Publication of CN106201802A publication Critical patent/CN106201802A/en
Application granted granted Critical
Publication of CN106201802B publication Critical patent/CN106201802B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/2236Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test CPU or processors
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2268Logging of test results
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明涉及一种基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,其包括如下步骤:S1、CPU通过GPIO1口、GPIO2口分别与逻辑分析仪匹配连接;步骤S2、在软件可触发中断触发前,翻转GPIO1口的电平;步骤S3、触发所选定的软件可触发中断,并连续N次翻转GPIO1口的电平信号;步骤S4、在上述软件可触发中断恢复后且GPIO1电平变化后,逻辑分析仪停止对GPIO1口、GPIO2口对应电平信号的采集,并对记录GPIO1口、GPIO2口对应的电平信号进行分析,以确定中断响应时间T1以及恢复时间T2。本发明操作方便,能实现对CPU内部中断响应时间以及恢复时间的精确测量,避免系统运行时间和时序分析的偏差。

The present invention relates to a kind of measurement method of interrupt response time and recovery time inside CPU based on logic analyzer, it comprises the following steps: S1, CPU is respectively matched and connected with logic analyzer through GPIO1 port, GPIO2 port; Step S2, in software can Before triggering the interrupt trigger, flip the level of the GPIO1 port; step S3, trigger the selected software to trigger the interrupt, and flip the level signal of the GPIO1 port N times continuously; step S4, after the above software can trigger the interrupt recovery and GPIO1 After the level changes, the logic analyzer stops collecting the level signals corresponding to GPIO1 and GPIO2, and analyzes and records the level signals corresponding to GPIO1 and GPIO2 to determine the interrupt response time T1 and recovery time T2. The invention is easy to operate, can realize the accurate measurement of the interrupt response time and recovery time inside the CPU, and avoids the deviation of the system running time and timing analysis.

Description

基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量 方法Measurement of Interrupt Response Time and Recovery Time of CPU Based on Logic Analyzer method

技术领域technical field

本发明涉及一种测量方法,尤其是一种基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法。The invention relates to a measurement method, in particular to a method for measuring interrupt response time and recovery time inside a CPU based on a logic analyzer.

背景技术Background technique

目前,国内的发动机控制软件,不管是采用多重中断框架的软件还是采用实时操作系统的软件,都避免不了使用CPU内部中断,例如CPU自带的定时器中断或者通过指令触发的其它软中断,而且这些内部中断通常扮演着重要的角色,比如实时调度的时钟节拍中断。At present, domestic engine control software, whether it is software using multiple interrupt frameworks or software using real-time operating systems, cannot avoid the use of CPU internal interrupts, such as timer interrupts that come with the CPU or other soft interrupts triggered by instructions, and These internal interrupts usually play important roles, such as tick interrupts for real-time scheduling.

中断响应时间和恢复时间是实时操作系统或者多重中断系统最重要的性能指标之一,中断响应时间是指中断请求产生到处理器(CPU)开始处理用户程序之间的时间,中断恢复时间是指处理器返回到被中断代码所需的时间。中断响应时间和恢复时间映着系统对于外部事件响应的速度,对于分析实时系统的实时性能具有重要意义,特别是对于中断切换频率的系统,这两个时间占用的系统运行时间越大。中断响应时间和恢复时间的精确测量,不仅为控制软件的前期架构设计提供了重要的参考依据,而且直接关系到保证后期控制器产品的性能。Interrupt response time and recovery time are one of the most important performance indicators of real-time operating systems or multiple interrupt systems. Interrupt response time refers to the time between when an interrupt request is generated and the processor (CPU) starts processing the user program. Interrupt recovery time refers to The time it takes the processor to return to the interrupted code. Interrupt response time and recovery time reflect the system's response speed to external events, which is of great significance for analyzing the real-time performance of real-time systems, especially for systems with interrupt switching frequency, the greater the system running time occupied by these two times. The accurate measurement of interrupt response time and recovery time not only provides an important reference for the early stage architecture design of the control software, but also is directly related to the performance of the later controller products.

国外的发动机控制软件的有限技术资料中虽然也有提到操作系统用到CPU内部中断,但未找到中断测量的具体的指导和实施方法。国内的发动机控制软件在此之前对于中断响应时间和恢复时间这两个性能一直缺乏足够的关注,也没有对它们的测量有着明确的指导方法,且对于CPU内部中断这两个指标的测量的难点在于中断请求事件和中断返回时刻点的捕获,不像外部中断有中断请求的硬件信号可以观察。其它行业有关程序运行时间的测量方法,是运用CPU自带定时器来进行测量,它对于普通顺序执行的时间测量能达到精确的效果,但对于内部中断这两个时间指标的测量,因为缺乏对测量点的捕获,会造成很大的精确度损失。Although the limited technical information of foreign engine control software also mentions that the operating system uses CPU internal interrupts, no specific guidance and implementation methods for interrupt measurement have been found. Domestic engine control software has not paid enough attention to the performance of interrupt response time and recovery time before, and there is no clear guidance method for their measurement, and the difficulty of measuring these two indicators of CPU internal interrupt It lies in the capture of interrupt request events and interrupt return time points, unlike external interrupts that have interrupt request hardware signals that can be observed. The measurement method of program running time in other industries is to use the built-in timer of the CPU to measure. It can achieve accurate results for the time measurement of ordinary sequence execution, but for the measurement of the two time indicators of internal interrupts, due to the lack of The capture of measurement points will cause a great loss of accuracy.

发明内容Contents of the invention

本发明的目的是克服现有技术中存在的不足,提供一种基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,其操作方便,能实现对CPU内部中断响应时间以及恢复时间的精确测量,减少系统运行时间和时序分析的偏差,安全可靠。The purpose of the present invention is to overcome the deficiencies in the prior art, to provide a kind of measurement method based on the interrupt response time and recovery time of the CPU inside the logic analyzer, which is easy to operate, and can realize the measurement of the interrupt response time and the recovery time inside the CPU. Accurate measurement, reducing the deviation of system running time and timing analysis, safe and reliable.

按照本发明提供的技术方案,一种基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,所述测量方法包括如下步骤:According to the technical scheme provided by the present invention, a kind of measuring method based on logic analyzer interrupt response time and recovery time inside CPU, described measuring method comprises the steps:

S1、选取CPU的两个GPIO口,并将所选取的两个GPIO口配置为通用输出接口且初始化为低电平输出,所述两个GPIO口分别标识为GPIO1口以及GPIO2口;CPU通过GPIO1口、GPIO2口分别与逻辑分析仪匹配连接,在GPIO1口的电平处于上升沿时,逻辑分析仪采集并保存GPIO1口、GPIO2口对应的电平信号;S1. Select two GPIO ports of the CPU, and configure the selected two GPIO ports as general-purpose output interfaces and initialize them as low-level outputs. The two GPIO ports are respectively marked as GPIO1 ports and GPIO2 ports; the CPU passes GPIO1 port and GPIO2 port are respectively matched and connected with the logic analyzer. When the level of the GPIO1 port is on the rising edge, the logic analyzer collects and saves the level signals corresponding to the GPIO1 port and GPIO2 port;

步骤S2、选定CPU的软件可触发中断,并在软件可触发中断触发前,翻转GPIO1口的电平,以使得逻辑分析仪对GPIO1口、GPIO2口对应的电平信号进行采集与保存;Step S2, the software of the selected CPU can trigger an interrupt, and before the software can trigger the interrupt, flip the level of the GPIO1 port, so that the logic analyzer can collect and save the level signals corresponding to the GPIO1 port and the GPIO2 port;

步骤S3、触发所选定的软件可触发中断,并连续N次翻转GPIO1口的电平信号,且在中断处理过程中进行插桩,以使得在响应的软中断处理函数开始位置翻转GPIO1口的电平,并在中断处理函数结束位置将GPIO2口的电平置高;Step S3, triggering the selected software to trigger an interrupt, and flipping the level signal of the GPIO1 port N times continuously, and inserting piles during the interrupt processing, so that the GPIO1 port is flipped at the beginning position of the corresponding soft interrupt processing function. Level, and set the level of GPIO2 port high at the end of the interrupt processing function;

步骤S4、在上述软件可触发中断恢复后且GPIO1电平变化后,逻辑分析仪停止对GPIO1口、GPIO2口对应电平信号的采集,并对记录GPIO1口、GPIO2口对应的电平信号进行分析,以确定中断响应时间T1以及恢复时间T2。Step S4, after the above-mentioned software can trigger the interrupt recovery and after the GPIO1 level changes, the logic analyzer stops collecting the level signals corresponding to the GPIO1 port and the GPIO2 port, and analyzes the level signals corresponding to the recorded GPIO1 port and the GPIO2 port , to determine the interrupt response time T1 and recovery time T2.

步骤S3中,在软件可触发中断触发后,连续N次翻转GPIO1口的电平信号时,(N-2)*相邻两侧翻转GPIO1口电平的间隔时间大于软件可触发中断的触发到CPU中止执行当前程序指令的时间,N大于等于3。In step S3, after the software triggerable interrupt is triggered, when the level signal of the GPIO1 port is continuously flipped N times, (N-2) * the interval time between flipping the level of the GPIO1 port on both adjacent sides is greater than the triggering time of the software triggerable interrupt The time when the CPU suspends executing the current program instruction, N is greater than or equal to 3.

步骤S2中,选定CPU的软件可触发中断后,屏蔽CPU的其余中断。In step S2, after the software of the selected CPU can trigger an interrupt, other interrupts of the CPU are shielded.

本发明的优点:将CPU的GPIO1口、GPIO2口与逻辑分析仪连接,通过逻辑分析仪采集并记录GPIO1口、GPIO2口对应的电平信号,通过GPIO1口、GPIO2口对应电平信号的翻转变化,能够测量得到CPU内部中断的中断响应时间以及中断恢复时间,操作方便,减少系统运行时间和时序分析的偏差,安全可靠。The advantages of the present invention: connect the GPIO1 port and GPIO2 port of the CPU with the logic analyzer, collect and record the level signals corresponding to the GPIO1 port and the GPIO2 port through the logic analyzer, and pass the flip change of the level signals corresponding to the GPIO1 port and the GPIO2 port , can measure the interrupt response time and interrupt recovery time of the CPU internal interrupt, easy to operate, reduce the deviation of system running time and timing analysis, safe and reliable.

附图说明Description of drawings

图1为本发明的流程图。Fig. 1 is a flowchart of the present invention.

图2为本发明逻辑分析仪采集GPIO1口、GPIO2口对应电平信号的示意图。Fig. 2 is a schematic diagram of the level signals corresponding to the GPIO1 port and the GPIO2 port collected by the logic analyzer of the present invention.

具体实施方式detailed description

下面结合具体附图和实施例对本发明作进一步说明。The present invention will be further described below in conjunction with specific drawings and embodiments.

如图1所示:能实现对CPU内部中断响应时间以及恢复时间的精确测量,避免系统运行时间和时序分析的偏差,本发明的测量方法包括如下步骤:As shown in Figure 1: can realize the accurate measurement to CPU internal interrupt response time and recovery time, avoid the deviation of system running time and sequence analysis, measuring method of the present invention comprises the following steps:

S1、选取CPU的两个GPIO口,并将所选取的两个GPIO口配置为通用输出接口且初始化为低电平输出,所述两个GPIO口分别标识为GPIO1口以及GPIO2口;CPU通过GPIO1口、GPIO2口分别与逻辑分析仪匹配连接,在GPIO1口的电平处于上升沿时,逻辑分析仪采集并保存GPIO1口、GPIO2口对应的电平信号;S1. Select two GPIO ports of the CPU, and configure the selected two GPIO ports as general-purpose output interfaces and initialize them as low-level outputs. The two GPIO ports are respectively marked as GPIO1 ports and GPIO2 ports; the CPU passes GPIO1 port and GPIO2 port are respectively matched and connected with the logic analyzer. When the level of the GPIO1 port is on the rising edge, the logic analyzer collects and saves the level signals corresponding to the GPIO1 port and GPIO2 port;

具体地,对于选取的CPU,选取两个GPIO口,并将所选取的GPIO口配置为通用输出接口,并将所述GPIO口初始化为低电平输出的具体过程为本技术领域人员所熟知,此处不再赘述。逻辑分析仪与CPU连接时,将CPU的GPIO1口、GPIO2口分别与逻辑分析仪的两个连接输入通道连接,逻辑分析仪的地线与CPU的地线连接,逻辑分析仪与CPU具体的连接配合为本技术领域人员所熟知,此处不再赘述。一般地,逻辑分析仪的具有较高的采样精度,逻辑分析仪的工作参数可以为主频100M,采样精度为2ns。由于GPIO1口、GPIO2口均被初始化为低电平输出,在逻辑分析仪与CPU连接后,当且仅当GPIO1口的电平处于上升沿时,逻辑分析仪才会采集及保存GPIO1口、GPIO2口对应的电平信号。Specifically, for the selected CPU, select two GPIO ports, and configure the selected GPIO port as a general-purpose output interface, and initialize the GPIO port as a specific process for low-level output is well known to those skilled in the art. I won't repeat them here. When the logic analyzer is connected to the CPU, connect the GPIO1 port and GPIO2 port of the CPU to the two connection input channels of the logic analyzer respectively, connect the ground wire of the logic analyzer to the ground wire of the CPU, and connect the specific connection between the logic analyzer and the CPU Coordination is well known to those skilled in the art and will not be repeated here. Generally, the logic analyzer has a high sampling precision, and the working parameters of the logic analyzer can be 100M main frequency and 2ns sampling precision. Since GPIO1 and GPIO2 are initialized as low-level output, after the logic analyzer is connected to the CPU, if and only when the level of GPIO1 is on the rising edge, the logic analyzer will collect and save the output of GPIO1 and GPIO2. The level signal corresponding to the port.

步骤S2、选定CPU的软件可触发中断,并在软件可触发中断触发前,翻转GPIO1口的电平,以使得逻辑分析仪对GPIO1口、GPIO2口对应的电平信号进行采集与保存;Step S2, the software of the selected CPU can trigger an interrupt, and before the software can trigger the interrupt, flip the level of the GPIO1 port, so that the logic analyzer can collect and save the level signals corresponding to the GPIO1 port and the GPIO2 port;

本发明实施例中,选取CPU内部的软件可触发中断,即在CPU上运行对应的软件,通过软件触发对应的内部中断,从而能够实现中断响应时间和恢复时间的测量。选定CPU的软件可触发中断后,屏蔽CPU的其余中断,以避免产生多中断抢占或嵌套的情况。由步骤1可知,由于GPIO1口初始化为低电平输出,因此,在翻转GPIO1口的电平后,使得GPIO1口具有上升沿,此时,逻辑分析仪能够实现对GPIO1口、GPIO2口对应电平信号的采集与存储。In the embodiment of the present invention, the software inside the CPU is selected to trigger the interrupt, that is, the corresponding software is run on the CPU, and the corresponding internal interrupt is triggered by the software, so that the measurement of the interrupt response time and recovery time can be realized. After the software of the selected CPU can trigger an interrupt, the remaining interrupts of the CPU can be shielded to avoid the situation of preempting or nesting multiple interrupts. It can be seen from step 1 that since the GPIO1 port is initialized as a low-level output, after flipping the level of the GPIO1 port, the GPIO1 port has a rising edge. At this time, the logic analyzer can realize the corresponding level of the GPIO1 port and GPIO2 port Signal collection and storage.

步骤S3、触发所选定的软件可触发中断,并连续N次翻转GPIO1口的电平信号,且在中断处理过程中进行插桩,以使得在响应的软中断处理函数开始位置翻转GPIO1口的电平,并在中断处理函数结束位置将GPIO2口的电平置高;Step S3, triggering the selected software to trigger an interrupt, and flipping the level signal of the GPIO1 port N times continuously, and inserting piles during the interrupt processing, so that the GPIO1 port is flipped at the beginning position of the corresponding soft interrupt processing function. Level, and set the level of GPIO2 port high at the end of the interrupt processing function;

本发明实施例中,在软件可触发中断触发后,连续N次翻转GPIO1口的电平信号时,(N-2)*相邻两侧翻转GPIO1口电平的间隔时间大于软件可触发中断的触发到CPU中止执行当前程序指令的时间,N大于等于3。所述软件可触发中断的触发到CPU中止执行当前程序指令的时间可以从CPU手册中查询得到;具体实施时,可以通过软件指令,实现GPIO1口的电平信号翻转。In the embodiment of the present invention, when the level signal of the GPIO1 port is continuously flipped N times after the software can trigger the interrupt trigger, (N-2) * the interval time between flipping the level of the GPIO1 port on both adjacent sides is longer than the software can trigger the interrupt The time from the trigger until the CPU suspends the execution of the current program instruction, N is greater than or equal to 3. The time from the triggering of the interrupt triggered by the software to the termination of the execution of the current program instruction by the CPU can be obtained from the CPU manual; during specific implementation, the level signal of the GPIO1 port can be reversed through software instructions.

软件可触发中断通过软件指令实现触发,具体触发过程为本技术领域人员所熟知。在中断处理过程中,通过在响应的软中断处理函数开始位置翻转GPIO1口的电平,能够实现捕获CPU开始处理中断用户程序的时刻点,通过在中断处理函数结束位置将GPIO2口的电平置高,能够实现捕获中断用户程序执行完毕的时刻点,可以采用本技术领域常用的技术手段实现在中断处理过程中的插桩,具体实施过程为本技术领域人员所熟知,此处不再赘述。Software triggerable interrupts are triggered by software instructions, and the specific triggering process is well known to those skilled in the art. In the process of interrupt processing, by flipping the level of GPIO1 port at the start position of the corresponding soft interrupt processing function, it is possible to capture the moment when the CPU starts to process the interrupt user program, and by setting the level of GPIO2 port at the end position of the interrupt processing function to High, it is possible to capture the moment when the interrupt user program is executed, and the technical means commonly used in this technical field can be used to implement stubbing during the interrupt processing process. The specific implementation process is well known to those skilled in the art and will not be repeated here.

在对软件可触发中断进行触发后,连续N次翻转GPIO1口的电平信号时,利用N次翻转GPIO1口的电平信号中的第M次翻转(M=取整(软中断触发到CPU中止执行当前程序指令的时间/两次翻转CPIO1之间的间隔时间 + 1),M大于等于1)能模拟捕获CPU内部中断请求的产生,在第M次翻转GPIO1口的电平信号后,CPU进入中断处理过程,通过上述的时间设置,后续的翻转GPIO1口的电平信号能够实现捕获CPU返回到原程序的时间点以及用于观察中断恢复后的软件执行状态。After triggering the software triggerable interrupt, when flipping the level signal of the GPIO1 port N times in a row, use the Mth flip in the level signal of the N times flipping the GPIO1 port (M=rounding (soft interrupt triggers to CPU suspension) The time to execute the current program instruction/interval time between two flips of CPIO1 + 1), M is greater than or equal to 1) can simulate and capture the generation of interrupt requests inside the CPU, after flipping the level signal of the GPIO1 port for the M time, the CPU enters In the interrupt processing process, through the above time setting, the subsequent flipping of the level signal of the GPIO1 port can capture the time point when the CPU returns to the original program and be used to observe the software execution status after the interrupt resumes.

步骤S4、在上述软件可触发中断恢复后且GPIO1电平变化后,逻辑分析仪停止对GPIO1口、GPIO2口对应电平信号的采集,并对记录GPIO1口、GPIO2口对应的电平信号进行分析,以确定中断响应时间T1以及恢复时间T2。Step S4, after the above-mentioned software can trigger the interrupt recovery and after the GPIO1 level changes, the logic analyzer stops collecting the level signals corresponding to the GPIO1 port and the GPIO2 port, and analyzes the level signals corresponding to the recorded GPIO1 port and the GPIO2 port , to determine the interrupt response time T1 and recovery time T2.

本发明实施例中,逻辑分析仪对GPIO1口、GPIO2口对应电平信号的采样受限于逻辑分析仪的存储能力等限制,但至少需要保证能对GPIO1口、GPIO2口对应电平信号的采样至软件可触发中断恢复后,具体实施时,可以设置逻辑分析仪的采样停止条件,所述采样停止条件可以根据需要进行确定,此处不再赘述。在停止采样后,对记录的GPIO1口、GPIO2口对应的电平信号进行分析。In the embodiment of the present invention, the sampling of the level signals corresponding to the GPIO1 port and the GPIO2 port by the logic analyzer is limited by the storage capacity of the logic analyzer, but at least it is necessary to ensure the sampling of the level signals corresponding to the GPIO1 port and the GPIO2 port After the software can trigger the interrupt recovery, during specific implementation, the sampling stop condition of the logic analyzer can be set, and the sampling stop condition can be determined according to needs, and will not be repeated here. After the sampling is stopped, analyze the recorded level signals corresponding to the GPIO1 port and GPIO2 port.

如图2所示,根据中断响应时间和中断恢复时间的定义,T1是中断响应时间,从图示T1开始位置:GPIO1口电平的下降沿代表中断请求产生,到T1结束位置:GPIO1口电平的上升沿代表CPU开始处理中断用户程序,从逻辑分析仪上读出T1结束位置与开始位置的时间差,从而得到中断响应时间T1。As shown in Figure 2, according to the definition of interrupt response time and interrupt recovery time, T1 is the interrupt response time, starting from T1 in the figure: the falling edge of the GPIO1 port level represents the generation of an interrupt request, and ending at T1: GPIO1 port power The flat rising edge represents that the CPU starts to process the interrupt user program, and read the time difference between the end position and the start position of T1 from the logic analyzer, so as to obtain the interrupt response time T1.

对中断恢复时间T2,图中,T2开始位置:GPIO2口对应的上升沿代表中断用户程序执行完毕, T2结束位置:GPIO1口电平的下降沿代表CPU返回到原程序时刻点,从逻辑分析仪上读出T2结束位置与开始位置的时间差,即能得到中断恢复时间T2。For the interrupt recovery time T2, in the figure, the start position of T2: the rising edge corresponding to the GPIO2 port represents the completion of the execution of the interrupt user program, and the end position of T2: the falling edge of the GPIO1 port level represents the CPU returning to the original program time point, from the logic analyzer Read out the time difference between the end position and the start position of T2, that is, the interrupt recovery time T2 can be obtained.

以CPU采用处理器TMS320F2812,CPU运行发动机控制软件,测量的内部中断是RTOSINT中断对应的中断响应时间T1以及中断恢复时间T2为例,对本发明的具体实施过程进行说明。具体地,Taking CPU adopting processor TMS320F2812, CPU running engine control software, the measured internal interrupt is interrupt response time T1 and interrupt recovery time T2 corresponding to RTOSINT interrupt as an example, the specific implementation process of the present invention is described. specifically,

在控制软件的启动段之后,配置GPIOA10和GPIOD6两个管脚为通用输出功能,初始化为输出低电平,确保这两个管脚不在其它无关本次测量插桩代码中使用,屏蔽其它中断。连接两个GPIOA10和GPIOD6信号和接地线到逻辑分析仪的两个通道ch1、ch2和地线ch_Gnd,设置逻辑分析仪的采集精度为2ns,触发条件为GPIOA10的上升沿触发并保存数据。After the start-up section of the control software, configure the two pins GPIOA10 and GPIOD6 as general-purpose output functions, and initialize them to output low levels to ensure that these two pins are not used in other unrelated instrumentation codes for this measurement, and other interrupts are shielded. Connect the two GPIOA10 and GPIOD6 signals and the ground wire to the two channels ch1, ch2 and ground wire ch_Gnd of the logic analyzer, set the acquisition accuracy of the logic analyzer to 2ns, and the trigger condition is the rising edge of GPIOA10 to trigger and save the data.

在置RTOSINT中断标志位前,置GPIOA的数据寄存器值的第10位为1,GPIOA10为高电平,在置RTOSINT中断标志位后,反复置GPIOA的数据寄存器值的第10位为1或者0,然后达到翻转GPIOA10电平五次的效果。Before setting the RTOSINT interrupt flag bit, set the 10th bit of the GPIOA data register value to 1, GPIOA10 is high level, after setting the RTOSINT interrupt flag bit, repeatedly reset the 10th bit of the GPIOA data register value to 1 or 0 , and then achieve the effect of flipping the GPIOA10 level five times.

在响应的软中断处理函数开始位置翻转GPIOA10对应的数据寄存器位的值,在中断处理函数结束位置将GPIOD6的数据寄存器位置为1,GPIOD6输出高电平。Flip the value of the data register bit corresponding to GPIOA10 at the beginning position of the corresponding soft interrupt processing function, and set the data register position of GPIOD6 to 1 at the end position of the interrupt processing function, and GPIOD6 outputs a high level.

逻辑分析仪采集并分析上述记录的数据,从而能得到中断响应时间T1以及中断恢复时间T2。具体地,利用GPIO的快速输出硬件特性(在TMS320F2812的GPIO翻转电平需要的时间是40ns,翻转GPIO用的指令只是1-3条CPU指令,占用时间最多为25ns),GPIO的电平变化时刻近似表达中断请求产生、CPU开始处理中断用户程序、中断用户程序执行完毕和CPU返回到被中断代码四个时刻点,中断响应和恢复时间测量的误差最多是25ns,这比定时器获取计数值的函数(包括函数出入栈的时间和函数处理时间)造成的误差要小,通过逻辑分析仪的高精度捕获GPIO信号的电平变化,然后通过分析数据,得出中断响应时间T1和中断恢复时间T2,测量结果的精度在100M左右的处理器上能到达几十ns左右。The logic analyzer collects and analyzes the data recorded above, so as to obtain the interrupt response time T1 and the interrupt recovery time T2. Specifically, using the fast output hardware characteristics of GPIO (the time required for the GPIO flipping level of TMS320F2812 is 40ns, the instructions for flipping GPIO are only 1-3 CPU instructions, and the time is up to 25ns), the GPIO level change moment Approximately expressing the four time points when an interrupt request is generated, the CPU starts to process the interrupt user program, the execution of the interrupt user program is completed, and the CPU returns to the interrupted code, the error of the measurement of the interrupt response and recovery time is at most 25ns, which is more than the time when the timer obtains the count value. The error caused by the function (including the time when the function is put in and out of the stack and the function processing time) is small. The level change of the GPIO signal is captured by the high precision of the logic analyzer, and then the interrupt response time T1 and the interrupt recovery time T2 are obtained by analyzing the data. , the accuracy of the measurement results can reach about tens of ns on a processor of about 100M.

按上述过程,可较为精确的测得发动机控制软件的RTOSINT中断响应时间T1和中断恢复时间T2,与理论分析符合,这为系统的时序和时间分析和验证提供基础,为产品性能的评估和验证提供了基础保证。According to the above process, the RTOSINT interrupt response time T1 and interrupt recovery time T2 of the engine control software can be measured more accurately, which is consistent with the theoretical analysis, which provides the basis for the timing and time analysis and verification of the system, and the evaluation and verification of product performance Basic guarantees are provided.

本发明将CPU的GPIO1口、GPIO2口与逻辑分析仪连接,通过逻辑分析仪采集并记录GPIO1口、GPIO2口对应的电平信号,通过GPIO1口、GPIO2口对应电平信号的翻转变化,能够测量得到CPU内部中断的中断响应时间以及中断恢复时间,操作方便,减少系统运行时间和时序分析的偏差,安全可靠。The invention connects the GPIO1 port and the GPIO2 port of the CPU with the logic analyzer, collects and records the level signals corresponding to the GPIO1 port and the GPIO2 port through the logic analyzer, and can measure the The interrupt response time and interrupt recovery time of CPU internal interrupts are obtained, which is convenient to operate, reduces the deviation of system running time and timing analysis, and is safe and reliable.

Claims (3)

1.一种基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,其特征是,所述测量方法包括如下步骤:1. a kind of measuring method based on the CPU internal interrupt response time of logic analyzer and recovery time, it is characterized in that, described measuring method comprises the steps: S1、选取CPU的两个GPIO口,并将所选取的两个GPIO口配置为通用输出接口且初始化为低电平输出,所述两个GPIO口分别标识为GPIO1口以及GPIO2口;CPU通过GPIO1口、GPIO2口分别与逻辑分析仪匹配连接,在GPIO1口的电平处于上升沿时,逻辑分析仪采集并保存GPIO1口、GPIO2口对应的电平信号;S1. Select two GPIO ports of the CPU, and configure the selected two GPIO ports as general-purpose output interfaces and initialize them as low-level outputs. The two GPIO ports are respectively marked as GPIO1 ports and GPIO2 ports; the CPU passes GPIO1 port and GPIO2 port are respectively matched and connected with the logic analyzer. When the level of the GPIO1 port is on the rising edge, the logic analyzer collects and saves the level signals corresponding to the GPIO1 port and GPIO2 port; 步骤S2、选定CPU的软件可触发中断,并在软件可触发中断触发前,翻转GPIO1口的电平,以使得逻辑分析仪对GPIO1口、GPIO2口对应的电平信号进行采集与保存;Step S2, the software of the selected CPU can trigger an interrupt, and before the software can trigger the interrupt, flip the level of the GPIO1 port, so that the logic analyzer can collect and save the level signals corresponding to the GPIO1 port and the GPIO2 port; 步骤S3、触发所选定的软件可触发中断,并连续N次翻转GPIO1口的电平信号,且在中断处理过程中进行插桩,以使得在响应的软中断处理函数开始位置翻转GPIO1口的电平,并在中断处理函数结束位置将GPIO2口的电平置高;Step S3, triggering the selected software to trigger an interrupt, and flipping the level signal of the GPIO1 port N times continuously, and inserting piles during the interrupt processing, so that the GPIO1 port is flipped at the beginning position of the corresponding soft interrupt processing function. Level, and set the level of GPIO2 port high at the end of the interrupt processing function; 步骤S4、在上述软件可触发中断恢复后且GPIO1电平变化后,逻辑分析仪停止对GPIO1口、GPIO2口对应电平信号的采集,并对记录GPIO1口、GPIO2口对应的电平信号进行分析,以确定中断响应时间T1以及恢复时间T2。Step S4, after the above-mentioned software can trigger the interrupt recovery and after the GPIO1 level changes, the logic analyzer stops collecting the level signals corresponding to the GPIO1 port and the GPIO2 port, and analyzes the level signals corresponding to the recorded GPIO1 port and the GPIO2 port , to determine the interrupt response time T1 and recovery time T2. 2.根据权利要求1所述的基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,其特征是,步骤S3中,在软件可触发中断触发后,连续N次翻转GPIO1口的电平信号时,(N-2)*相邻两侧翻转GPIO1口电平的间隔时间大于软件可触发中断的触发到CPU中止执行当前程序指令的时间,N大于等于3。2. the measuring method of interrupt response time and recovery time based on the CPU internal interrupt response time of logic analyzer according to claim 1, it is characterized in that, in step S3, after software can trigger interrupt triggering, flipping the electric current of GPIO1 mouth continuously N times When the signal is flat, (N-2)*The interval between flipping the GPIO1 port level on both adjacent sides is greater than the time from when the software can trigger an interrupt to when the CPU stops executing the current program instruction, and N is greater than or equal to 3. 3.根据权利要求1所述的基于逻辑分析仪的CPU内部中断响应时间和恢复时间的测量方法,其特征是,步骤S2中,选定CPU的软件可触发中断后,屏蔽CPU的其余中断。3. the measuring method of the interrupt response time and recovery time based on the CPU interior of logic analyzer according to claim 1, it is characterized in that, in step S2, after the software of selected CPU can trigger interrupt, shield the remaining interrupts of CPU.
CN201610576805.XA 2016-07-20 2016-07-20 The measurement method of the CPU internal interrupt response time and recovery time of logic-based analyzer Active CN106201802B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610576805.XA CN106201802B (en) 2016-07-20 2016-07-20 The measurement method of the CPU internal interrupt response time and recovery time of logic-based analyzer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610576805.XA CN106201802B (en) 2016-07-20 2016-07-20 The measurement method of the CPU internal interrupt response time and recovery time of logic-based analyzer

Publications (2)

Publication Number Publication Date
CN106201802A true CN106201802A (en) 2016-12-07
CN106201802B CN106201802B (en) 2019-08-13

Family

ID=57491197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610576805.XA Active CN106201802B (en) 2016-07-20 2016-07-20 The measurement method of the CPU internal interrupt response time and recovery time of logic-based analyzer

Country Status (1)

Country Link
CN (1) CN106201802B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463494A (en) * 2017-06-30 2017-12-12 百富计算机技术(深圳)有限公司 Interrupt service routine adjustment method, device, storage medium and its computer equipment
CN111008100A (en) * 2019-10-16 2020-04-14 珠海格力电器股份有限公司 Linux real-time operating system interrupt response time test system and method
CN111831521A (en) * 2019-04-18 2020-10-27 深圳市汇顶科技股份有限公司 Interrupt response time test method, processor and electronic device
CN112650616A (en) * 2021-01-05 2021-04-13 上海擎昆信息科技有限公司 Interrupt detection method, device and system
CN113220532A (en) * 2021-05-20 2021-08-06 复旦大学 Method and device for testing feedback time of interrupt event of embedded operating system
CN114579370A (en) * 2020-12-01 2022-06-03 中移物联网有限公司 Off-interrupt time testing method and device and electronic equipment
CN115309618A (en) * 2022-06-30 2022-11-08 广州创龙电子科技有限公司 Input and output delay detection method and system based on RT-Linux system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6745321B1 (en) * 1999-11-08 2004-06-01 International Business Machines Corporation Method and apparatus for harvesting problematic code sections aggravating hardware design flaws in a microprocessor
CN1774700A (en) * 2003-04-08 2006-05-17 孕龙科技股份有限公司 Data acquisition and processing method and device for logic analyzer
CN201387606Y (en) * 2009-04-21 2010-01-20 北京星网锐捷网络技术有限公司 Interrupt processing device and physical connection state rollover event processing device
CN102215139A (en) * 2010-04-02 2011-10-12 华为技术有限公司 Interruption measuring method, device and system
CN103198002A (en) * 2012-01-09 2013-07-10 上海海尔集成电路有限公司 Measurement method and simulator for program running time

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6745321B1 (en) * 1999-11-08 2004-06-01 International Business Machines Corporation Method and apparatus for harvesting problematic code sections aggravating hardware design flaws in a microprocessor
CN1774700A (en) * 2003-04-08 2006-05-17 孕龙科技股份有限公司 Data acquisition and processing method and device for logic analyzer
CN201387606Y (en) * 2009-04-21 2010-01-20 北京星网锐捷网络技术有限公司 Interrupt processing device and physical connection state rollover event processing device
CN102215139A (en) * 2010-04-02 2011-10-12 华为技术有限公司 Interruption measuring method, device and system
CN103198002A (en) * 2012-01-09 2013-07-10 上海海尔集成电路有限公司 Measurement method and simulator for program running time

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463494A (en) * 2017-06-30 2017-12-12 百富计算机技术(深圳)有限公司 Interrupt service routine adjustment method, device, storage medium and its computer equipment
CN111831521A (en) * 2019-04-18 2020-10-27 深圳市汇顶科技股份有限公司 Interrupt response time test method, processor and electronic device
CN111008100A (en) * 2019-10-16 2020-04-14 珠海格力电器股份有限公司 Linux real-time operating system interrupt response time test system and method
CN111008100B (en) * 2019-10-16 2021-09-21 格力电器(杭州)有限公司 Linux real-time operating system interrupt response time test system and method
CN114579370A (en) * 2020-12-01 2022-06-03 中移物联网有限公司 Off-interrupt time testing method and device and electronic equipment
CN112650616A (en) * 2021-01-05 2021-04-13 上海擎昆信息科技有限公司 Interrupt detection method, device and system
CN113220532A (en) * 2021-05-20 2021-08-06 复旦大学 Method and device for testing feedback time of interrupt event of embedded operating system
CN115309618A (en) * 2022-06-30 2022-11-08 广州创龙电子科技有限公司 Input and output delay detection method and system based on RT-Linux system
CN115309618B (en) * 2022-06-30 2023-04-11 广州创龙电子科技有限公司 Input and output delay detection method and system based on RT-Linux system

Also Published As

Publication number Publication date
CN106201802B (en) 2019-08-13

Similar Documents

Publication Publication Date Title
CN106201802B (en) The measurement method of the CPU internal interrupt response time and recovery time of logic-based analyzer
CN102360329B (en) Bus monitoring and debugging control device and methods for monitoring and debugging bus
US8892973B2 (en) Debugging control system using inside core event as trigger condition and method of the same
JP4138021B2 (en) Processor-based device, method for providing software performance profiling information, and software development system for generating and analyzing software performance profiling information
CN104504187B (en) A kind of FPGA online verification structures and methods based on serial communication interface
CN102035455B (en) M/T speed measuring method for frequency converter
CN108535507B (en) Computer storage medium for incremental encoder speed measurement
US20100005340A1 (en) Test execution of user SQL in database server code
CN103308738A (en) Abnormal waveform recording method for oscilloscope with high capture rate
JP2002189611A (en) Emulation device and method therefor
JPS61204749A (en) Software operation analyzing device
CN202582680U (en) Electromechanical conversion error test device for intelligent water meter
CN102288340B (en) Reaction flywheel output torque measuring circuit and measuring method thereof
CN202267954U (en) Bus monitoring and debugging control device
CN113740602B (en) Equal-precision frequency calculating device and method
CN114564342B (en) A debugging method and device for tracing a heterogeneous multi-core processor system
WO2024169435A1 (en) Trajectory analysis method, system and device based on latency duration of robot, and medium
CN105866542A (en) High-accuracy sliding frequency measurement method
WO2021109366A1 (en) Method and system for viewing simulation signals of digital product
CN111008133A (en) Debugging method and device for coarse-grained data flow architecture execution array
CN1979422A (en) Simulation device and method for obtaining application code execution rate
CN100480704C (en) High precision wide range velocity measuring method and circuit
CN115328643A (en) Hotspot-driven workload feature analysis method and analysis system combining instrumentation and performance event sampling
CN115658512A (en) Debugging system of general processor
US9182958B2 (en) Software code profiling

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: No. 104, Liangxi Road, Binhu District, Wuxi City, Jiangsu Province

Patentee after: AECC AERO ENGINE CONTROL SYSTEM INSTITUTE

Address before: 214063 Jiangsu province Binhu District of Wuxi City Liangxi Road No. 792

Patentee before: AVIC AVIATION MOTOR CONTROL SYSTEM INSTITUTE

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20250228

Address after: No. 33 Liu Lu Road, Hudai Town, Binhu District, Wuxi City, Jiangsu Province, China 214161

Patentee after: Wuxi Dynamic Control Technology Co.,Ltd.

Country or region after: China

Address before: No. 104 Liangxi Road, Binhu District, Wuxi City, Jiangsu Province 214063

Patentee before: AECC AERO ENGINE CONTROL SYSTEM INSTITUTE

Country or region before: China