Method and device for automatically detecting worst task execution time and medium
By inserting stub functions at the start and end points of each task, the execution time data is obtained and the worst execution time is calculated, which solves the problem of low multi-task detection efficiency in the existing technology and achieves efficient worst execution time detection.
Patent Information
- Application Number
- CN202410679008.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-20
AI Technical Summary
The existing technology is difficult to efficiently detect the worst execution time when multiple tasks occur, and the detection efficiency is low.
By inserting stub functions at the start and end detection points of each task to be detected, the start and end execution time data are obtained and marked, the maximum execution time data is calculated, and data analysis is performed to determine the worst execution time data.
When there are multiple tasks to be detected, the worst execution time data of each task can be collected and calculated simultaneously, which improves detection efficiency.
Smart Images

Figure CN118672873A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device and medium for automatically detecting the worst execution time of a task. Background Art
[0002] In the time performance test of embedded software, the most critical detection parameter is the worst-case execution time (WCET). However, when performing the worst-case execution time detection in the prior art, only the worst-case execution time of a single task can be detected. When there are multiple tasks that need to be detected, the detection efficiency is low. Therefore, how to improve the detection efficiency of the worst-case execution time when there are multiple tasks to be detected has become a technical problem that needs to be solved at present. Summary of the invention
[0003] In view of the above problems, the purpose of the present invention is to provide a method, device and medium for automatically detecting the worst execution time of a task, so as to improve the detection efficiency of the worst execution time when there are multiple tasks to be detected. The specific scheme is as follows:
[0004] In a first aspect, an embodiment of the present application provides a method for automatically detecting the worst execution time of a task, the method comprising:
[0005] Obtain a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to be executed, and the ending detection point is the position point when the task to be detected ends to be executed;
[0006] Insert pile function respectively at the starting detection point and the ending detection point of each described task to be detected in the described task to be detected concentration, obtain the starting pile function and the ending pile function of each described task to be detected; The described starting pile function is used to mark the starting execution time data of each execution of the described task to be detected; The described ending pile function is used to mark the ending execution time data of each execution of the described task to be detected;
[0007] Obtain the starting execution time data of each execution of the task to be detected according to the starting pile function; Obtain the ending execution time data of each execution of the task to be detected according to the ending pile function;
[0008] Determine the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time;
[0009] Data analysis is performed on the maximum execution time data of each of the tasks to be detected to obtain the worst execution time data of each of the tasks to be detected.
[0010] Optionally, before determining the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected, the method further includes:
[0011] According to the position of the starting pile function in the task to be detected, a unique identifier is set for the starting pile function;
[0012] According to the position of the described end pile function in the described task to be detected, a unique identifier is set for the described end pile function;
[0013] When performing the described task to be detected, verify the unique identifier of the described starting pile function, and the validity of the unique identifier of the described ending pile function;
[0014] If the unique identifier of the starting pile function or the unique identifier of the ending pile function is an invalid identifier, execution of the task to be detected is stopped.
[0015] Optionally, when executing the task to be detected, verifying the validity of the unique identifier of the starting pile function and the unique identifier of the ending pile function includes:
[0016] When performing the described task to be detected, if the corresponding positional information of the unique identifier of the described starting pile function is different from the positional information of the described starting detection point, then the unique identifier of the described starting pile function does not possess validity;
[0017] If the position information corresponding to the unique identifier of the end pile function is different from the position information of the end detection point, or when the start pile function corresponding to the end pile function is not executed before executing the end pile function, the unique identifier of the end pile function does not have validity.
[0018] Optionally, determining the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected includes:
[0019] Determine first execution time data according to the start execution time data of the task to be detected currently being executed and the end execution time data of the task to be detected currently being executed;
[0020] According to the self execution time data of described starting pile function, the self execution time data of described ending pile function, and described first execution time data, determine the second execution time data;
[0021] When there is no historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is stored in the preset storage space; the historical execution time data is the longest execution time spent on executing the task to be detected before the current round;
[0022] When the historical execution time data corresponding to the task to be detected exists in the preset storage space, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data, the historical execution time data is updated according to the second execution time data;
[0023] After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
[0024] Optionally, the performing data analysis on the maximum execution time data of each of the tasks to be detected to obtain the worst execution time data of each of the tasks to be detected includes:
[0025] The worst execution time data of each task to be detected is determined according to the maximum execution time data of each task to be detected, the chip GPT clock source frequency and the division ratio.
[0026] In a second aspect, an embodiment of the present application provides a device for automatically detecting the worst execution time of a task, the device comprising:
[0027] An acquisition module is used to mark a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to be executed, and the ending detection point is the position point when the task to be detected ends to be executed;
[0028] Insert module, be used for inserting pile function respectively at the starting detection point and the ending detection point of each described task to be detected in described task to be detected concentration, obtain the starting pile function and the ending pile function of each described task to be detected; Described starting pile function is used to mark the starting execution time data of each execution described task to be detected; Described ending pile function is used to mark the ending execution time data of each execution described task to be detected;
[0029] Described acquisition module, is also used for obtaining the starting execution time data of each execution of described task to be detected according to described starting pile function; Obtain the ending execution time data of each execution of described task to be detected according to described ending pile function;
[0030] The determination module is further used to determine the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time;
[0031] The analysis module is used to analyze the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
[0032] Optionally, the device further comprises:
[0033] A module is provided, which is used for arranging a unique identifier for the starting pile function according to the position of the starting pile function in the task to be detected;
[0034] Described setting module is also used for setting unique identifier for described end pile function according to the position of described end pile function in described task to be detected;
[0035] Verification module, is used for when carrying out described task to be detected, verifies the unique identifier of described starting pile function, and the validity of the unique identifier of described ending pile function;
[0036] The stopping module is used for stopping the execution of the task to be detected if the unique identifier of the starting pile function or the unique identifier of the ending pile function is an invalid identifier.
[0037] Optionally, the verification module is specifically used to:
[0038] When performing the described task to be detected, if the corresponding positional information of the unique identifier of the described starting pile function is different from the positional information of the described starting detection point, then the unique identifier of the described starting pile function does not possess validity;
[0039] If the positional information corresponding to the unique identifier of the described end pile function is different from the positional information of the described end detection point, or before executing the described end pile function, did not execute the starting pile function corresponding to the described end pile function, then the unique identifier of the described end pile function does not possess validity.
[0040] Determine first execution time data according to the start execution time data of the task to be detected currently being executed and the end execution time data of the task to be detected currently being executed;
[0041] According to the self execution time data of described starting pile function, the self execution time data of described ending pile function, and described first execution time data, determine the second execution time data;
[0042] When there is no historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is stored in the preset storage space; the historical execution time data is the longest execution time spent on executing the task to be detected before the current round;
[0043] When the preset storage space contains historical execution time data corresponding to the task to be detected, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data,
[0044] then updating the historical execution time data according to the second execution time data;
[0045] After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
[0046] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the above-mentioned methods for automatically detecting the worst execution time of a task.
[0047] Compared with the prior art, this application has the following beneficial effects:
[0048] By obtaining the task set to be detected, the starting detection point and the ending detection point of each task to be detected in the task set to be detected are respectively inserted with pile functions, and the starting pile function and the ending pile function of each task to be detected are obtained. The starting execution time data of each task to be detected are marked by the starting pile function, and the ending execution time data of each task to be detected are marked by the ending pile function. According to the starting execution time data of each task to be detected, and the ending execution time data of each task to be detected, the maximum execution time data of each task to be detected is determined. The maximum execution time data of each task to be detected is carried out data analysis, and the worst execution time data of each task to be detected is obtained. Thereby, by the pile function inserted in each task to be detected, when there are multiple tasks to be detected, the starting execution time data of each task to be detected can be collected simultaneously, and the ending execution time data, and the worst execution time data of each task to be detected is calculated and generated, and the detection efficiency of the worst execution time is improved when there are multiple tasks to be detected. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A flowchart of a method for automatically detecting the worst execution time of a task provided in an embodiment of the present application;
[0051] Figure 2 A flowchart of another method for automatically detecting the worst execution time of a task provided in an embodiment of the present application;
[0052] Figure 3 A flowchart of another method for automatically detecting the worst execution time of a task provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of the structure of a device for automatically detecting the worst execution time of a task provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0056] For ease of understanding, the embodiments of the present application are described in detail below with reference to the accompanying drawings:
[0057] like Figure 1 As shown, an embodiment of the present application provides a method for automatically detecting the worst execution time of a task, the method comprising:
[0058] S101: Obtain a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to execute, and the ending detection point is the position point when the task to be detected ends to execute.
[0059] Each task that needs to be detected is summarized to obtain a set of tasks to be detected, which includes at least one task to be detected, as well as the starting detection point and the ending detection point of each task to be detected. Taking the task to be detected as detecting a task function as an example, when the task to be detected is to detect a complete task function, the starting detection point is the entry position of the complete execution of the task function, and the ending detection point is the exit position of the complete execution of the task function. When the task to be detected is to perform a partial code segment in a complete task function, the starting detection point is the starting position of the partial code, and the ending detection point is the ending position of the partial code.
[0060] For example, when task function A includes a1 a2a3a4...an, if the task to be detected is to detect task function A, the position of the starting detection point is a1, and the position of the ending detection point is an. When the task to be detected is to detect the code segment from a4 to an-1 in task function A, the position of the starting detection point is a4, and the position of the ending detection point is an-1.
[0061] It should be noted that each task to be detected in the set of tasks to be detected is executed by the same chip.
[0062] S102: insert pile functions respectively at the starting detection point and the ending detection point of each task to be detected in the task to be detected concentration, obtain the starting pile function and the ending pile function of each task to be detected; the starting pile function is used to mark the starting execution time data of each execution of the task to be detected; the ending pile function is used to mark the ending execution time data of each execution of the task to be detected.
[0063] Insert a pile function at the starting detection point of each task to be detected to obtain the starting pile function of each task to be detected. Insert a pile function at the ending detection point of each task to be detected to obtain the ending pile function of each task to be detected, thereby determining the insertion position according to the task to be detected, realizing the time collection of any task to be detected, and improving universality.
[0064] By using the ID that has made up as formal parameter, import into starting pile function or end pile function, make the ID imported into as the unique identifier of starting pile function or end pile function, it should be noted that each starting pile function is all different from each unique identifier that ends pile function.When entering starting pile function and ending pile function at every turn, read the counter value in the GPT module, the counter value read when entering the starting pile function is as the mark corresponding to the initial execution time data of task to be detected, and the unique identifier of the starting pile function is combined with the mark, make in subsequent process, can determine the starting pile function corresponding to the mark based on the unique identifier.
[0065] The counter value read when entering the end pile function is used as a mark corresponding to the end execution time data of the task to be detected, and the unique identifier of the end pile function is combined with the mark, so that in the subsequent process, the end pile function corresponding to the mark can be determined based on the unique identifier.
[0066] S103: obtaining the start execution time data of each execution of the task to be detected according to the start pile function; obtaining the end execution time data of each execution of the task to be detected according to the end pile function.
[0067] Enable the GPT module that the chip that performs task to be detected carries, when performing task to be detected, the GPT module is based on the mark corresponding to the initial execution time data of task to be detected, and the unique identifier of the starting pile function calculates and counts, determines the initial execution time data that this initial pile function marks when performing task to be detected at each time. The GPT module is based on the mark corresponding to the initial execution time data of task to be detected, and the unique identifier of the ending pile function calculates and counts, determines the ending execution time data that this ending pile function marks when performing task to be detected at each time, thereby by the GPT module, the initial execution time data and the ending execution time data are collected, realize the dynamic acquisition of the operation data of task to be detected by chip own counter. Because the embodiment of the application all arranges corresponding initial pile function and the ending pile function in each task to be detected, thereby when there are multiple tasks to be detected, can obtain the initial execution time data and the ending execution time data of each task to be detected.
[0068] Read the start execution time data collected by the GPT module based on the start pile function and the end execution time data collected based on the end pile function respectively to determine whether the time data obtained by the GPT module is valid, if valid, execute step S104, if invalid, terminate the detection process and remind.
[0069] It should be noted that determining whether the time data acquired by the GPT module is valid may specifically be determining whether the output of the GPT module exceeds a preset value or an invalid value, so as to determine whether there is a hardware problem with the GPT module.
[0070] S104: Determine the maximum execution time data of each task to be detected based on the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time.
[0071] Repeatedly perform task to be detected in the preset time, by the GPT module and the starting pile function and the ending pile function inserted in task to be detected, obtain the starting execution time data and the ending execution time data when each execution of this task to be detected. When the task to be detected is multiple, then according to the unique identification that inserts the pile function in each task to be detected, obtain the starting execution time data and the ending execution time data when each task to be detected is executed. The preset time can be set according to actual demand, and the preset time is much greater than the time spent by repeatedly performing the task to be detected.
[0072] According to the starting execution time data and the ending execution time data of each execution of the task to be detected, the execution time of each task to be detected is calculated, and the execution time that takes the longest time is filtered out from the execution time of each task to be detected as the maximum execution time data of the task to be detected, thereby obtaining the maximum execution time data of each task to be detected.
[0073] The maximum execution time data and the unique identifier offset passed in are packaged for data processing to ensure the uniqueness of the identifier, so as to facilitate subsequent data transmission and analysis and improve the convenience of data management. The data packaging algorithm is: Data = ((T-Time_correction) << 12) & 0xfffff000) | ID, where T is the first execution time, Time_correction is the time to execute the stub function, and ID is 12 bits. This ID is the unique identifier for the end stub function, which is passed in through the formal parameter and the required number of bits can be adjusted according to the actual situation.
[0074] By packing the maximum execution time data of the task to be detected and the unique identifier corresponding to the end pile function of the task to be detected together, the name and the maximum execution time data of the task to be detected can be directly obtained from the packed data during the final analysis. Taking the above-mentioned packing method as an example, the first 20 bits of Data are time data, and the last 12 bits are ID information.
[0075] It should be noted that after packaging is completed, the packaged data is stored in a preset storage space. The size and specific location of the preset storage space can be set according to actual needs.
[0076] S105: Analyze the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
[0077] After the preset time is reached, the maximum execution time data of each task to be detected in the preset storage space is exported through the debugging software, and the data set analysis is performed on the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
[0078] In an optional embodiment, the maximum execution time data of each task to be detected is analyzed to obtain the worst execution time data of each task to be detected, including:
[0079] According to the maximum execution time data of each task to be detected, the chip GPT clock source frequency and the division ratio, the worst execution time data of each task to be detected is determined.
[0080] The worst execution time data of each task to be detected is determined by WCET = maximum execution time data / (chip GPT clock source frequency / division ratio). The chip frequency is the frequency of the chip GPT clock source that executes the task to be detected, such as 1MHZ. The division ratio is the division ratio of the chip configuration that executes the task to be detected.
[0081] Since the chip resources occupied by the above solution are small, the hardware requirements for the chip are low, and the statistics and calculation of WCET can be realized without additional software and hardware settings. When performing processor in the loop test (PIL) and hardware in the loop test (HIL), there is no need to design a special test framework, and the system test cases can be directly reused without affecting the function of the program itself, which has strong compatibility.
[0082] By obtaining the task set to be detected, the starting detection point and the ending detection point of each task to be detected in the task set to be detected are respectively inserted with pile functions, and the starting pile function and the ending pile function of each task to be detected are obtained. The starting execution time data of each task to be detected are marked by the starting pile function, and the ending execution time data of each task to be detected are marked by the ending pile function. According to the starting execution time data of each task to be detected, and the ending execution time data of each task to be detected, the maximum execution time data of each task to be detected is determined. The maximum execution time data of each task to be detected is carried out data analysis, and the worst execution time data of each task to be detected is obtained. Thereby, by the pile function inserted in each task to be detected, when there are multiple tasks to be detected, the starting execution time data of each task to be detected can be collected simultaneously, and the ending execution time data, and the worst execution time data of each task to be detected is calculated and generated, and the detection efficiency of the worst execution time is improved when there are multiple tasks to be detected.
[0083] like Figure 2 As shown, the embodiment of the present application provides another method for automatically detecting the worst execution time of a task, the method comprising:
[0084] S201: Obtain a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to execute, and the ending detection point is the position point when the task to be detected ends to execute.
[0085] The execution process of step S201 is similar to that of step S101.
[0086] S202: insert pile functions respectively at the starting detection point and the ending detection point of each task to be detected in the task to be detected concentration, obtain the starting pile function and the ending pile function of each task to be detected; the starting pile function is used to mark the starting execution time data of each execution of the task to be detected; the ending pile function is used to mark the ending execution time data of each execution of the task to be detected.
[0087] The execution process of step S202 is similar to the above step S102.
[0088] S203: obtaining the start execution time data of each execution of the task to be detected according to the start stub function; obtaining the end execution time data of each execution of the task to be detected according to the end stub function.
[0089] The execution process of step S203 is similar to the above step S103.
[0090] S204: according to the position of the starting pile function in the task to be detected, for the starting pile function is set with a unique identifier; according to the position of the ending pile function in the task to be detected, for the ending pile function is set with a unique identifier; when executing the task to be detected, verify the unique identifier of the starting pile function, and the validity of the unique identifier of the ending pile function; if the unique identifier of the starting pile function, or the unique identifier of the ending pile function are invalid identifiers, then stop executing the task to be detected.
[0091] After pile function is inserted into each task to be detected, according to the inserted position of starting pile function, for starting pile function is set with unique identifier, according to the inserted position of ending pile function, for ending pile function is set with unique identifier, because each starting pile function and each ending pile function are all positioned at the different positions in different tasks to be detected, thereby the positional information inserted by pile function is set with unique identifier for each pile function.Specifically can be for being each starting pile function and each ending pile function to be named, obtain starting pile function and the ending pile function of different names, thereby realize the differentiation of each function.Each starting pile function is different with each ending pile function except that unique identifier, and rest part is all identical.
[0092] Comprise that task function fun_A to be detected is detected and task function fun_B to be detected is detected with task set to be detected, and unique identifier is that ID is example.If the entry position point of task function fun_A to be detected is 0x001, and the exit position point is 0x002, the entry position point of task function fun_B to be detected is 0x003, and the exit position point is 0x003, then be inserted into the starting pile function ID, the ending pile function ID among the task function fun_A to be detected, be inserted into the starting pile function ID, the ending pile function ID among the task function fun_B to be detected, as shown in table 1.Thereby make the detection of all tasks, complete by identical entry and ending pile function, and do not need to define different pile functions.
[0093]
[0094]
[0095] Table 1
[0096] When executing task to be detected, the pile function that is inserted in the task to be detected can be called, the unique identifier of this pile function can be passed into the function body by formal parameter along with the calling of pile function, thereby by the unique identifier of called pile function, determine the function and the position where this pile function is located. After entering pile function, the validity of the unique identifier of this pile function is verified, and when the unique identifier of pile function has validity, continue to perform detection process, if the unique identifier of pile function does not have validity, then judge that program operation is abnormal, stop to perform this task to be detected.
[0097] In an optional embodiment, when executing the task to be detected, verify the unique identifier of the starting pile function and the validity of the unique identifier of the ending pile function, including:
[0098] When executing the task to be detected, if the position information corresponding to the unique identifier of the starting pile function is different from the position information of the starting detection point, the unique identifier of the starting pile function does not have validity;
[0099] If the position information corresponding to the unique identifier of the end pile function is different from the position information of the end detection point, or when the starting pile function corresponding to the end pile function is not executed before executing the end pile function, the unique identifier of the end pile function does not have validity.
[0100] When executing the task to be detected, determine the starting detection point and the end detection point corresponding to the task to be detected of current execution.Because the unique identifier is generated based on the inserted positional information of pile function, the unique identifier of the starting pile function can embody the positional information of the starting pile function, judge the corresponding positional information of the unique identifier of the starting pile function, whether is identical with the positional information of the starting detection point, if identical then this starting pile function possesses validity, if different then this starting pile function does not possess validity.Judge the corresponding positional information of the unique identifier of the ending pile function, whether is identical with the positional information of the ending detection point, and before executing this ending pile function, whether executed the starting pile function corresponding to this ending pile function, if the corresponding positional information of the unique identifier of the ending pile function is identical with the positional information of the ending detection point, and before executing this ending pile function, executed the starting pile function corresponding to this ending pile function then this ending pile function possesses validity.If the corresponding positional information of the unique identifier of the ending pile function is different from the positional information of the ending detection point, or before executing this ending pile function, do not execute the starting pile function corresponding to this ending pile function, then this ending pile function does not possess validity. Therefore, by comparing the position information, it is possible to determine whether the pile function has a fault and avoid generating erroneous data.
[0101] Need to prove, the remarks part in the above-mentioned table 1 can be filled in the validity detection rule, if the corresponding positional information of the unique identifier of the pile function imported into is inconsistent with the positional information of detection point, when the corresponding positional information of the unique identifier of the starting pile function is different from the positional information of the starting detection point, this starting pile function does not possess validity.When the corresponding positional information of the unique identifier of the ending pile function is different from the positional information of the ending detection point, or before executing this ending pile function, when not carrying out corresponding starting pile function, this pile function does not possess validity.
[0102] S205: Determine the maximum execution time data of each task to be detected based on the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time.
[0103] In an optional embodiment, the maximum execution time data of each task to be detected is determined according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected, including:
[0104] Determine the first execution time data according to the start execution time data of the currently executed task to be detected and the end execution time data of the currently executed task to be detected;
[0105] According to the self execution time data of initial pile function, the self execution time data of end pile function, and the first execution time data, determine the second execution time data;
[0106] When there is no historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is stored in the preset storage space; the historical execution time data is the longest execution time spent on executing the task to be detected before the current round;
[0107] When there is historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data, the historical execution time data is updated according to the second execution time data;
[0108] After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
[0109] The end time data of the current execution task to be detected is made difference with the starting execution time data of the current execution task to be detected, and obtains the first execution time data.Because the operation of pile function can consume a certain time, so the first execution time data is the self execution time of starting pile function, the execution time of task function and the self execution time sum of ending pile function.For guaranteeing the accuracy of data, from the first execution time data, remove the self execution time data of starting pile function, and the self execution time data of ending pile function, obtain the second execution time data, the second execution time data is the execution time of task function.Thereby timely eliminate the error caused when the pile function is run, make the execution time of task function more accurate.
[0110] After obtaining the second execution time data of the task to be detected, check whether there is historical execution data corresponding to the task to be detected in the preset storage space. If there is no historical execution time data corresponding to the task to be detected in the preset storage space, then the second execution time data is the longest execution time taken for the current execution of the task to be detected. The second execution time data is stored in the preset storage space as historical execution data.
[0111] When there is historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is compared with the historical execution time data. If the second execution time data is greater than the historical execution time data, the second execution time data is the longest execution time currently spent on executing the task to be detected, and the content of the historical execution data in the preset storage space is replaced with the content of the second execution data. If the second execution time data is less than or equal to the historical execution time data, the historical execution time data is not modified. This realizes the automatic update of the historical execution data, filters out invalid data, and reduces the memory space occupied.
[0112] After the preset time is reached, according to the correspondence between the historical execution time data and the task to be detected, the historical execution time data stored in the preset storage space is used as the maximum execution time data of the corresponding task to be detected, thereby obtaining the maximum execution time data corresponding to each task to be detected.
[0113] For example, when the task B to be detected is executed for the first time within the preset time and the second execution time data T1 is obtained, if there is no historical execution time data in the preset storage space, the second execution time data T1 is stored in the preset storage space as Tmax. When the task B to be detected is executed for the second time within the preset time and the second execution time data T2 is obtained, since the historical execution time data Tmax already exists in the preset storage space, the second execution time data T2 is compared with the historical execution time data Tmax, and when the second execution time data T2 is greater than the historical execution time data Tmax, the value of the historical execution time data Tmax is updated to the value of the second execution time data T2. If the preset time is reached at this time, the historical execution time data Tmax, which has the value of the second execution time data T2, is used as the maximum execution time data of the task B to be detected.
[0114] S206: Analyze the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
[0115] The execution process of step S206 is similar to that of step S105 .
[0116] like Figure 3 For ease of understanding, the following example is given:
[0117] Obtain the task set to be detected that needs to be detected, insert pile functions at the starting detection point and the ending detection point of each task to be detected in the task set to be detected, and obtain the starting pile function and the ending pile function of each task to be detected. According to the position of the starting pile function in the task to be detected, and the position of the ending pile function in the task to be detected, a unique identifier is set for each starting pile function and each ending pile function. When the GPT module collects the unique identifier and the corresponding time of the pile function, the validity of the pile function unique identifier is judged, if it does not have validity, then end. If validity is possessed, then read the data in the GPT counter, and judge whether the GPT counter is effective. If effective, then carry out data packaging processing, obtain the starting execution time and the ending execution time corresponding to the task to be detected. Calculate the difference between the starting execution time and the ending execution time, and obtain the first execution time data. The first execution time data is deducted from the self execution time data of the starting pile function, and the self execution time data of the ending pile function, and obtain the second execution time data. The second execution data is compared with the historical execution time data, and when the second execution data is greater than the historical execution data, the historical execution data is updated. If the preset time has not been reached at this time, you can return to the above steps to continue executing the task to be detected. If the preset time is reached, the historical execution data will be used as the maximum execution time data of the task to be detected. According to the maximum execution time data, chip frequency and division ratio of each task to be detected, the worst execution time data of each task to be detected is determined.
[0118] By obtaining the task set to be detected, the starting detection point and the ending detection point of each task to be detected in the task set to be detected are respectively inserted with pile functions, and the starting pile function and the ending pile function of each task to be detected are obtained. The starting execution time data of each task to be detected are marked by the starting pile function, and the ending execution time data of each task to be detected are marked by the ending pile function. According to the starting execution time data of each task to be detected, and the ending execution time data of each task to be detected, the maximum execution time data of each task to be detected is determined. The maximum execution time data of each task to be detected is carried out data analysis, and the worst execution time data of each task to be detected is obtained. Thereby, by the pile function inserted in each task to be detected, when there are multiple tasks to be detected, the starting execution time data of each task to be detected can be collected simultaneously, and the ending execution time data, and the worst execution time data of each task to be detected is calculated and generated, and the detection efficiency of the worst execution time is improved when there are multiple tasks to be detected.
[0119] like Figure 4 As shown, the embodiment of the present application also provides a device for automatically detecting the worst execution time of a task, the device comprising:
[0120] The acquisition module 401 is used to mark the set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and the starting detection point and the ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to be executed, and the ending detection point is the position point when the task to be detected ends to be executed;
[0121] Insert module 402, be used for inserting pile function respectively at the starting detection point and the ending detection point of each task to be detected in the task to be detected concentration, obtain the starting pile function and the ending pile function of each task to be detected; The starting pile function is used to mark the starting execution time data of each execution of the task to be detected; The ending pile function is used to mark the ending execution time data of each execution of the task to be detected;
[0122] Acquisition module 401 is also used for obtaining the starting execution time data of each execution task to be detected according to the starting pile function; Obtain the ending execution time data of each execution task to be detected according to the ending pile function;
[0123] The determination module 403 is further used to determine the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time;
[0124] The analysis module 404 is used to analyze the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
[0125] In an optional embodiment, the above device further includes:
[0126] A module is provided for arranging a unique identifier for the starting pile function according to the position of the starting pile function in the task to be detected;
[0127] A module is provided, which is also used for arranging a unique identifier for terminating the pile function according to the position of the pile function in the task to be detected;
[0128] Verification module, used for verifying the validity of the unique identifier of the starting pile function and the unique identifier of the ending pile function when executing the task to be detected;
[0129] The stop module is used for stopping the execution of the task to be detected if the unique identifier of the starting pile function or the unique identifier of the ending pile function is an invalid identifier.
[0130] In an optional embodiment, the verification module is specifically used to:
[0131] When performing the described task to be detected, if the corresponding positional information of the unique identifier of the described starting pile function is different from the positional information of the described starting detection point, then the unique identifier of the described starting pile function does not possess validity;
[0132] If the position information corresponding to the unique identifier of the end pile function is different from the position information of the end detection point, or when the start pile function corresponding to the end pile function is not executed before executing the end pile function, the unique identifier of the end pile function does not have validity.
[0133] In an optional embodiment, the determination module 403 is specifically configured to:
[0134] Determine the first execution time data according to the start execution time data of the currently executed task to be detected and the end execution time data of the currently executed task to be detected;
[0135] According to the self execution time data of initial pile function, the self execution time data of end pile function, and the first execution time data, determine the second execution time data;
[0136] When there is no historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is stored in the preset storage space; the historical execution time data is the longest execution time spent on executing the task to be detected before the current round;
[0137] When there is historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data, the historical execution time data is updated according to the second execution time data;
[0138] After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
[0139] In an optional embodiment, the analysis module 404 is specifically configured to:
[0140] The worst execution time data of each task to be detected is determined according to the maximum execution time data of each task to be detected, the chip frequency and the frequency division ratio.
[0141] By obtaining the task set to be detected, the starting detection point and the ending detection point of each task to be detected in the task set to be detected are respectively inserted with pile functions, and the starting pile function and the ending pile function of each task to be detected are obtained. The starting execution time data of each task to be detected are marked by the starting pile function, and the ending execution time data of each task to be detected are marked by the ending pile function. According to the starting execution time data of each task to be detected, and the ending execution time data of each task to be detected, the maximum execution time data of each task to be detected is determined. The maximum execution time data of each task to be detected is carried out data analysis, and the worst execution time data of each task to be detected is obtained. Thereby, by the pile function inserted in each task to be detected, when there are multiple tasks to be detected, the starting execution time data of each task to be detected can be collected simultaneously, and the ending execution time data, and the worst execution time data of each task to be detected is calculated and generated, and the detection efficiency of the worst execution time is improved when there are multiple tasks to be detected.
[0142] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, any one of the above-mentioned methods for automatically detecting the worst execution time of a task is implemented.
[0143] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0144] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0145] The technical content provided by the present invention is introduced in detail above. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for automatically detecting the worst execution time of a task, characterized in that: The method comprises: Obtain a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to be executed, and the ending detection point is the position point when the task to be detected ends to be executed; Insert pile function respectively at the starting detection point and the ending detection point of each described task to be detected in the described task to be detected concentration, obtain the starting pile function and the ending pile function of each described task to be detected; The described starting pile function is used to mark the starting execution time data of each execution of the described task to be detected; The described ending pile function is used to mark the ending execution time data of each execution of the described task to be detected; Obtain the starting execution time data of each execution of the task to be detected according to the starting pile function; Obtain the ending execution time data of each execution of the task to be detected according to the ending pile function; Determine the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time; Data analysis is performed on the maximum execution time data of each of the tasks to be detected to obtain the worst execution time data of each of the tasks to be detected.
2. The method according to claim 1, characterized in that Before determining the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected, the method further includes: According to the position of the starting pile function in the task to be detected, a unique identifier is set for the starting pile function; According to the position of the described end pile function in the described task to be detected, a unique identifier is set for the described end pile function; When performing the described task to be detected, verify the unique identifier of the described starting pile function, and the validity of the unique identifier of the described ending pile function; If the unique identifier of the starting pile function or the unique identifier of the ending pile function is an invalid identifier, execution of the task to be detected is stopped.
3. The method according to claim 2, characterized in that When executing the task to be detected, verifying the validity of the unique identifier of the starting pile function and the unique identifier of the ending pile function comprises: When performing the described task to be detected, if the corresponding positional information of the unique identifier of the described starting pile function is different from the positional information of the described starting detection point, then the unique identifier of the described starting pile function does not possess validity; If the position information corresponding to the unique identifier of the end pile function is different from the position information of the end detection point, or when the start pile function corresponding to the end pile function is not executed before executing the end pile function, the unique identifier of the end pile function does not have validity.
4. The method according to claim 1, characterized in that: Determining the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected includes: Determine first execution time data according to the start execution time data of the task to be detected currently being executed and the end execution time data of the task to be detected currently being executed; According to the self execution time data of described starting pile function, the self execution time data of described ending pile function, and described first execution time data, determine the second execution time data; When there is no historical execution time data corresponding to the task to be detected in the preset storage space, the second execution time data is stored in the preset storage space; the historical execution time data is the longest execution time spent on executing the task to be detected before the current round; When the historical execution time data corresponding to the task to be detected exists in the preset storage space, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data, the historical execution time data is updated according to the second execution time data; After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
5. The method according to claim 1, characterized in that The performing of data analysis on the maximum execution time data of each of the tasks to be detected to obtain the worst execution time data of each of the tasks to be detected comprises: The worst execution time data of each task to be detected is determined according to the maximum execution time data of each task to be detected, the chip GPT clock source frequency and the division ratio.
6. A device for automatically detecting the worst execution time of a task, characterized in that: The device comprises: An acquisition module is used to mark a set of tasks to be detected; the set of tasks to be detected includes at least one task to be detected, and a starting detection point and an ending detection point of each task to be detected; the starting detection point is the position point when the task to be detected starts to be executed, and the ending detection point is the position point when the task to be detected ends to be executed; Insert module, be used for inserting pile function respectively at the starting detection point and the ending detection point of each described task to be detected in described task to be detected concentration, obtain the starting pile function and the ending pile function of each described task to be detected; Described starting pile function is used to mark the starting execution time data of each execution described task to be detected; Described ending pile function is used to mark the ending execution time data of each execution described task to be detected; Described acquisition module, is also used for obtaining the starting execution time data of each execution of described task to be detected according to described starting pile function; Obtain the ending execution time data of each execution of described task to be detected according to described ending pile function; A determination module, used to determine the maximum execution time data of each task to be detected according to the start execution time data of each execution of the task to be detected and the end execution time data of each execution of the task to be detected; the maximum execution time data is the longest time spent on executing the task to be detected within a preset time; The analysis module is used to analyze the maximum execution time data of each task to be detected to obtain the worst execution time data of each task to be detected.
7. The device according to claim 6, characterized in that The device also includes: A module is provided, which is used for arranging a unique identifier for the starting pile function according to the position of the starting pile function in the task to be detected; Described setting module is also used for setting unique identifier for described end pile function according to the position of described end pile function in described task to be detected; Verification module, is used for when carrying out described task to be detected, verifies the unique identifier of described starting pile function, and the validity of the unique identifier of described ending pile function; The stopping module is used for stopping the execution of the task to be detected if the unique identifier of the starting pile function or the unique identifier of the ending pile function is an invalid identifier.
8. The device according to claim 7, characterized in that The verification module is specifically used for: When performing the described task to be detected, if the corresponding positional information of the unique identifier of the described starting pile function is different from the positional information of the described starting detection point, then the unique identifier of the described starting pile function does not possess validity; If the position information corresponding to the unique identifier of the end pile function is different from the position information of the end detection point, or when the start pile function corresponding to the end pile function is not executed before executing the end pile function, the unique identifier of the end pile function does not have validity.
9. The device according to claim 1, characterized in that The determination module is specifically used for: Determine first execution time data according to the start execution time data of the task to be detected currently being executed and the end execution time data of the task to be detected currently being executed; According to the self execution time data of described starting pile function, the self execution time data of described ending pile function, and described first execution time data, determine the second execution time data; When the historical execution time data corresponding to the task to be detected does not exist in the preset storage space, storing the second execution time data in the preset storage space; The historical execution time data is the longest execution time taken to execute the task to be detected before the current round; When the historical execution time data corresponding to the task to be detected exists in the preset storage space, the second execution time data is compared with the historical execution time data; if the second execution time data is greater than the historical execution time data, the historical execution time data is updated according to the second execution time data; After the preset time is reached, the historical execution time data corresponding to the task to be detected in the preset storage space is used as the maximum execution time data of the task to be detected.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the method for automatically detecting the worst execution time of a task as claimed in any one of claims 1 to 5 is implemented.
Citation Information
Cited By
Method and device for automatically determining real-time task execution time
CN121636123A
