Time consumption monitoring method and device, electronic equipment and computer readable medium
By acquiring and verifying window operation messages when the target program is started, and delivering time-consuming messages to confirm time-consuming, the problem of inaccurate monitoring of user interface startup in the prior art is solved, and more accurate time-consuming monitoring is achieved and data analysis and code maintenance is reduced.
Patent Information
- Application Number
- CN202410022383.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-07-08
AI Technical Summary
The existing terminal user interface startup time-consuming monitoring scheme is inaccurate and data analysis and code maintenance are difficult. The existing technology cannot accurately monitor the time-consuming from application startup to user-operable interface window.
By responding to the target program startup, the target process is determined, and the window operation message is obtained when the window is created for the first time, the registered callback function is called for message verification, and the timing message is delivered to ensure the last position of the message queue. It takes time to confirm after receiving the timing message, and the accurate monitoring of the time-consuming application startup is achieved.
It improves the accuracy of determining the actual startup time of the user interface window, and reduces the difficulty of relevant data analysis and code maintenance.
Smart Images

Figure CN120276946A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a method, device, electronic device, and computer-readable medium for monitoring time consumption. Background Art
[0002] Currently, the existing monitoring solutions for the startup time consumption of the end-user interface are mainly divided into the following two types:
[0003] Performance analysis tools capture specific events and their related data that occur in the application through third-party tools. By recording these events, developers can analyze the time, sequence, and time consumption when the events occur. It is necessary to rely on third-party tools, which are not suitable for long-term monitoring of applications in the production environment, and the performance data of performance analysis tools are often huge and complex, and developers need to spend a considerable amount of time and effort to interpret and understand these data.
[0004] Timestamp insertion. Developers can directly insert code into the source code of the application to record timestamps. To insert timestamps, developers usually need to modify the source code or insert additional code at key nodes. This may lead to an increase in code complexity, a decrease in readability, and an increase in the difficulty of maintenance. And this solution can only monitor the time consumption at the level of its own code and cannot monitor the time consumption from the application startup to when the user can actually operate the user interface window. Summary of the Invention
[0005] In view of this, embodiments of the present application provide a method, device, electronic device, and computer-readable medium for monitoring time consumption, which can solve the problems of inaccurate monitoring of the actual startup time consumption of the user interface window, large difficulty in analyzing relevant data, and large difficulty in code maintenance in existing traditional monitoring solutions.
[0006] To achieve the above object, according to one aspect of the embodiments of the present application, a method for monitoring time consumption is provided, including:
[0007] In response to the startup of a target program, determine the corresponding target process;
[0008] When it is detected that the target process creates a window for the first time, obtain the corresponding window operation message;
[0009] Call the registered callback function to perform message verification based on the window operation message. In response to the message verification passing, execute the timed message delivery process, and then register the callback function of the timed message;
[0010] In response to receiving the timed message, trigger the call of the callback function of the timed message to perform time consumption confirmation, and then obtain the application startup time consumption.
[0011] Optionally, obtaining the corresponding window operation message includes:
[0012] Obtain window operation messages whose triggering order is after the target process first creates a window and before the created window is actually displayed on the screen.
[0013] Optionally, call a registered callback function to perform message verification based on the window operation message, including:
[0014] Call the registered callback function to check whether the window operation message is a window operation message whose triggering order is after the target process first creates a window and before the created window is actually displayed on the screen. If so, determine that the message verification passes; otherwise, determine that the message verification fails.
[0015] Optionally, execute a timed message delivery process, including:
[0016] Obtain the message queue corresponding to when the target process first creates a window in real time;
[0017] Set the priority of the timed message to the lowest priority, and deliver the lowest-priority timed message to the message queue so that the timed message is always at the end of the message queue.
[0018] Optionally, trigger the callback function of the timed message to perform time-consuming confirmation, and then obtain the application startup time-consuming, including:
[0019] Call the callback function of the timed message to obtain the current time and the start time when the target process first creates a window;
[0020] Determine the application startup time-consuming according to the current time and the start time.
[0021] Optionally, determine the application startup time-consuming according to the current time and the start time, including:
[0022] Calculate the difference between the current time and the start time;
[0023] Determine the difference as the application startup time-consuming.
[0024] In addition, the present application also provides a time-consuming monitoring device, including:
[0025] A target process determination unit, configured to determine a corresponding target process in response to the startup of a target program;
[0026] An acquisition unit, configured to obtain a corresponding window operation message when it is monitored that the target process first creates a window;
[0027] A timed message delivery unit, configured to call a registered callback function to perform message verification based on the window operation message, and in response to the message verification passing, execute a timed message delivery process, and then register a callback function of the timed message;
[0028] The time-consuming confirmation unit is configured to, in response to receiving a timing message, trigger the invocation of the callback function of the timing message to perform time-consuming confirmation, thereby obtaining the application startup time-consuming.
[0029] Optionally, the obtaining unit is further configured to:
[0030] Obtain window operation messages whose trigger order is after the first window creation of the target process and before the created window is actually displayed on the screen.
[0031] Optionally, the timing message delivery unit is further configured to:
[0032] Invoke the registered callback function to check whether the window operation message is a window operation message whose trigger order is after the first window creation of the target process and before the created window is actually displayed on the screen. If so, determine that the message verification passes; if not, determine that the message verification fails.
[0033] Optionally, the timing message delivery unit is further configured to:
[0034] Obtain the message queue corresponding to the first window creation of the target process in real time;
[0035] Set the priority of the timing message to the lowest priority, and deliver the lowest priority timing message to the message queue, so that the timing message is always at the end position of the message queue.
[0036] Optionally, the time-consuming confirmation unit is further configured to:
[0037] Invoke the callback function of the timing message to obtain the current time and the start time of the first window creation of the target process;
[0038] Determine the application startup time-consuming according to the current time and the start time.
[0039] Optionally, the time-consuming confirmation unit is further configured to:
[0040] Calculate the difference between the current time and the start time;
[0041] Determine the difference as the application startup time-consuming.
[0042] In addition, the present application also provides a time-consuming monitoring electronic device, including: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the time-consuming monitoring method as described above.
[0043] In addition, the present application also provides a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the time-consuming monitoring method as described above is implemented.
[0044] One embodiment of the above invention has the following advantages or beneficial effects: In this application, upon detecting the startup of a target program, the corresponding target process is determined; when it is monitored that the target process creates a window for the first time, the corresponding window operation message is obtained; the registered callback function is called to perform message verification based on the window operation message, and upon successful message verification, the timed message delivery process is executed, and then the callback function of the timed message is registered; upon receiving the timed message, the callback function of the timed message is triggered to perform time-consuming confirmation, thereby obtaining the startup time consumption of the application. By monitoring the time consumption of the target process to create a window through the target program started in the plugin and the delivered timed message, the accuracy of determining the actual startup time consumption of the user interface window is improved, and the difficulty of relevant data analysis and code maintenance is reduced.
[0045] The further effects of the above non-conventional optional methods will be described in conjunction with specific embodiments below. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings are used to better understand the present application and do not unduly limit the present application. Among them:
[0047] Figure 1 is a schematic diagram of the main process of the time consumption monitoring method provided by an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of the main process of the time consumption monitoring method provided by an embodiment of the present application;
[0049] Figure 3 is a schematic diagram of the main process of the time consumption monitoring method provided by an embodiment of the present application;
[0050] Figure 4 is a schematic diagram of the main units of the time consumption monitoring device according to an embodiment of the present application;
[0051] Figure 5 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;
[0052] Figure 6 is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0053] The following describes exemplary embodiments of the present application in conjunction with the accompanying drawings. Various details of the embodiments of the present application are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that in the technical solutions of the present disclosure, in terms of the collection, collection, update, analysis, processing, use, transmission, storage, etc. of user personal information, they all comply with the provisions of relevant laws and regulations, are used for legal purposes, and do not violate public order and good customs. Necessary measures are taken for user personal information to prevent illegal access to user personal information data, and to maintain the security of user personal information, network security, and national security.
[0054] Figure 1 is a schematic diagram of the main process of the time-consuming monitoring method provided by an embodiment of the present application, as Figure 1 shown, the time-consuming monitoring method includes:
[0055] Step S101, in response to the startup of the target program, determine the corresponding target process.
[0056] In this embodiment, the execution subject of the time-consuming monitoring method (for example, a plugin in the terminal) can detect in real time whether the target program in the plugin is started. When the user clicks a certain button or program in the terminal, it triggers the startup of the target program in the plugin to start monitoring the application startup time-consuming corresponding to the user's click operation. In the embodiments of the present application, the target program refers to a program running in the plugin of the terminal that is used to monitor the actions of the process, the user's input, the generation and consumption of messages, so as to finally confirm the application startup time-consuming.
[0057] After the execution subject detects the startup of the target program, it can determine the process corresponding to a certain button or program clicked by the user in the terminal as the target process.
[0058] Step S102, when it is detected that the target process creates a window for the first time, obtain the corresponding window operation message.
[0059] Specifically, obtaining the corresponding window operation message includes: obtaining the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen.
[0060] When the execution subject detects that the target process creates a window for the first time, it can select the message for operating on the window whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the terminal screen as the window operation message, such as the window creation message, window activation message, etc.
[0061] Exemplarily, the execution entity can obtain the messages that need to operate on the window from the time when the target process first starts to create a window until the window is officially created and displayed on the terminal for the user to operate, as window operation messages. It can be understood that the window being displayed on the terminal for the user to operate indicates that the application has been successfully started, and the window is in an idle state where the user can input. By obtaining the messages that need to operate on the window from the time when the target process first starts to create a window until the window is officially created and displayed on the terminal for the user to operate, as window operation messages, the startup time of the application can be accurately determined.
[0062] Step S103: Call the registered callback function to perform message verification based on the window operation message. In response to the message verification passing, execute the timed message delivery process, and then register the callback function for the timed message.
[0063] Specifically, calling the registered callback function to perform message verification based on the window operation message includes: calling the registered callback function to check whether the window operation message is a window operation message whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen. If so, it is determined that the message verification passes; otherwise, it is determined that the message verification fails.
[0064] The execution entity checks through the registered callback function whether the obtained window operation message is a message between the start of window creation and the window being able to be displayed on the terminal for the user to operate, to ensure the accuracy and rationality of the message used to determine the startup time of the application, thereby ensuring the accuracy of determining the startup time of the application.
[0065] Step S104: In response to receiving the timed message, trigger the callback function of the timed message to perform elapsed time confirmation, and then obtain the startup time of the application.
[0066] Specifically, triggering the callback function of the timed message to perform elapsed time confirmation, and then obtaining the startup time of the application, includes: calling the callback function of the timed message to obtain the current time and the start time when the target process first creates a window; determining the startup time of the application according to the current time and the start time.
[0067] Specifically, determining the startup time of the application according to the current time and the start time includes: calculating the difference between the current time and the start time; determining the difference as the startup time of the application.
[0068] The startup time of the application is the actual time taken for the user interface window of the terminal application to go from start creation to an idle state where the user can input.
[0069] In this embodiment, upon detecting the startup of a target program, the corresponding target process is determined; when it is monitored that the target process creates a window for the first time, the corresponding window operation message is obtained; a registered callback function is called to perform message verification based on the window operation message, and upon successful message verification, a timed message delivery process is executed, and then a callback function for the timed message is registered; upon receiving the timed message, the callback function for the timed message is triggered to execute time-consuming confirmation, and thus the startup time of the application is obtained. By means of the target program started in the plugin and the delivered timed message, the monitoring of the time consumed for the target process to create a window is realized, thereby improving the accuracy of determining the actual startup time of the user interface window and reducing the difficulty of relevant data analysis and code maintenance.
[0070] Figure 2 is a schematic diagram of the main process of the time-consuming monitoring method provided by an embodiment of the present application, as Figure 2 shown, the time-consuming monitoring method includes:
[0071] Step S201: Upon detecting the startup of a target program, determine the corresponding target process.
[0072] The embodiment of the present application can be applied to the scenario of detecting the startup time of the terminal user interface. The target program is a program in the plugin for monitoring messages, user inputs, and process actions. The target process is the process corresponding to a certain program in the terminal that is clicked or evoked by voice by the user.
[0073] Step S202: When it is monitored that the target process creates a window for the first time, obtain the corresponding window operation message.
[0074] The window operation message is a message that needs to operate on the window during the period from the start of window creation to the completion of window creation and its being put into use. By consuming these messages that operate on the window, the creation of the window and its being put into use are completed.
[0075] Among them, consuming these messages that operate on the window to complete the creation of the window and its being put into use includes: creating the window correspondingly according to the window control attribute information, window element layout information, etc. in the message that operates on the window to obtain a created window and put it into use. Among them, the window control attribute information may include information such as the type of window control, the size of the window control, and the color of the window control. The window element layout information may include information such as the relative position of window elements, the number of window elements, and the embedding method of window elements. Window elements may include window controls.
[0076] Step S203: Call the registered callback function to perform message verification based on the window operation message.
[0077] In the plugin, callback functions are pre-registered to verify whether the obtained message is the expected message. For example, the expected message is a window operation message whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen in the embodiments of the present application. This is to accurately determine the startup time of the application.
[0078] Step S204, in response to the message verification passing, obtain the message queue corresponding to when the target process first creates a window in real time.
[0079] Message verification refers to verifying whether the obtained window operation message is a window operation message whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen. When the execution entity determines that the message verification passes (that is, the obtained window operation message is a window operation message whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen), execute the timed message delivery process.
[0080] Specifically, when the execution entity executes the timed message delivery process, it can obtain the message queue composed of the messages required when the target process first creates a window. The messages required to create a window in the message queue can be sorted according to the functions that the window can sequentially implement, so that the target process can consume the messages arranged in sequence to create a window, thereby accurately creating the corresponding window.
[0081] Step S205, set the priority of the timed message to the lowest priority, and deliver the timed message with the lowest priority to the message queue, so that the timed message is always at the last position in the message queue.
[0082] Set the priority of the timed message to the lowest priority and deliver it to the message queue, so that the timed message is always at the last position in the message queue, to implement the monitoring of whether the message queue is completely consumed, thereby accurately calculating the startup time of the application.
[0083] Step S206, in response to receiving the timed message, trigger the callback function of the timed message to perform the time-consuming confirmation, and then obtain the startup time of the application.
[0084] When the execution entity receives the timed message, it indicates that all the messages related to creating a window in the message queue have been consumed and processed. Obtain the current time at this time, and obtain the start time when the target process first creates a window. Subtract the start time from the current time to obtain the startup time of the application.
[0085] Figure 3It is a schematic diagram of the main process of the time-consuming monitoring method provided by an embodiment of the present application. The time-consuming monitoring method of the embodiment of the present application is applied to the scenario of detecting the startup time of the terminal user interface. In the embodiment of the present application, Timer is a message-based timer.
[0086] As Figure 3 shown, in response to detecting the program startup, trigger the registration of the window message callback event to register the window message callback function at the code entry of the target process that needs to monitor the application startup time-consuming. And when it is detected that the target process creates a window, trigger the callback of the registered callback function to check whether the obtained message is the expected message. The expected message is, for example, the window operation message in the embodiment of the present application whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen. If it is checked that it is not the expected message, end the time-consuming monitoring; if it is checked that it is the expected message, register the message-based timer Timer event callback (that is, register the callback function of the timed message), and post a low-priority message-based timer Timer message (that is, the timed message) to the created window and register the Timer callback function of this Timer message (that is, register the callback function of the timed message), return to execute the business logic of creating the window, after receiving the message-based timer Timer message (that is, receiving the timed message), call the Timer callback function of the message-based timer Timer to obtain the process creation time of creating the window and record the current time, and then determine the actual time-consuming based on the process creation time and the current time and end the process.
[0087] Exemplarily, taking Windows as an example, the detailed process of monitoring the startup time of the user interface (UI) window of the terminal application is as follows:
[0088] (1) At the code entry of the program that needs to monitor the startup time of its user interface (UI) window, register the window message callback function (the expected message is: the message whose trigger order is after creating the window and before the window is actually displayed on the screen, such as the window creation message, the window activation message);
[0089] (2) When the current process first creates a window, the callback function registered in step (1) will be called. In this callback function, first check whether it is the above-mentioned expected message. If so, post a low-priority Timer message (that is, the timed message) to the current window, and at the same time register the callback function of this Timer message (that is, the timed message).
[0090] (3) When the window is in the idle state where the user can input, the Timer callback function registered in step (2) will be called. In this callback function, the process creation time T1 is obtained, and at the same time the current time T2 is obtained. Then, the actual time consumption from the process creation to the window being in the idle state where the user can input can be calculated by T2 - T1.
[0091] In the embodiments of the present application, UI: user interface; window: the window and dialog box of the application; message: Windows window message; Timer: message-based timer. Regarding the technical point of detecting the window idle based on the Timer message, since the priority of this message is the lowest among all messages, when a Timer message is sent to the window during its creation, it will always be at the end of the queue until all window messages are processed. At this time, this message will be received and the window is already in the idle state, that is, in the state of being able to receive user input.
[0092] Figure 4 It is a schematic diagram of the main unit of the time consumption monitoring device according to the embodiments of the present application. As Figure 4 shown, the time consumption monitoring device 400 includes a target process determination unit 401, an acquisition unit 402, a timed message delivery unit 403, and a time consumption confirmation unit 404.
[0093] The target process determination unit 401 is configured to determine the corresponding target process in response to the start of the target program.
[0094] The acquisition unit 402 is configured to obtain the corresponding window operation message when it is detected that the target process creates a window for the first time.
[0095] The timed message delivery unit 403 is configured to call the registered callback function to perform message verification based on the window operation message. In response to the message verification passing, it executes the timed message delivery process and further registers the callback function of the timed message.
[0096] The time consumption confirmation unit 404 is configured to trigger the call of the callback function of the timed message to perform time consumption confirmation in response to receiving the timed message, and thus obtain the application startup time consumption.
[0097] In some embodiments, the acquisition unit 402 is further configured to: obtain the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen.
[0098] In some embodiments, the timed message delivery unit 403 is further configured to: call the registered callback function to check whether the window operation message is the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen. If so, it determines that the message verification passes; if not, it determines that the message verification fails.
[0099] In some embodiments, the timed message delivery unit 403 is further configured to: obtain in real time the message queue corresponding to the target process when the first creation window occurs; set the priority of the timed message to the lowest priority, and deliver the timed message with the lowest priority to the message queue, so that the timed message always remains at the end of the message queue.
[0100] In some embodiments, the time-consuming confirmation unit 404 is further configured to: call the callback function of the timed message to obtain the current time and the start time of the first creation window of the target process; determine the time consumed for the application startup according to the current time and the start time.
[0101] In some embodiments, the time-consuming confirmation unit 404 is further configured to: calculate the difference between the current time and the start time; determine the difference as the time consumed for the application startup.
[0102] It should be noted that the time-consuming monitoring method and the time-consuming monitoring device of the present application have corresponding relationships in the specific implementation content, so the repeated content will not be described again.
[0103] Figure 5 An exemplary system architecture 500 to which the time-consuming monitoring method or the time-consuming monitoring device of the embodiments of the present application can be applied is shown.
[0104] As Figure 5 shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0105] Users can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0106] The terminal devices 501, 502, 503 may be various electronic devices with a time-consuming monitoring processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0107] The server 505 may be a server that provides various services, such as a background management server (only for example) that supports the target program detected by the user using the terminal devices 501, 502, and 503 to start. The background management server may determine the corresponding target process in response to the start of the target program; when it monitors that the target process creates a window for the first time, it obtains the corresponding window operation message; calls the registered callback function to perform message verification based on the window operation message, and in response to the message verification passing, executes the timed message delivery process, and then registers the callback function of the timed message; in response to receiving the timed message, triggers the call of the callback function of the timed message to perform the time-consuming confirmation, and then obtains the application start-up time-consuming. By monitoring the time-consuming of the target process to create a window through the target program started in the plug-in and the timed message delivered, the accuracy of determining the actual start-up time-consuming of the user interface window is improved, and the difficulty of relevant data analysis and code maintenance is reduced.
[0108] It should be noted that the time-consuming monitoring method provided by the embodiments of the present application is generally executed by the server 505. Correspondingly, the time-consuming monitoring device is generally set in the server 505.
[0109] It should be understood that Figure 5 the numbers of the terminal devices, networks, and servers in
[0110] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 6 is a schematic structural diagram of a computer system 600 of a terminal device suitable for implementing the embodiments of the present application. Figure 6 The terminal device shown is merely an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0111] As Figure 6 shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0112] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 610 as required so that a computer program read therefrom is installed into the storage section 608 as required.
[0113] Specifically, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product including a computer program carried on a computer-readable medium, the computer program including program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network via the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, the above-described functions defined in the system of the present application are performed.
[0114] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can, for example, include but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in conjunction with an instruction execution system, apparatus, or device. And in this application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0115] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0116] The units involved in the embodiments of the present application can be implemented in software or in hardware. The described units can also be provided in a processor. For example, it can be described as: a processor includes a target process determination unit, an acquisition unit, a timed message delivery unit, and a time-consuming confirmation unit. Among them, the names of these units do not constitute a limitation on the units themselves in some cases.
[0117] As another aspect, the present application also provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiments; it can also exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device determines a corresponding target process in response to the startup of the target program; when it monitors that the target process creates a window for the first time, it acquires the corresponding window operation message; calls the registered callback function to perform message verification based on the window operation message, and in response to the message verification passing, executes a timed message delivery process, and then registers a callback function for the timed message; in response to receiving the timed message, triggers the call of the callback function of the timed message to perform time-consuming confirmation, and then obtains the startup time-consuming of the application.
[0118] According to the technical solution of the embodiments of the present application, the monitoring of the time-consuming for the target process to create a window is realized through the target program started in the plugin and the timed message delivered, so as to improve the accuracy of determining the actual startup time-consuming of the user interface window, and reduce the difficulty of relevant data analysis and code maintenance.
[0119] The above specific implementation manners do not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present application shall be included within the protection scope of the present application.
Claims
1. A time-consuming monitoring method, characterized in that, Including: Upon the startup of a target program, determine the corresponding target process; When it is monitored that the target process creates a window for the first time, obtain the corresponding window operation message; Call the registered callback function to perform message verification based on the window operation message. In response to successful message verification, execute the timed message delivery process, and then register the callback function for the timed message; In response to receiving the timed message, trigger the call of the callback function of the timed message to perform time-consuming confirmation, and then obtain the application startup time consumption.
2. The method according to claim 1, characterized in that The obtaining of the corresponding window operation message includes: Obtain the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen.
3. The method according to claim 1, wherein The calling of the registered callback function to perform message verification based on the window operation message includes: Call the registered callback function to check whether the window operation message is the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen. If so, determine that the message verification is passed; otherwise, determine that the message verification fails.
4. The method according to claim 1, characterized in that The execution of the timed message delivery process includes: Obtain the message queue corresponding to the time when the target process creates a window for the first time in real time; Set the priority of the timed message to the lowest priority, and deliver the timed message with the lowest priority to the message queue, so that the timed message is always at the end of the message queue.
5. The method according to any one of claims 1 to 4, characterized in that The triggering of the call of the callback function of the timed message to perform time-consuming confirmation and then obtain the application startup time consumption includes: Call the callback function of the timed message to obtain the current time and the start time when the target process creates a window for the first time; Determine the application startup time consumption according to the current time and the start time.
6. The method according to claim 5, characterized in that The determining of the application startup time consumption according to the current time and the start time includes: Calculate the difference between the current time and the start time; Determine the difference as the application startup time consumption.
7. A time-consuming monitoring device, characterized in that, Including: A target process determination unit, configured to determine the corresponding target process in response to the startup of a target program; An obtaining unit, configured to obtain the corresponding window operation message when it is monitored that the target process creates a window for the first time; A timed message delivery unit, configured to call the registered callback function to perform message verification based on the window operation message. In response to successful message verification, execute the timed message delivery process, and then register the callback function for the timed message; A time-consuming confirmation unit, configured to trigger the call of the callback function of the timed message to perform time-consuming confirmation in response to receiving the timed message, and then obtain the application startup time consumption.
8. The device according to claim 7, characterized in that, The obtaining unit is further configured to: Obtain the window operation message whose trigger order is after the target process creates a window for the first time and before the created window is actually displayed on the screen.
9. The device according to claim 7, characterized in that, The timed message delivery unit is further configured to: Call the registered callback function to check whether the window operation message is a window operation message whose trigger order is after the target process first creates a window and before the created window is actually displayed on the screen. If so, determine that the message verification passes; otherwise, determine that the message verification fails.
10. The device according to claim 7, wherein The timing message delivery unit is further configured to: Obtain in real time the message queue corresponding to when the target process first creates a window; Set the priority of the timing message to the lowest priority, and deliver the timing message with the lowest priority to the message queue, so that the timing message is always at the last position of the message queue.
11. The device according to any one of claims 7 to 10, characterized in that The time-consuming confirmation unit is further configured to: Call the callback function of the timing message to obtain the current time and the start time when the target process first creates a window; Determine the application startup time-consuming according to the current time and the start time.
12. The device according to claim 11, characterized in that, The time-consuming confirmation unit is further configured to: Calculate the difference between the current time and the start time; Determine the difference as the application startup time-consuming.
13. A time-consuming monitoring electronic device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-6.
14. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method according to any one of claims 1-6.