[go: up one dir, main page]

CN116302945A - Test method for measuring real-time performance of Linux system - Google Patents

Test method for measuring real-time performance of Linux system Download PDF

Info

Publication number
CN116302945A
CN116302945A CN202211743406.XA CN202211743406A CN116302945A CN 116302945 A CN116302945 A CN 116302945A CN 202211743406 A CN202211743406 A CN 202211743406A CN 116302945 A CN116302945 A CN 116302945A
Authority
CN
China
Prior art keywords
kernel
test
linux
data
time
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
CN202211743406.XA
Other languages
Chinese (zh)
Other versions
CN116302945B (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.)
China Science And Technology Big Data Research Institute
Zhengzhou University
Original Assignee
China Science And Technology Big Data Research Institute
Zhengzhou University
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 China Science And Technology Big Data Research Institute, Zhengzhou University filed Critical China Science And Technology Big Data Research Institute
Priority to CN202211743406.XA priority Critical patent/CN116302945B/en
Publication of CN116302945A publication Critical patent/CN116302945A/en
Application granted granted Critical
Publication of CN116302945B publication Critical patent/CN116302945B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3698Environments for analysis, debugging or testing of software
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3604Analysis of software for verifying properties of programs
    • G06F11/3608Analysis of software for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The invention discloses a test method for measuring real-time performance of a Linux system, which relates to the technical field of computers and comprises a plurality of steps of firstly importing source codes into the Linux system to generate a Linux kernel module and executable files, then inserting the kernel module into the Linux kernel to collect and store kernel information, then testing classified fine-granularity test points through the kernel module, testing coarse-granularity test points in a user mode, reacting the obtained delay data of the demand points in the kernel to the user mode, and carrying out calculation and arrangement through the kernel module and a coarse-granularity simulation process to output real-time performance data of the reaction Linux system. According to the method, the Linux kernel mode and the user mode are cooperated to perform rich simulation test, corresponding real-time related quantized data are obtained, and the test result is more comprehensive and accurate.

Description

一种用于衡量Linux系统实时性的测试方法A Test Method for Measuring the Real-time Performance of Linux System

技术领域technical field

本发明属于计算机技术领域,具体涉及一种用于衡量Linux系统实时性的测试方法。The invention belongs to the technical field of computers, and in particular relates to a test method for measuring the real-time performance of a Linux system.

背景技术Background technique

Linux系统作为开源系统的翘楚,应用场景十分广泛。Linux系统的起源是一个用户交互式系统,并没有实时性相关的考虑,但是随着开源的Linux系统越来越受欢迎,Linux系统获得了实时性优化的内核补丁,由此Linux系统内核可以变成实时的系统内核,Linux系统通过对Linux内核打补丁提升其实时性,以满足大部分场景的实时性需求。而操作系统的实时性是一个比较抽象的概念,可以理解为在规定时间内完成规定的工作,可以称呼为该操作系统达到某一个水平的实时性,其容易受到硬件资源、软件的相互影响等,衡量Linux系统的实时性,需要通过测试工具通过数据来体现。As a leader in open source systems, the Linux system has a wide range of application scenarios. The origin of the Linux system is a user-interactive system, and there is no real-time consideration. However, as the open source Linux system becomes more and more popular, the Linux system has obtained a real-time optimized kernel patch, so that the Linux system kernel can become As a real-time system kernel, the Linux system improves its real-time performance by patching the Linux kernel to meet the real-time requirements of most scenarios. The real-time performance of the operating system is a relatively abstract concept. It can be understood as completing the specified work within a specified time. It can be called that the operating system has reached a certain level of real-time performance. It is easily affected by the mutual influence of hardware resources and software, etc. , To measure the real-time performance of the Linux system, it needs to be reflected by the test tools and data.

Cyclictest工具是当前衡量Linux系统实时性的一个较为权威的工具,它通过在用户态模拟Linux系统的进行调度,通过打时间戳相减的方法,获得内核中断延时和内核调度延时,以此反映Linux系统的实时性,但是Cyclictest工具也只是Linux的一个实时测试工具集中的工具,它用于衡量实时性的模拟过程相对较少,所反映的实时性数据较为简单,而且Cyclictest只在用户态进行模拟和数据的输出,难免会有略微的额外时间开销。The Cyclictest tool is a more authoritative tool for measuring the real-time performance of Linux systems. It simulates the scheduling of Linux systems in user mode, and obtains the kernel interrupt delay and kernel scheduling delay by subtracting timestamps. It reflects the real-time performance of the Linux system, but the Cyclictest tool is only a tool in the real-time test tool set of Linux. The simulation process used to measure real-time performance is relatively small, and the real-time performance data reflected are relatively simple, and Cyclictest is only available in user mode. There will inevitably be a slight additional time overhead for simulation and data output.

此外,Ftrace作为Linux系统内核的内置模块,系统的实时性能够通过Ftrace工具在系统运行过程中跟踪相关可探测点,关注实时性相关的函数调用过程,以此达到量化实时性的目的,但是虽然Ftrace受到Linux官方的支撑,其本质上就是一个Linux内核跟踪机制模块,对于实时性的检测只是其功能的一种,而且通过Ftrace获取的数据往往不够直观,操作也较为复杂,集成度不够高,需要进一步处理数据才能够获取量化的实时性数据。In addition, Ftrace is a built-in module of the Linux system kernel. The real-time performance of the system can track relevant detectable points during system operation through the Ftrace tool, and pay attention to the function call process related to real-time performance, so as to achieve the purpose of quantifying real-time performance. Ftrace is officially supported by Linux. It is essentially a Linux kernel tracking mechanism module. Real-time detection is only one of its functions. Moreover, the data obtained through Ftrace is often not intuitive enough, the operation is more complicated, and the integration degree is not high enough. Further data processing is required to obtain quantitative real-time data.

发明内容Contents of the invention

针对现有衡量Linux系统实时性工具,如Cyclictest工具和Ftrace工具存在的用于衡量实时性的模拟过程相对较少,所反映的实时性数据较为简单,且存在额外的时间开销,以及获取数据不够直观,操作复杂,集成度不够,还需对数据做进一步量化处理的缺陷和问题,本发明提供一种用于衡量Linux系统实时性的测试方法。Existing tools for measuring the real-time performance of Linux systems, such as Cyclictest and Ftrace, have relatively few simulation processes for measuring real-time performance, and the real-time performance data reflected are relatively simple, and there is additional time overhead and insufficient data acquisition Intuitive, complex operation, insufficient integration, and further quantitative processing of data are needed. The present invention provides a test method for measuring the real-time performance of the Linux system.

本发明解决其技术问题所采用的方案是:一种用于衡量Linux系统实时性的测试方法,包括以下步骤:The scheme that the present invention solves its technical problem adopts is: a kind of test method that is used to measure the real-time performance of Linux system comprises the following steps:

步骤一,构建专用的内核模块和测试用工具:将源代码导入Linux系统中进行编译,编译产生一个Linux内核模块和一个可执行文件,其中该可执行文件为测试工具;Step 1, build special-purpose kernel module and test tool: import source code in the Linux system and compile, compile and produce a Linux kernel module and an executable file, wherein this executable file is a test tool;

步骤二,将内核模块插入Linux内核中:将内核模块插入Linux内核中,并根据自定义的内核模块的工作内容,实现内核信息的收集并将收集信息保存在内核模块中;Step 2, insert the kernel module in the Linux kernel: insert the kernel module in the Linux kernel, and realize the collection of kernel information according to the work content of the self-defined kernel module and save the collected information in the kernel module;

步骤三,确定测试指标项并进行分类:将测试指标项按照粒度进行区分,使得细粒度的测试点通过内核模块进行测试获取数据,粗粒度的测试点在Linux系统中的用户态进行测试;Step 3, determine the test index items and classify: distinguish the test index items according to the granularity, so that the fine-grained test points are tested to obtain data through the kernel module, and the coarse-grained test points are tested in the user mode in the Linux system;

步骤四,执行用户态测试:用户运行上述步骤一中编译出来的可执行文件,进行用户态测试点模拟,模拟粗粒度的模拟程序,在模拟过程前后打上时间戳,进行时间段的统计,以获取测试点的数据;Step 4: Execute the user mode test: the user runs the executable file compiled in the above step 1 to simulate the user mode test point, simulate a coarse-grained simulation program, and stamp time stamps before and after the simulation process, and perform time period statistics to Obtain the data of the test point;

步骤五,在内核模块进行测试:通过内核中已设定好的trace event,在内核运行中触发上述event,实现对系统参数的统计,并将不同的event统计的时间戳相减获取所测试需求点的延时,在内核中获取到需求点延时数据后反应到用户态;Step 5, test in the kernel module: through the trace event set in the kernel, trigger the above event during the running of the kernel, realize the statistics of system parameters, and subtract the time stamps of different event statistics to obtain the tested requirements The delay of the point is reflected in the user state after obtaining the delayed data of the demand point in the kernel;

步骤六,内核模块结合粗粒度的模拟过程,并结合从上述步骤中收集到的内核数据,进行计算整理,从而输出用户关心的Linux系统实时性数据。In step six, the kernel module combines the coarse-grained simulation process and the kernel data collected from the above steps to perform calculation and sorting, so as to output the real-time data of the Linux system that the user cares about.

作为本发明的一种优选技术方案,所述步骤二中通过使用insmod命令将内核模块插入Linux内核中。As a preferred technical solution of the present invention, in the second step, the kernel module is inserted into the Linux kernel by using the insmod command.

作为本发明的一种优选技术方案,所述步骤三中测试指标项包括中断响应延时、信号量操作延时、消息队列操作延时、上下文切换延时、互斥量操作延时、定时器操作延时、事件操作延时、任务操作延时和调度操作延时。As a preferred technical solution of the present invention, the test index items in the step 3 include interrupt response delay, semaphore operation delay, message queue operation delay, context switching delay, mutex operation delay, timer Operation Delay, Event Operation Delay, Task Operation Delay, and Scheduled Operation Delay.

作为本发明的一种优选技术方案,所述步骤三中对测试指标项进行区分的标准是能否实现需求点的封装。As a preferred technical solution of the present invention, the criterion for distinguishing test index items in the third step is whether the encapsulation of demand points can be realized.

作为本发明的一种优选技术方案,所述步骤五中内核模块采用tracer技术,并通过用户的输入与内核模块进行交互,设置调用相应的函数,获取用户所需的内核模块测试数据,通过proc文件系统反馈给用户。As a preferred technical solution of the present invention, the kernel module in the step 5 adopts tracer technology, and interacts with the kernel module through the user's input, sets and calls the corresponding function, obtains the kernel module test data required by the user, and passes the proc The file system feeds back to the user.

作为本发明的一种优选技术方案,所述proc文件系统是Linux系统中内核态和用户态的一个通信窗口,用户通过proc文件系统来进行实时性测试数据的观测。As a preferred technical solution of the present invention, the proc file system is a communication window between the kernel state and the user state in the Linux system, and the user observes the real-time test data through the proc file system.

作为本发明的一种优选技术方案,所述步骤六中对数据进行计算整理的过程是对大量循环测试获取的时间数据进行处理,每一次循环获取时间数据,都更新该数据项的最小值、最大值和累加和,累加和用于最后输出平均值,最终输出用户关心的Linux系统实时性量化数据。As a preferred technical solution of the present invention, the process of calculating and arranging the data in the step 6 is to process a large amount of time data acquired by the cycle test, and each time the time data is obtained in a cycle, the minimum value and the minimum value of the data item are updated. The maximum value and cumulative sum, the cumulative sum is used to finally output the average value, and finally output the real-time quantitative data of the Linux system that users care about.

与现有技术相比,本发明的有益效果是:本发明提出的衡量Linux系统实时性的测试方法,构建了专用的内核模块,能够在内核态进行实时性模拟测试,从而降低了时间的损耗,提升测试结果的准确性;并且通过将Linux内核态和用户态进行结合,还丰富了现有实时测试工具中的测试指标项,测试环境也更加具体,并且通过在模拟环境前后获取时间,以获取用户所关心的测试过程的时间,从而使得Linux系统的实时性测试更全面更准确。Compared with the prior art, the beneficial effects of the present invention are: the test method for measuring the real-time performance of the Linux system proposed by the present invention has built a dedicated kernel module, which can carry out real-time simulation tests in the kernel state, thereby reducing the loss of time , to improve the accuracy of test results; and by combining the Linux kernel state and user state, it also enriches the test index items in the existing real-time test tools, and the test environment is more specific, and by obtaining the time before and after the simulation environment, with Obtain the time of the test process that the user cares about, so that the real-time performance test of the Linux system is more comprehensive and accurate.

附图说明Description of drawings

图1为本发明的整体流程示意图;Fig. 1 is the overall flow schematic diagram of the present invention;

图2为本发明的编译流程示意图;Fig. 2 is a schematic diagram of the compilation process of the present invention;

图3为本发明的测试工作流程示意图。Fig. 3 is a schematic diagram of the testing workflow of the present invention.

具体实施方式Detailed ways

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

请参阅图1-3,本发明提供了一种用于衡量Linux系统实时性的测试方法,结合Linux系统内核态和用户态测试数据的测量方法,提供更加丰富的测试点,模拟更具体的环境,在模拟环境前后获取时间,以获取用户所关心的测试过程的时间,较好的反映出Linux系统的实时性。Please refer to Fig. 1-3, the present invention provides a kind of test method for measuring the real-time performance of Linux system, combines the measurement method of Linux system kernel state and user state test data, provides richer test point, simulates more specific environment , obtain the time before and after the simulation environment to obtain the time of the test process that the user cares about, which better reflects the real-time nature of the Linux system.

实施例一:Embodiment one:

本发明提供的用于衡量Linux系统实时性的测试方法,包括以下步骤,The testing method for measuring the real-time performance of the Linux system provided by the present invention comprises the following steps,

步骤一,构建专用的内核模块和测试用工具:将源代码导入带有Linux5.10rt内核的Linux系统中进行编译,Linux系统包括用户态和内核态,编译之后产生一个Linux内核模块和一个可执行文件,内核模块属于内核态,可执行文件属于用户态,其中内核模块用于对内核中可探测点进行检测,以获取相关的调用信息,并通过proc文件系统和用户态交互,而该可执行文件为测试工具,即用户态的可执行文件不仅仅和内核模块通信获取数据,也进行一些粒度较大的模拟测试,以丰富测试数据;Step 1, build a dedicated kernel module and testing tools: Import the source code into the Linux system with the Linux5.10rt kernel for compilation. The Linux system includes user mode and kernel mode. After compilation, a Linux kernel module and an executable file, the kernel module belongs to the kernel state, and the executable file belongs to the user state. The kernel module is used to detect the detectable points in the kernel to obtain relevant call information, and interact with the user state through the proc file system, and the executable The file is a test tool, that is, the user mode executable file not only communicates with the kernel module to obtain data, but also performs some simulation tests with large granularity to enrich the test data;

步骤二,将内核模块插入Linux内核中: Linux内核模块是ko格式的文件,它分为静态编译进内核的模块和用insmod命令动态加载的模块,ko文件本质上还是ELF文件,和普通的ELF文件相比多了一个段的结构,用于记录ko模块的一些信息,这些信息用于内核加载模块时使用,通过使用insmod命令将内核模块插入Linux内核中,这些动态插入的内核模块具有很强的灵活性,让Linux内核需要某些功能时才将相应的内核模块插入内核,在Linux内核模块插入内核后,内核模块就会根据自定义的内核模块的工作内容开始工作,本方法中是在Linux内核运行的基础上,做内核信息的收集,如内核模块中在关中断和开中断的两个函数调用的地方加上时间戳,获取相应的时间,再将时间进行相减就能够获取对应中断的中断处理时间,所述获取信息就是内核中每个需求点的延时时间,最后再将收集到的信息保存在内核模块中;Step 2, insert the kernel module into the Linux kernel: The Linux kernel module is a file in ko format, which is divided into modules that are statically compiled into the kernel and modules that are dynamically loaded with the insmod command. The ko file is essentially an ELF file, which is different from an ordinary ELF file. Compared with the file, there is one more section structure, which is used to record some information of the ko module. This information is used when the kernel loads the module. The kernel module is inserted into the Linux kernel by using the insmod command. These dynamically inserted kernel modules have strong The flexibility allows the Linux kernel to insert the corresponding kernel module into the kernel when certain functions are needed. After the Linux kernel module is inserted into the kernel, the kernel module will start working according to the work content of the self-defined kernel module. In this method, the Based on the operation of the Linux kernel, collect kernel information. For example, in the kernel module, add time stamps to the places where the two function calls of interrupts and interrupts are called to obtain the corresponding time, and then subtract the time to obtain the corresponding time. The interrupt processing time of the interrupt, the information obtained is the delay time of each demand point in the kernel, and finally the collected information is stored in the kernel module;

步骤三,确定测试指标项并进行分类:将测试指标项按照粒度进行区分,测试的指标项包括中断响应延时、信号量操作延时、消息队列操作延时、上下文切换延时、互斥量操作延时、定时器操作延时、事件操作延时、任务操作延时和调度操作延时,将上述的测试指标项按照粒度进行区分,区分的标准是系统是否实现了该需求点的封装,其中细粒度的测试点通过内核模块进行测试获取数据,粗粒度的测试点在Linux系统中的用户态进行测试,即将上述中断响应延时和上下文切换延时通过内核模块中测试,而将上述的其他指标项放置于用户态进行测试,这样通过细化操作系统的各种基本行为,如中断处理时间、上下文切换时间等,再对细化的行为进行抽象,对每个抽象出来的行为进行模拟测试,获取相应的时间值,这些时间值就能够很好的反映操作系统的实时性;Step 3: Determine and classify the test index items: distinguish the test index items according to the granularity, the test index items include interrupt response delay, semaphore operation delay, message queue operation delay, context switching delay, mutex Operation delay, timer operation delay, event operation delay, task operation delay and scheduling operation delay, the above-mentioned test index items are distinguished according to the granularity. The standard of distinction is whether the system realizes the encapsulation of the demand point, Among them, the fine-grained test points are tested to obtain data through the kernel module, and the coarse-grained test points are tested in the user state in the Linux system, that is, the above-mentioned interrupt response delay and context switching delay are tested in the kernel module, and the above-mentioned Other index items are placed in the user state for testing, so that by refining various basic behaviors of the operating system, such as interrupt processing time, context switching time, etc., the refined behavior is abstracted, and each abstracted behavior is simulated Test and obtain the corresponding time values, which can well reflect the real-time performance of the operating system;

步骤四,执行用户态测试:在进行用户态测试时,用户运行上述步骤一中编译出来的可执行文件,该可执行文件用于承载用户的输入,以修改测试循环次数等其他可调节数据。可执行文件模拟不同的测试方案,获取用户所关心的数据,进行用户态测试点模拟,运行用户态模拟的粗粒度的模拟程序,对上述步骤三中对应指标项的模拟过程前后打上时间戳,进行时间段的统计,并采用内存锁和实时调度策略尽可能避免抢占的影响,以获取测试点的数据;Step 4: Execute user-mode testing: When performing user-mode testing, the user runs the executable file compiled in the above step 1. The executable file is used to carry user input to modify other adjustable data such as the number of test cycles. The executable file simulates different test schemes, obtains the data that the user cares about, simulates the test points in the user state, runs the coarse-grained simulation program of the user state simulation, and stamps the time stamps before and after the simulation process of the corresponding index items in the above step 3. Perform time period statistics, and use memory locks and real-time scheduling strategies to avoid the impact of preemption as much as possible to obtain test point data;

步骤五,在内核模块进行测试: 在内核模块中进行测试,即将上述中断响应延时和上下文切换延时通过内核模块中测试,内核模块借助tracer技术,通过内核中已设定好的trace event,在内核运行中触发设定好的event,实现对时间等系统参数的统计,并将不同的event统计的时间戳相减获取所测试需求点的延时,在内核中获取到需求点延时数据后通过proc文件系统反应到用户态,便于用户交互,即通过用户的输入与内核模块进行交互,设置调用相应的函数,获取用户所需的内核模块测试数据,通过proc文件系统反馈给用户,内核模块中定义了proc文件系统下的自定义目录,用于用户的交互,proc文件系统是Linux系统中内核态和用户态的一个通信窗口,是一个虚拟的文件系统,非常适合于观测Linux系统中的内核信息,将其作为内核态和用户态的通信通道,proc文件系统中的内容都是动态创建的。Step 5: Test in the kernel module: Test in the kernel module, that is, the above-mentioned interrupt response delay and context switching delay are tested in the kernel module. The kernel module uses the tracer technology to pass the trace event set in the kernel. Trigger the set event during the running of the kernel, realize the statistics of system parameters such as time, and subtract the time stamps of different event statistics to obtain the delay of the tested demand point, and obtain the delay data of the demand point in the kernel Afterwards, it responds to the user state through the proc file system, which is convenient for user interaction, that is, interacts with the kernel module through user input, sets and calls corresponding functions, obtains the test data of the kernel module required by the user, and feeds back to the user through the proc file system. The module defines a custom directory under the proc file system for user interaction. The proc file system is a communication window between the kernel state and the user state in the Linux system. It is a virtual file system and is very suitable for observing Linux systems. The kernel information is used as the communication channel between the kernel mode and the user mode, and the contents in the proc file system are dynamically created.

本方法中通过定义一部分文件用于用户输入,输入的内容就可以通过系统接口从用户态拷贝到内核态进行使用;同样的一部分文件用于进行实时性测试数据的观测,其中的数据就是从内核态拷贝出来的,此外,内核模块还采用了tracepoint的机制,tracepoint在内核中的一些固定位置预留的可插入代码的点,这里可插入的代码主要是统计相应的时间戳的数据,并进行保存,内核模块中对保存的时间戳数据进行相减,获取测试需求点的延时时间值,从内核态通过proc文件系统反映到用户态,将用户态代码调用proc文件系统的接口,就能够不用通过终端去获取proc文件系统中的数据,使得内核模块能够与用户态之间实现通信,本发明在测试过程的前后都尽量准确地获取系统的时间戳,减少系统对过程的干扰,这样利用内核的测试方法能够减少核态切换带来的时间开销,从而使得测试结果更加准确。In this method, by defining a part of the file for user input, the input content can be copied from the user state to the kernel state through the system interface for use; the same part of the file is used for the observation of real-time test data, and the data in it is from the kernel In addition, the kernel module also adopts the mechanism of tracepoint. The tracepoint is reserved in some fixed positions in the kernel where the code can be inserted. The code that can be inserted here is mainly to count the data of the corresponding time stamp and perform Save, subtract the saved time stamp data in the kernel module, obtain the delay time value of the test demand point, reflect it from the kernel state to the user state through the proc file system, and call the user state code to the interface of the proc file system, you can It is not necessary to obtain the data in the proc file system through the terminal, so that the kernel module can communicate with the user state. The present invention obtains the timestamp of the system as accurately as possible before and after the test process, and reduces the interference of the system to the process. The test method of the kernel can reduce the time overhead caused by the switching of the nuclear state, so that the test results are more accurate.

步骤六,内核模块结合粗粒度的模拟过程,并结合从上述步骤中收集到的内核数据,进行计算整理,即对大量循环测试获取的时间数据进行处理,每一次循环获取时间数据,都更新该数据项的最小值、最大值和累加和,进行时间戳的相减,累加和用于最后输出平均值,最终输出用户关心的Linux系统实时性量化数据。本发明提出的衡量Linux系统实时性的测试方法,采用操作系统运行的某一个相对较短的过程,总结出系统的一个实时性能的抽象描述,然后用抽象描述和测试数据评判系统的实时性,结合了从内核态获取Linux数据的优点,同时也兼顾了用户态测试工具的便捷,丰富了Linux实时性能测试方法,使得Linux系统的实时性测试更全面更准确。Step 6. The kernel module combines the coarse-grained simulation process and the kernel data collected from the above steps to perform calculation and sorting, that is, to process the time data obtained by a large number of loop tests, and to update the time data acquired each cycle. The minimum value, maximum value, and cumulative sum of the data items are subtracted from the timestamp, and the cumulative sum is used to output the average value at the end, and finally output the real-time quantitative data of the Linux system that users care about. The test method for measuring the real-time performance of the Linux system proposed by the present invention adopts a relatively short process of operating system operation to summarize an abstract description of the real-time performance of the system, and then judges the real-time performance of the system with the abstract description and test data. Combining the advantages of obtaining Linux data from the kernel state and the convenience of user state test tools, it enriches the Linux real-time performance test methods and makes the real-time performance test of the Linux system more comprehensive and accurate.

以上所述仅为本发明的较佳实施例,并不限制本发明,凡在本发明的精神和原则范围内所做的任何修改、等同替换和改进,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and do not limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention. Inside.

Claims (7)

1. A test method for measuring real-time performance of a Linux system is characterized by comprising the following steps of: the method comprises the following steps:
step one, constructing a special kernel module and a testing tool: the method comprises the steps of importing source codes into a Linux system for compiling, and compiling to generate a Linux kernel module and an executable file, wherein the executable file is a testing tool;
inserting the kernel module into a Linux kernel: inserting the kernel module into a Linux kernel, collecting kernel information according to the working content of the self-defined kernel module, and storing the collected information in the kernel module;
step three, determining and classifying test index items: distinguishing the test index items according to granularity, so that fine-granularity test points test through a kernel module to obtain data, and testing coarse-granularity test points in a user mode in a Linux system;
step four, executing user mode test: the user runs the executable file compiled in the step one, performs user state test point simulation, simulates a coarse-granularity simulation program, marks time stamps before and after the simulation process, and performs time period statistics to obtain test point data;
step five, testing the kernel module: triggering the events in the kernel operation through the set trace event in the kernel, realizing statistics of system parameters, subtracting time stamps of different event statistics to obtain delay of a tested demand point, and reacting to a user mode after obtaining delay data of the demand point in the kernel;
and step six, the kernel module combines the coarse-granularity simulation process and combines the kernel data collected from the steps to calculate and arrange, so as to output the real-time data of the Linux system which is concerned by the user.
2. The test method for measuring real-time performance of a Linux system according to claim 1, wherein the test method comprises the following steps: in the second step, the kernel module is inserted into the Linux kernel by using an insmod command.
3. The test method for measuring real-time performance of a Linux system according to claim 1, wherein the test method comprises the following steps: and in the third step, the test index item comprises interrupt response delay, semaphore operation delay, message queue operation delay, context switching delay, mutex operation delay, timer operation delay, event operation delay, task operation delay and scheduling operation delay.
4. The test method for measuring real-time performance of a Linux system according to claim 1, wherein the test method comprises the following steps: and in the third step, the standard for distinguishing the test index items is whether the packaging of the demand points can be realized.
5. The test method for measuring real-time performance of a Linux system according to claim 1, wherein the test method comprises the following steps: in the fifth step, the kernel module adopts a tracer technology, interacts with the kernel module through input of a user, sets and calls corresponding functions, acquires kernel module test data required by the user, and feeds back the test data to the user through a proc file system.
6. The test method for measuring real-time performance of a Linux system according to claim 5, wherein the test method comprises the following steps: the proc file system is a communication window of kernel mode and user mode in the Linux system, and a user observes real-time test data through the proc file system.
7. The test method for measuring real-time performance of a Linux system according to claim 1, wherein the test method comprises the following steps: and step six, the process of calculating and sorting the data is to process a large amount of time data acquired by cyclic test, the minimum value, the maximum value and the accumulation sum of the data item are updated each time the time data are acquired in each cycle, the accumulation sum is used for finally outputting an average value, and finally, the real-time quantized data of the Linux system concerned by the user is output.
CN202211743406.XA 2022-12-30 2022-12-30 Test method for measuring real-time performance of Linux system Active CN116302945B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211743406.XA CN116302945B (en) 2022-12-30 2022-12-30 Test method for measuring real-time performance of Linux system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211743406.XA CN116302945B (en) 2022-12-30 2022-12-30 Test method for measuring real-time performance of Linux system

Publications (2)

Publication Number Publication Date
CN116302945A true CN116302945A (en) 2023-06-23
CN116302945B CN116302945B (en) 2025-07-25

Family

ID=86778681

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211743406.XA Active CN116302945B (en) 2022-12-30 2022-12-30 Test method for measuring real-time performance of Linux system

Country Status (1)

Country Link
CN (1) CN116302945B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722434A (en) * 2012-05-24 2012-10-10 兰雨晴 Performance test method and tool aiming at Linux process scheduling
CN105760305A (en) * 2016-03-09 2016-07-13 上海博达数据通信有限公司 Real-time system monitoring method under linux
CA3019535A1 (en) * 2016-03-31 2017-10-05 JIBO, Inc. Persistent companion device configuration and deployment platform
CN109343960A (en) * 2018-10-12 2019-02-15 郑州云海信息技术有限公司 A task scheduling method, system and related device of a Linux system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722434A (en) * 2012-05-24 2012-10-10 兰雨晴 Performance test method and tool aiming at Linux process scheduling
CN105760305A (en) * 2016-03-09 2016-07-13 上海博达数据通信有限公司 Real-time system monitoring method under linux
CA3019535A1 (en) * 2016-03-31 2017-10-05 JIBO, Inc. Persistent companion device configuration and deployment platform
CN109343960A (en) * 2018-10-12 2019-02-15 郑州云海信息技术有限公司 A task scheduling method, system and related device of a Linux system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王兆文等: "一种提高Linux内存管理实时性的设计方案", 《计算机工程》, no. 09, 23 October 2014 (2014-10-23), pages 291 - 294 *

Also Published As

Publication number Publication date
CN116302945B (en) 2025-07-25

Similar Documents

Publication Publication Date Title
US6374369B1 (en) Stochastic performance analysis method and apparatus therefor
US8924912B2 (en) Method of recording and replaying call frames for a test bench
US8898049B2 (en) System level power profiling of embedded applications executing on virtual multicore system-on-chip platforms
US10176078B1 (en) Debugging process
Dongarra et al. Experiences and lessons learned with a portable interface to hardware performance counters
KR100921514B1 (en) A Software Development Apparatus for Providing Performance Prediction and A method thereof
JPS61204749A (en) Software operation analyzing device
WO2019209572A1 (en) Level-crossing memory trace inspection queries
Ball et al. Using paths to measure, explain, and enhance program behavior
CN111679984A (en) Performance analysis method and device
KR20180096780A (en) Method and apparatus for data mining from core trace
US20090083716A1 (en) Profiling method and program
Dongarra et al. Performance instrumentation and measurement for terascale systems
CN120849251A (en) Code running time determination method based on CORTEX M4 chip and related equipment
CN116302945A (en) Test method for measuring real-time performance of Linux system
CN116149974A (en) Service test method, service test device, electronic equipment and storage medium
CN100385411C (en) A Dynamic Software Energy Consumption Testing Method in Embedded System Simulator
Gamblin et al. Reconciling sampling and direct instrumentation for unintrusive call-path profiling of MPI programs
Khamparia et al. Program analysis with dynamic instrumentation Pin and performance tools
Terrasa et al. Extracting temporal properties from real-time systems by automatic tracing analysis
Nilakantan et al. Platform-independent analysis of function-level communication in workloads
Saha et al. TraFic—A Systematic Low Overhead Code Coverage Tool for Embedded Systems
Andersson Modeling the temporal behavior of complex embedded systems: a reverse engineering approach
CN119149358B (en) A GPU driver performance analysis method
CN119292889B (en) A parallel program performance data monitoring and collection method for supercomputing architecture

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant