Method and device for determining time consumption information of data and electronic equipment
By determining the operation time and time usage items in the user space, the problem of long measurement time exists when measuring data execution time information in the multi-task operating system is solved, and faster time-consuming information measurement is achieved.
Patent Information
- Application Number
- CN202310989035.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-07
- Publication Date
- 2025-02-14
AI Technical Summary
In a multitasking operating system, when measuring the time-consuming information of data execution operations, there is a problem that the measurement time is too long because the kernel needs to switch tasks context.
By sending test operation time instructions in the user space and recalling scheduling information in the kernel, the operation time and time items are determined in the user space, the context switching of tasks in the kernel is avoided.
It saves time to determine the time-consuming information of the measurement operation on the data, and solves the problem of long measurement time.
Smart Images

Figure CN119440975A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method, device and electronic device for determining time-consuming information of data. Background Art
[0002] In the related art, when measuring the time-consuming information of data execution operations, the operation is usually performed by the kernel. However, in the process of performing operations on the data, the kernel needs to be accessed in the form of user mode. In a multi-tasking operating system, it is necessary to switch to the task of measuring the time-consuming information of data execution operations, that is, when switching from one task to another, it is necessary to save the state of the current task and load the state of the next task. In this process, there will be a problem of too long measurement time.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present invention provide a method, device and electronic device for determining time consumption information of data, so as to at least solve the technical problem of long measurement time when measuring time consumption information of performing operations on data in the related art.
[0005] According to one aspect of an embodiment of the present invention, a method for determining time-consuming information of data is provided, comprising: obtaining target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing a target operation on the target data, and a time item corresponding to the operation time; sending a test operation time instruction to a user space, and sending a kernel scheduling information call instruction to a kernel, wherein the test operation time instruction carries the target data; receiving the operation time determined by the user space, and receiving the kernel scheduling information called from the kernel; and determining the time item corresponding to the operation time from the kernel scheduling information.
[0006] Optionally, the sending of the test operation time instruction to the user space includes: determining a predetermined function, wherein the predetermined function is used to make the target data execute the target operation, and identify the initial time when the target data executes the target operation, and the end time when the target data completes the target operation; sending the test operation time instruction to the user space, wherein the test operation time instruction also carries the predetermined function, so that the user space calls the predetermined function through a predetermined interface, determines the initial time and the end time, and obtains the operation time for executing the target operation on the target data based on the initial time and the end time.
[0007] Optionally, determining the time usage item corresponding to the operation time from the kernel scheduling information includes: determining sub-scheduling information corresponding to the target data from the kernel scheduling information based on the operation time; and determining the time usage item corresponding to the operation time based on the sub-scheduling information corresponding to the target data.
[0008] Optionally, the time usage item corresponding to the operation time is determined based on the sub-scheduling information corresponding to the target data, including: when the time usage item includes processor occupancy time and data waiting processing time, the processor occupancy time is determined based on the occupancy information of whether the processor is occupied in the sub-scheduling information; and the data waiting processing time is determined based on the sub-scheduling information and the processor occupancy time.
[0009] Optionally, determining the time usage item corresponding to the operation time from the kernel scheduling information includes: when there are multiple target data, determining sub-scheduling information corresponding to multiple operation times from the kernel scheduling information, wherein the multiple operation times are operation times corresponding to multiple target data; and determining the time usage items corresponding to the multiple operation times based on the sub-scheduling information corresponding to the multiple operation times.
[0010] Optionally, the receiving the operation time determined by the user space and receiving the kernel scheduling information called from the kernel includes: when there are multiple target data, receiving multiple operation times determined by the user space and receiving the kernel scheduling information called from the kernel, wherein the multiple operation times are operation times determined by the user space and obtained by respectively performing corresponding target operations on the multiple target data.
[0011] Optionally, after determining the time item corresponding to the operation time from the kernel scheduling information, the method further includes: parsing the target data and the time-consuming information to obtain information in a predetermined format, wherein the information in the predetermined format is information that can be displayed in the form of a web page.
[0012] According to one aspect of an embodiment of the present invention, a device for determining time-consuming information of data is provided, comprising: an acquisition module, used to acquire target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing a target operation on the target data, and a time item corresponding to the operation time; a sending module, used to send a test operation time instruction to a user space, and send a kernel scheduling information call instruction to a kernel, wherein the test operation time instruction carries the target data; a receiving module, used to receive the operation time determined by the user space, and receive the kernel scheduling information called from the kernel; and a determination module, used to determine the time item corresponding to the operation time from the kernel scheduling information.
[0013] According to one aspect of an embodiment of the present invention, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method for determining time-consuming information of data described in any one of the above.
[0014] According to one aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned methods for determining time-consuming information of data.
[0015] In an embodiment of the present invention, target data of time-consuming information to be tested is obtained, a test operation time instruction carrying the target data is sent to the user space, and an instruction to retrieve kernel scheduling information is sent to the kernel, the operation time determined by the user space is received, and the kernel scheduling information retrieved from the kernel is received, and then the time item corresponding to the operation time is determined from the kernel scheduling information, thereby achieving the purpose of determining the time-consuming information including the operation time consumed for executing the target operation on the target data and the time item corresponding to the operation time. Since the operation of measuring the operation time is performed in the user space instead of in the kernel, the context switching of the task in the kernel is avoided, and the time for determining the time-consuming information for measuring the time-consuming information for executing the operation on the data is saved, thereby solving the technical problem of long measurement time when measuring the time-consuming information for executing the operation on the data in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0017] Figure 1 is a flow chart of a method for determining time-consuming information of data according to an embodiment of the present invention;
[0018] Figure 2 4 is a structural block diagram of a device for determining time-consuming information of data according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0020] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those 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, system, product 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.
[0021] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0022] User space: In Linux system, user space is a kind of operating environment. User space refers to the operating environment of applications and user processes running in the operating system. In user space, applications can access the services and resources provided by the kernel through the system call interface. User space provides a relatively independent environment, and applications can request the kernel to perform certain privileged operations, such as file operations, network communications, etc. by calling system calls. It can be understood that user space refers to the environment for user processes to run, including the virtual address space of the process, the code and data executed by the user process, etc.
[0023] Kernel: In Linux system, kernel is another operating environment different from user space. Kernel is the core part of the operating system, responsible for managing the hardware resources of the system and providing system-level services and functions. It runs in privileged mode, can directly access hardware resources, and provides a series of system call interfaces for application programs to access. Kernel is responsible for handling interrupts, scheduling processes, managing memory, providing file systems and other basic functions. It can be understood that kernel space refers to the environment in which the operating system kernel runs, including kernel code and data, and the virtual address space used by the kernel.
[0024] Example 1
[0025] According to an embodiment of the present invention, an embodiment of a method for determining time-consuming information of data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0026] Figure 1 is a flow chart of a method for determining time-consuming information of data according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0027] Step S102, obtaining target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing the target operation on the target data, and the time item corresponding to the operation time;
[0028] The target data may be various types of data, for example, a program, a code, etc.
[0029] The target operation corresponds to the above target data. When the target data is a program or a code, the target operation is to execute the program or the code.
[0030] The operation time is the operation time consumed to perform the target operation on the target data. For example, the operation time is the time consumed to complete the execution of a program or a piece of code.
[0031] The time usage item is the allocation of different time periods during this operation time. For example, the time usage item can include the operation time item corresponding to the actual operation time and the waiting time item corresponding to the waiting time. Through the time usage item, it is clear what was done in each period of time during the operation period. For example, the operation time is five minutes from 10 o'clock to 10:05, and the time usage item is how much time was spent in these five minutes and what was done in each period, such as 3 minutes for the actual operation and 2 minutes for waiting.
[0032] In step S102 provided in the present application, target data of time-consuming information to be tested is obtained, so as to test the time-consuming information on the target data and obtain the time-consuming information.
[0033] Step S104, sending a test operation time instruction to the user space, and sending a kernel scheduling information call instruction to the kernel, wherein the test operation time instruction carries the target data;
[0034] In step S104 provided in the present application, a test operation time instruction is sent to the user space instead of being sent to the kernel, thereby avoiding the phenomenon of wasting time caused by the kernel needing to execute the task and perform context switching after sending the instruction to the kernel.
[0035] Moreover, by sending the instruction to the user space, when the user space executes the test, since the user space program can customize the test logic, test data and test environment, it can perform diversified tests according to actual needs, so it can be more flexible when executing the test. Moreover, the user space program is subject to the restrictions of user rights, which makes it safer to execute the test than the kernel space. If an exception or error occurs during the test, the user space program can be terminated or restarted without affecting the stability of the entire system. At least the above beneficial effects can be achieved.
[0036] Step S106, receiving the operation time determined by the user space, and receiving the kernel scheduling information retrieved from the kernel;
[0037] In step S106 provided in the present application, the user space will respond to the test operation time instruction to test the operation time of executing the target operation on the target data, so as to know the time consumed in the time-consuming information.
[0038] The kernel scheduling information retrieved from the kernel may include data and information related to managing and scheduling processes, threads, and tasks. The retrieved kernel scheduling information may be for a predetermined period of time, such as one day, half a day, one hour, etc., which is not limited here and can be customized according to actual applications and scenarios. The kernel scheduling information can be used to know the time item corresponding to the operation time in the time-consuming information.
[0039] It should be noted that, when the operation time is known, the kernel scheduling information corresponding to the operation time can be directly retrieved from the kernel. For example, if the operation time is five minutes from 10:00 to 10:05, the kernel scheduling information corresponding to 10:00 to 10:05 can be retrieved.
[0040] Step S108, determining the time item corresponding to the operation time from the kernel scheduling information.
[0041] In step S108 provided in the present application, the time usage items corresponding to the operation time are determined based on the kernel scheduling information, and it is determined what is used at each time point during the operation time.
[0042] Through the above steps S102-S108, the target data of the time-consuming information to be tested is obtained, the test operation time instruction carrying the target data is sent to the user space, and the kernel scheduling information instruction is sent to the kernel, the operation time determined by the user space is received, and the kernel scheduling information retrieved from the kernel is received, and then the time item corresponding to the operation time is determined from the kernel scheduling information, so as to achieve the purpose of determining the time-consuming information including the operation time consumed for executing the target operation on the target data and the time item corresponding to the operation time. Since the operation of measuring the operation time is performed in the user space instead of in the kernel, the context switching of the task in the kernel is avoided, and the time for determining the time-consuming information of the operation executed on the data is saved, thereby solving the technical problem of long measurement time when measuring the time-consuming information of the operation executed on the data in the related art.
[0043] As an optional embodiment, sending a test operation time instruction to the user space includes: determining a predetermined function, wherein the predetermined function is used to make the target data perform the target operation, and identify the initial time when the target data performs the target operation, and the end time when the target data completes the target operation; sending a test operation time instruction to the user space, wherein the test operation time instruction also carries the predetermined function, so that the user space calls the predetermined function through a predetermined interface, determines the initial time and the end time, and obtains the operation time for performing the target operation on the target data based on the initial time and the end time.
[0044] In this embodiment, a predetermined function is determined, and the target data is prepared to be marked with an initial time and an end time. By marking the target data with an initial time and an end time, the operation time of performing the target operation on the target data can be clearly known.
[0045] As an optional embodiment, determining the time usage item corresponding to the operation time from the kernel scheduling information includes: determining the sub-scheduling information corresponding to the target data from the kernel scheduling information based on the operation time; determining the time usage item corresponding to the operation time based on the sub-scheduling information corresponding to the target data.
[0046] In this embodiment, the step of determining the time usage corresponding to the operation time is introduced. Since the kernel scheduling information still includes time information, the sub-scheduling information can be determined by aligning the operation time with the time information. For example, if the operation time is from 10:00 to 10:05, the sub-scheduling information from 10:00 to 10:05 can be determined from the kernel scheduling information including one day. Based on the sub-scheduling information from 10:00 to 10.05, the time usage corresponding to these 5 minutes can be determined, that is, what was done in these 5 minutes, and what was done in the process of executing the target operation on the target data.
[0047] As an optional embodiment, based on the sub-scheduling information corresponding to the target data, the time usage item corresponding to the operation time is determined, including: when the time usage item includes processor occupancy time and data waiting processing time, the processor occupancy time is determined based on the occupancy information of whether the processor is occupied in the sub-scheduling information; the data waiting processing time is determined based on the sub-scheduling information and the processor occupancy time.
[0048] In this embodiment, the self-scheduling information will show whether the processor is occupied. Therefore, according to the information of whether the processor is occupied, it can be determined how much time the processor is occupied in the 5 minutes in the above example, and what time the processor is occupied. The remaining time is the time the target data waits to be processed, that is, the data waiting processing time. It can clearly know the time item for the target data to execute the target operation, and can observe the efficiency of the target data to execute the target operation. In the case where the data waiting time is too long, adaptive processing can be performed.
[0049] As an optional embodiment, determining time items corresponding to operation times from kernel scheduling information includes: when there are multiple target data, determining sub-scheduling information corresponding to multiple operation times from the kernel scheduling information, wherein the multiple operation times are operation times corresponding to multiple target data; and determining time items corresponding to the multiple operation times based on the sub-scheduling information corresponding to the multiple operation times.
[0050] In this embodiment, when there are multiple target data, multiple corresponding operation times determined by the user space can be received, so that the corresponding sub-scheduling information can be determined from the kernel scheduling information according to the multiple operation times, and the time usage items can be determined according to the sub-scheduling information. In addition, since the kernel scheduling information is a large section of information retrieved from the kernel, the kernel can also record the operating status of the system when the multiple target data respectively execute the target operation. Then, the time usage items corresponding to the multiple operation times can be directly determined according to the sub-scheduling information included in the kernel scheduling information.
[0051] As an optional embodiment, receiving an operation time determined by a user space and receiving kernel scheduling information called from the kernel includes: in the case where there are multiple target data, receiving multiple operation times determined by the user space and receiving kernel scheduling information called from the kernel, wherein the multiple operation times are operation times determined by the user space and obtained by respectively executing corresponding target operations on multiple target data.
[0052] In this embodiment, when there are multiple target data, multiple operation times determined by the user space are received. During this process, the user space or user process corresponding to the target data can be determined, so that different user spaces or user processes perform test operations, reducing the pressure on a single user space or user process to perform test operations. Moreover, through distributed testing, the waste of time can be greatly reduced.
[0053] As an optional embodiment, after determining the time item corresponding to the operation time from the kernel scheduling information, it includes: parsing the target data and the time consumption information to obtain the predetermined format information, wherein the predetermined format information is information that can be displayed in the form of a web page.
[0054] In this embodiment, the target data and time-consuming information can be parsed to obtain information in a predetermined format, such as a file in HTML format, so that it can be displayed as a web page on a browser, allowing users to more intuitively feel the time-consuming information of the target data executing the target operation.
[0055] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.
[0056] In the related art, the steps of executing a target operation on target data and determining the time consumed in executing the target data are performed in the kernel. In the process of the kernel performing operations on the data, it is necessary to access the kernel in user mode. In a multi-tasking operating system, it is necessary to switch to the task of measuring the time-consuming information of the data execution operation. That is, when switching from one task to another, it is necessary to save the state of the current task and load the state of the next task. In this process, there will be a problem of too long measurement time.
[0057] In view of this, a method for determining time-consuming information of data is provided in an optional implementation manner of the present invention.
[0058] S1, obtaining target data of the time-consuming information to be tested related to the vehicle side;
[0059] S2, determining a predetermined function, wherein the predetermined function is used to make the target data perform the target operation, and to identify the initial time when the target data performs the target operation, and the end time when the target data completes the target operation;
[0060] S3, sending a test operation time instruction to the user space, wherein the test operation time instruction carries target data and a predetermined function;
[0061] The user space stores user data and user tracking data. User trace data can also be called trace events. The trace events record information such as the event name, the time when the event occurs, and the time when the event ends. These trace data are saved in each user process.
[0062] It should be noted that the user space can store data of more than 2 seconds, and old data can be overwritten.
[0063] S4, the user space calls the predetermined function through the predetermined interface to determine the initial time and the end time;
[0064] S5, obtaining the operation time of performing the target operation on the target data according to the initial time and the end time;
[0065] S6, sending a kernel scheduling information call instruction to the kernel;
[0066] Among them, the kernel stores information such as kernel scheduling CPU switching.
[0067] Moreover, the data saved by the kernel is configured during initialization and controlled by the kernel itself, without the need for user intervention.
[0068] When an event occurs in the system and data needs to be dumped, the user process can dump the data recorded in the kernel, and other user processes can dump their own trace data. A meta event is generated each time a dump is made. The meta event stores the user's process name, thread id, and system mono time. The dumped data is saved to disk. The dumping of data may occur multiple times during system operation.
[0069] S7, receiving kernel scheduling information retrieved from the kernel;
[0070] S8, determining a time item corresponding to the operation time from the kernel scheduling information;
[0071] It should be noted that the above steps can be performed in an offline processing program, respectively parsing the data stored in the kernel and the trace data saved by the user, searching and aligning the data through the timestamps of the data, aligning the user's trace data with the corresponding data of the kernel, and determining the time item corresponding to the operation time.
[0072] S9, parsing the target data and the time-consuming information to obtain information in a predetermined format, wherein the information in the predetermined format is information that can be displayed in the form of a web page.
[0073] For example, an HTML file may be generated to display the processing time consumption of executing a target operation on target data in a browser.
[0074] Through the above optional implementation, at least the following beneficial effects can be achieved:
[0075] (1) The steps of executing target operations on target data are performed in user space instead of in the kernel, which reduces the system call overhead and improves the overall system performance;
[0076] (2) The steps for executing the target operation on the target data are in the user space and can be managed by the user himself, which has great flexibility;
[0077] (3) When there are multiple target data, they can be allocated to different user spaces for processing, effectively avoiding the problem of intensified resource competition when all operations corresponding to the target data are performed in the kernel;
[0078] (4) Alignment of kernel scheduling information and operation time is performed on the non-vehicle side, reducing performance consumption on the vehicle side.
[0079] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0080] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.
[0081] Example 2
[0082] According to an embodiment of the present invention, a device for implementing the method for determining the time consumption information of the above data is also provided. Figure 2 is a structural block diagram of a device for determining time-consuming information of data according to an embodiment of the present invention. Figure 2 As shown, the device includes: an acquisition module 202, a sending module 204, a receiving module 206 and a determination module 208. The device is described in detail below.
[0083] An acquisition module 202 is used to acquire target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing a target operation on the target data, and a time item corresponding to the operation time; a sending module 204 is connected to the above-mentioned acquisition module 202, and is used to send a test operation time instruction to the user space, and to send a kernel scheduling information call instruction to the kernel, wherein the test operation time instruction carries the target data; a receiving module 206 is connected to the above-mentioned sending module 204, and is used to receive the operation time determined by the user space, and to receive the kernel scheduling information called from the kernel; a determination module 208 is connected to the above-mentioned receiving module 206, and is used to determine the time item corresponding to the operation time from the kernel scheduling information.
[0084] It should be noted here that the above-mentioned acquisition module 202, sending module 204, receiving module 206 and determination module 208 correspond to steps S102 to S108 in the method for determining the time-consuming information of implementation data, and the instances and application scenarios implemented by multiple modules and corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiment 1.
[0085] Example 3
[0086] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor, wherein the processor is configured to execute instructions to implement any of the above methods for determining time-consuming information of data.
[0087] Example 4
[0088] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above methods for determining time-consuming information of data.
[0089] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0090] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0091] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0092] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0093] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0094] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0095] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for determining time-consuming information of data, characterized in that: include: Acquire target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing a target operation on the target data, and a time item corresponding to the operation time; Sending a test operation time instruction to the user space, and sending a kernel scheduling information call instruction to the kernel, wherein the test operation time instruction carries the target data; Receiving the operation time determined by the user space, and receiving kernel scheduling information retrieved from the kernel; A time usage item corresponding to the operation time is determined from the kernel scheduling information.
2. The method according to claim 1, characterized in that The sending of the test operation time instruction to the user space includes: Determine a predetermined function, wherein the predetermined function is used to make the target data perform the target operation, and identify the initial time when the target data performs the target operation, and the end time when the target data completes the target operation; Send the test operation time instruction to the user space, wherein the test operation time instruction also carries the predetermined function, so that the user space calls the predetermined function through a predetermined interface, determines the initial time and the end time, and obtains the operation time for performing the target operation on the target data based on the initial time and the end time.
3. The method according to claim 1, characterized in that The determining of a time item corresponding to the operation time from the kernel scheduling information includes: Determining sub-scheduling information corresponding to the target data from the kernel scheduling information according to the operation time; A time item corresponding to the operation time is determined according to the sub-scheduling information corresponding to the target data.
4. The method according to claim 3, characterized in that The determining, based on the sub-scheduling information corresponding to the target data, a time item corresponding to the operation time includes: In the case where the time usage item includes processor occupancy time and data waiting processing time, determining the processor occupancy time according to occupancy information of whether the processor is occupied in the sub-scheduling information; The data waiting processing time is determined according to the sub-scheduling information and the processor occupancy time.
5. The method according to claim 1, characterized in that: The determining of a time item corresponding to the operation time from the kernel scheduling information includes: In the case where there are multiple target data, determining sub-scheduling information corresponding to multiple operation times respectively from the kernel scheduling information, wherein the multiple operation times are operation times corresponding to the multiple target data respectively; According to the sub-scheduling information respectively corresponding to the multiple operation times, the time items respectively corresponding to the multiple operation times are determined.
6. The method according to claim 1, characterized in that The receiving the operation time determined by the user space and receiving kernel scheduling information retrieved from the kernel includes: In the case where there are multiple target data, multiple operation times determined by the user space are received, and the kernel scheduling information called from the kernel is received, wherein the multiple operation times are operation times determined by the user space and obtained by respectively executing corresponding target operations on the multiple target data.
7. The method according to any one of claims 1 to 6, characterized in that: After determining the time item corresponding to the operation time from the kernel scheduling information, the method further comprises: The target data and the time-consuming information are parsed to obtain information in a predetermined format, wherein the information in the predetermined format is information that can be displayed in the form of a web page.
8. A device for determining time-consuming information of data, characterized in that: include: An acquisition module, used for acquiring target data of time-consuming information to be tested, wherein the time-consuming information includes the operation time consumed for performing a target operation on the target data, and a time item corresponding to the operation time; A sending module, used for sending a test operation time instruction to the user space, and sending a kernel scheduling information retrieving instruction to the kernel, wherein the test operation time instruction carries the target data; A receiving module, configured to receive the operation time determined by the user space, and receive kernel scheduling information retrieved from the kernel; The determination module is used to determine the time item corresponding to the operation time from the kernel scheduling information.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method for determining time-consuming information of data as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for determining time consumption information of data as claimed in any one of claims 1 to 7.