A monitoring method, device, equipment and storage medium for application startup

By monitoring the running time points of each preset method during application startup process in real time, and dividing and analyzing the duration of the application startup stage, the problem that the existing technology cannot accurately monitor and analyze the application startup process is solved, and the precise optimization of application startup performance and improvement of user experience is achieved.

CN114048094BActive Publication Date: 2025-05-13BONREE DATA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111298229.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-04
Publication Date
2025-05-13
Estimated Expiration
2041-11-04

AI Technical Summary

Technical Problem

The existing application startup process analysis methods can only obtain the time-consuming execution of some methods through monitoring the life cycle, and cannot achieve accurate monitoring and analysis of the entire application startup process.

Method used

When the application startup monitoring conditions are detected, the operation of each preset method is monitored in real time, and the operation start time point and the operation end time point of each preset method are obtained, the duration of each preset application startup stage is determined, and the startup status of the target application is determined based on the duration of each preset application startup stage is determined.

Benefits of technology

It realizes accurate acquisition of time-consuming situations at each stage of the application startup process, can accurately monitor and analyze the entire application startup process, and provides targeted optimization suggestions to improve application startup performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114048094B_ABST
    Figure CN114048094B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a monitoring method, device, equipment and storage medium for application startup, the method comprising: when it is detected that the application startup monitoring conditions are met, real-time monitoring of the operation status of each preset method is performed to obtain the operation start time point and the operation end time point of each preset method; and according to the operation start time point and the operation end time point of each preset method, the duration of each preset application startup phase is determined; according to the duration of each preset application startup phase, the startup status of the target application is determined. The technical solution of the embodiment of the present invention can realize accurate monitoring of the complete application startup process by dividing the application startup process into multiple preset application startup phases, and by monitoring the operation status of each preset method, the time consumption of each preset application startup phase is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a monitoring method, device, equipment and storage medium for application startup. Background Art

[0002] Application startup performance is an important indicator that affects the user experience of mobile applications. Performing performance analysis of the application startup process and then optimizing the application startup process in a targeted manner are of great significance to improving the user experience.

[0003] At present, the existing application startup process analysis methods are usually based on rewriting the life cycle provided by the system to obtain the time consumption of the application startup process to achieve a simple analysis of the application startup process. However, by simply monitoring the life cycle, only the execution time of some methods can be simply obtained, and it is impossible to monitor and analyze the entire application startup process. Summary of the invention

[0004] The embodiments of the present invention provide a method, apparatus, device and storage medium for monitoring application startup, which can accurately obtain the time consumption of each stage in the application startup process and realize accurate monitoring of the application startup process.

[0005] In a first aspect, an embodiment of the present invention provides a method for monitoring application startup, comprising:

[0006] When it is detected that the application startup monitoring conditions are met, the operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method;

[0007] Determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method;

[0008] The preset application startup phase includes at least one running start time point or running end time point of a preset method;

[0009] The startup status of the target application is determined according to the duration of each preset application startup phase.

[0010] In a second aspect, an embodiment of the present invention further provides a monitoring device for application startup, including:

[0011] The method operation monitoring module is used to monitor the operation status of each preset method in real time when it is detected that the application startup monitoring conditions are met, and obtain the operation start time point and the operation end time point of each preset method;

[0012] An application startup phase duration determination module, used to determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method;

[0013] The preset application startup phase includes at least one running start time point or running end time point of a preset method;

[0014] The startup status determination module is used to determine the startup status of the target application according to the duration of the startup phase of each preset application.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] A storage device for storing one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors execute the application startup monitoring method provided by any embodiment of the present invention.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the application startup monitoring method provided by any embodiment of the present invention.

[0020] The technical solution provided by the embodiment of the present invention monitors the operation status of each preset method in real time when it is detected that the application startup monitoring conditions are met, and obtains the operation start time point and the operation end time point of each preset method; and determines the duration of each preset application startup phase according to the operation start time point and the operation end time point of each preset method; determines the startup status of the target application according to the duration of each preset application startup phase; divides the application startup process into multiple preset application startup phases, and obtains the time consumption of each preset application startup phase by monitoring the operation status of each preset method, thereby realizing accurate monitoring of the complete application startup process. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 is a flow chart of a method for monitoring application startup in one embodiment of the present invention;

[0022] Figure 2A is a flow chart of a method for monitoring application startup in another embodiment of the present invention;

[0023] Figure 2B is a schematic diagram of a monitoring chart for application startup in another embodiment of the present invention;

[0024] Figure 3is a schematic structural diagram of a monitoring device for application startup in another embodiment of the present invention;

[0025] Figure 4 It is a structural schematic diagram of an electronic device in another embodiment of the present invention. DETAILED DESCRIPTION

[0026] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0027] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.

[0032] Figure 1This is a flow chart of a method for monitoring application startup provided by an embodiment of the present invention. The embodiment of the present invention is applicable to the case of monitoring the complete application startup process. The method can be executed by an application startup monitoring device, which can be composed of hardware and / or software and can generally be integrated in an electronic device, typically, in a terminal device or a server. Figure 1 As shown, the method specifically comprises the following steps:

[0033] S110. When it is detected that the application startup monitoring condition is met, the operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method.

[0034] The application startup monitoring condition is pre-set condition information for starting application startup monitoring. In this embodiment, when it is detected that the application startup monitoring condition is met, startup monitoring for the target application is started. The target application may include an Android system application.

[0035] It is understandable that the startup of an application under the operating system includes two types: cold startup and hot startup. Among them, a cold startup means that there is no process of the current application in the system background, and the system creates a process for the first time and assigns it to the current application; or, the process previously assigned to the current application has been killed, and a new process is currently created for the application. A hot startup means that when the current application is started, the system background already has a process of the application, and the process has not been killed, so it only needs to re-enter the foreground.

[0036] In order to accurately monitor the application startup process in both of the above application startup scenarios, in this embodiment, the application startup monitoring conditions may include the creation of the target application process or the start of the target method. The target method may include the creation method of the first Activity.

[0037] It is understandable that when the target application is cold-started, the system background must create a new application process for the target application; therefore, when the creation of the target application process is detected, it can be determined that the current target application has started a cold start. When the target application is hot-started, it does not need to go through application preparation and can directly load and display the first Actiity. In the life cycle of an Actiity, the first thing to do is to create an Actiity; therefore, when it is detected that the creation method of the first Actiity starts to run, and the creation of the target application process has not been detected before, it can be determined that the current target application has started a hot start.

[0038] In the implementation of this city, after detecting that the application startup monitoring conditions are met, the operation of each preset method is monitored in real time to obtain the running start time point and running end time point of each preset method; among them, the preset methods may include Application.attachBaseContext(), Application.onCreate(), MainActivity.onCreate() and MainActivity.onResume().

[0039] Take the cold start of an Android application as an example. In the complete startup process of an application, the Application is first created and initialized, and then the first Activity is created. Among them, Application is the entry point of the Android application, which is used to save global variables in the application process and corresponds to the application process one by one. Application.attachBaseContext() and Application.onCreate() are two callback functions of Application. Application.attachBaseContext() is executed before Application.onCreate(). Through the above two methods, the Application can be created and initialized.

[0040] Furthermore, after completing the creation and initialization of the Application, the first Activity can be created through the MainActivity.onCreate() method; MainActivity.onResume() indicates that the current Activity is already visible in the foreground and has started activity, which means that the creation of the first Activity has been completed.

[0041] It is worth noting that when the target application is hot-started, there is no need to create and initialize the Application, and the first Activity can be created directly.

[0042] S120: Determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method.

[0043] The preset application startup phase may include at least one running start time point or running end time point of a preset method. It is understandable that a preset application startup phase may correspond to the running start time point or running end time point of the same preset method, or may correspond to the running start time point or running end time point of different preset methods.

[0044] In this embodiment, the preset application startup phase may include at least two of the system preparation phase, the application preparation phase, the view loading phase, and the interaction preparation phase; wherein the system preparation phase indicates that the system starts to create an application process, that is, the time-consuming phase of creating an Application and allocating the corresponding application; the application preparation phase indicates that after the target application process is created and initialized, the internal initialization and other preparatory work begins to be performed; wherein the internal initialization work may include configuration initialization, basic service creation, and database operations.

[0045] The view loading phase indicates that the target application preparation phase has been completed and the first activity is loaded and displayed. In the view loading phase, the initialization of the user interface (UI) controls and the processing of data business logic can be performed. The interaction preparation phase refers to the phase from the start of view rendering to the completion of rendering.

[0046] In this embodiment, the correspondence between each preset application startup phase and the start time point and end time point of each preset method can be preset; for example, the application preparation phase can correspond to the phase between the creation of the target application process and the start time point of the operation of the Application.attach BaseContext() method; the application preparation phase can correspond to the phase between the start time point of the Application.attachBaseContext() method and the start time point of the Application.onCreate() method; the view loading phase can correspond to the phase between the start time point of the MainActivity.onCreate() method and the start time point of the MainActivity.onResume() method; the interaction preparation phase can correspond to the phase between the start time point of the MainActivity.onResume() method and the end time point of the MainActivity.onResume() method.

[0047] It should be noted that when the target application is cold started, the corresponding startup process of the target application will include the above four stages, namely, the system preparation stage, the application preparation stage, the view loading stage and the interaction preparation stage; and when the target application is hot started, since there is no need to create and initialize the Application, it only includes the view loading stage and the interaction preparation stage.

[0048] In this embodiment, after the start time point and the end time point of each preset method are obtained, the duration of each preset application startup phase can be obtained according to the correspondence between each preset application startup phase and the start time point and the end time point of each preset method. For example, the start time point of the MainActivity.onResume() method is 3:10:10 (3 hours, 10 minutes and 10 seconds), and the end time point of the MainActivity.onResume() method is 3:10:11 (3 hours, 10 minutes and 11 seconds), then it can be determined that the duration of the interaction preparation phase is 1 second.

[0049] It is worth noting that no business logic is executed in the system preparation phase and the application preparation phase, so the duration is mainly related to the performance of the mobile terminal device; for example, when the mobile terminal lacks memory or CPU resources, the corresponding system preparation phase and application preparation phase will take longer. Correspondingly, for the view loading phase, developers usually add business initialization logic in this phase. If the initialization logic is time-consuming, the duration of this phase will increase accordingly; and for the interaction preparation phase, application developers usually execute the business logic of view data processing in this phase. When there is a problem with the business logic of view data processing, the duration of this phase will increase accordingly.

[0050] In this embodiment, by dividing the application startup process into multiple preset application startup stages, and determining the duration of each preset application startup stage according to the start time point and end time point of each preset method, real-time monitoring of the time occupancy problem of each preset application startup stage during the application startup process can be achieved, so that developers can optimize the application startup process in a targeted manner, improve application startup performance, and enhance the user's application usage experience.

[0051] S130: Determine the startup status of the target application according to the duration of each preset application startup phase.

[0052] In this embodiment, after determining the duration of each preset application startup phase, each duration can be compared with the normal duration range of each preset application startup phase; if each duration is within the corresponding normal duration range, it can be determined that the current target application is started normally; and if there is a duration of a preset application startup phase that exceeds the corresponding normal duration range, it can be determined that the preset application startup phase is abnormally time-consuming, and the preset application startup phase can be optimized. For example, the normal duration range corresponding to the view loading phase should be 0.2-0.7 seconds. If it is detected that the target application is 0.5 seconds in this phase, it can be determined that the target application is started normally in this phase; and if the target application is 0.8 in this phase, which exceeds the corresponding normal duration range, it means that there is abnormal time consumption in this phase.

[0053] Optionally, the duration of each preset application startup phase can be added together to calculate the total startup duration of the target application; and the total startup duration can be compared with the standard total duration to determine whether the startup process of the target application is normal; specifically, if the total startup duration is greater than the standard total duration, it can be determined that the startup of the target application is abnormal; if the total startup duration is less than or equal to the standard total duration, it can be determined that the startup of the target application is normal.

[0054] The technical solution provided by the embodiment of the present invention monitors the operation status of each preset method in real time when it is detected that the application startup monitoring conditions are met, and obtains the operation start time point and the operation end time point of each preset method; and determines the duration of each preset application startup phase according to the operation start time point and the operation end time point of each preset method; determines the startup status of the target application according to the duration of each preset application startup phase; divides the application startup process into multiple preset application startup phases, and obtains the time consumption of each preset application startup phase by monitoring the operation status of each preset method, thereby realizing accurate monitoring of the complete application startup process.

[0055] Figure 2A A flowchart of a method for monitoring application startup provided by another embodiment of the present invention. This embodiment is based on the above technical solution and specifically introduces that when the target application is cold started, the startup process of the target application is accurately monitored. The method includes:

[0056] S210: When it is detected that the creation of the target application process is met, the current time point is obtained.

[0057] In this embodiment, when the target application is cold started, if the creation of the target application process is detected, it means that the current target application starts to start; at this time, the current time point is recorded and the monitoring of the target application startup process begins.

[0058] S220: Monitor the operation status of each preset method in real time, and obtain the operation start time point and the operation end time point of each preset method.

[0059] In an optional implementation of this embodiment, real-time monitoring of the running status of each preset method and obtaining the running start time point and the running end time point of each preset method may include:

[0060] When it is monitored that each preset method starts to run, the running start time point of each preset method is obtained through the thread running time detection method; when it is monitored that each preset method stops running, the running end time point of each preset method is obtained through the thread running time detection method.

[0061] Among them, the thread running time detection method is used to obtain the current time of the thread; in this embodiment, the thread running time detection method may include the SystemClock.currentThreadTimeMillis() method; by calling the SystemClock.currentThreadTimeMillis() method, the number of milliseconds that the thread is currently running can be returned.

[0062] In this embodiment, when it is monitored that each preset method starts to run or stops running, the running start time point and the running end time point of each preset method can be accurately obtained through a preset thread running time detection method.

[0063] S230: Determine the duration of each preset application startup phase according to the current time point, and the running start time point and the running end time point of each preset method.

[0064] In this embodiment, when the target application is cold started, it is necessary to jointly determine the duration of each preset application startup phase based on the current time point (the creation time of the target application process) and the running start time point and running end time point of each preset method.

[0065] Specifically, the duration of the system preparation phase can be determined according to the duration between the current time point and the start time point of the Application.attachBaseContext() method; the duration of the application preparation phase can be determined according to the duration between the start time point of the Application.attachBaseContext() method and the start time point of the Application.onCreate() method; the duration of the view loading phase can be determined according to the duration between the start time point of the MainActivity.onCreate() method and the start time point of the MainActivity.onResume() method; and the duration of the interaction preparation phase can be determined according to the duration between the start time point of the MainActivity.onResume() method and the end time point of the MainActivity.onResume() method.

[0066] Optionally, after determining the duration of each preset application startup phase, the duration of each preset application startup phase can be displayed in a chart, such as Figure 2B The chart may include the software development kit (SDK) version, the current startup type, and the startup time, and may also include the duration of each preset application startup phase.

[0067] It is worth noting that in order to monitor the complete application startup process, a longer monitoring time can be set, for example, 30 seconds; Figure 2B As shown, the application startup process is actually completed in about 3 seconds. By setting a longer application startup monitoring time, it can be ensured that the complete application startup process can still be monitored when an abnormally time-consuming process occurs.

[0068] S240. According to the duration of each preset application startup phase, in each preset application startup phase, obtain an abnormal application startup phase whose corresponding duration is greater than the standard duration.

[0069] Among them, the standard duration is the maximum normal duration of each preset application startup phase that is pre-set. It is understandable that since the system needs to perform different tasks in different preset application startup phases, the corresponding standard durations may be different for different preset application startup phases; for example, the standard duration corresponding to the system preparation phase may be 0.5 seconds, and the standard duration corresponding to the view loading phase may be 1 second. In addition, in order to increase the sensitivity of abnormal time-consuming detection, the standard duration corresponding to each preset application startup phase may be appropriately reduced to achieve accurate detection of abnormal application startup time consumption.

[0070] In this embodiment, after obtaining the duration of each preset application startup phase, each duration can be compared with the standard duration corresponding to each preset application startup phase; wherein, if the duration of a preset application startup phase is less than the corresponding standard duration, it can be determined that the preset application startup phase is in a normal state; and if the duration of a preset application startup phase is greater than the corresponding standard duration, it can be determined that the preset application startup phase is abnormally time-consuming, and the preset application startup phase can be marked as an abnormal application startup phase.

[0071] S250: Determine the abnormal startup reason of the target application according to the abnormal application startup stage, and send a warning message to the user based on the abnormal startup reason.

[0072] It should be noted that, when dividing the startup stages of each preset application, the tasks that need to be performed in each stage of the application startup process are comprehensively considered, that is, each preset application startup stage has corresponding tasks that need to be performed; therefore, when a preset application startup stage is abnormally time-consuming, it means that the corresponding task that needs to be performed in this stage is abnormal, and the cause of the abnormal startup can be determined.

[0073] In this embodiment, a correspondence between each preset application startup stage and the abnormal startup cause can be established in advance; thus, after determining the abnormal application startup stage, the matching abnormal startup cause can be found in the above correspondence according to the abnormal application startup stage, thereby achieving efficient determination of the abnormal startup cause.

[0074] Among them, after determining the abnormal startup reason of the target application, an alarm message can also be sent to the user based on the abnormal startup reason; wherein the alarm message may include the preset application startup stage with abnormal time consumption, the actual time consumption of this stage and the possible abnormal startup reason.

[0075] In this embodiment, by sending an alarm message including the cause of the abnormal startup to the user, the application developer can quickly determine the abnormal application startup stage and the cause of the abnormal startup based on the alarm message, and can achieve targeted optimization of the abnormal application startup stage, thereby improving the optimization efficiency of the application startup performance.

[0076] In an optional implementation of this embodiment, determining the abnormal startup cause of the target application according to the abnormal application startup phase may include:

[0077] When the abnormal application startup phase is the system preparation phase or the application preparation phase, the abnormal startup cause is determined to be the lack of system memory; when the abnormal application startup phase is the view loading phase, the abnormal startup cause is determined to be the business initialization logic exception; and when the abnormal application startup phase is the interaction preparation phase, the abnormal startup cause is determined to be the view processing logic exception.

[0078] Among them, the duration of the system preparation stage and the application preparation stage is mainly affected by the performance of the operating system and the terminal device (for example, a mobile phone) itself; for example, if the terminal device does not have sufficient memory or lacks central processing unit resources, the duration corresponding to the above two stages will increase accordingly; therefore, when the abnormal application startup stage is the above two stages, it can be determined that the cause of the abnormal startup is the lack of system memory.

[0079] As for the view loading stage and interaction preparation stage, they are mainly affected by the application execution logic; developers can reduce the duration of the corresponding two stages by optimizing the application execution logic; specifically, in the view loading stage, the initialization logic of the application business is mainly executed. If there is an abnormal time consumption in the view loading stage, it can be determined that the corresponding abnormal startup cause is the abnormal business initialization logic. In the interaction preparation stage, the view processing logic is mainly executed; therefore, when there is an abnormal time consumption in the interaction preparation stage, it can be determined that the corresponding abnormal startup cause is the view processing logic abnormality.

[0080] In this embodiment, by establishing a correspondence between each preset application startup stage and the abnormal startup cause, the corresponding abnormal startup cause can be directly determined when the abnormal application startup stage is determined; then the developer can implement targeted optimization of the abnormal application startup stage according to the abnormal startup cause, which can improve the optimization efficiency of the application startup performance and enhance the user's application usage experience.

[0081] The technical solution provided by the embodiment of the present invention, when detecting the creation of a target application process, obtains the current time point, and monitors the operation status of each preset method in real time, obtains the operation start time point and the operation end time point of each preset method, and then determines the duration of each preset application startup phase according to the current time point, the operation start time point and the operation end time point of each preset method; and according to the duration of each preset application startup phase, obtains an abnormal application startup phase with a corresponding duration greater than the standard duration in each preset application startup phase; and according to the abnormal application startup phase, determines the abnormal startup cause of the target application, and based on the abnormal startup cause, sends an alarm message to the user; by dividing the application startup process into multiple preset application startup phases, accurate monitoring of the complete application startup process can be achieved; and then when it is detected that there is an abnormal application startup phase with an abnormal time-consuming abnormal application startup phase, the corresponding abnormal startup cause is determined, so that the developer can perform targeted optimization on the abnormal application startup phase according to the determined abnormal startup cause, which can improve the optimization efficiency of application startup performance and improve the user's application usage experience.

[0082] Figure 3 FIG. 1 is a schematic diagram of a monitoring device for application startup provided by another embodiment of the present invention. Figure 3 As shown, the device includes: a method operation monitoring module 310, an application startup phase duration determination module 320 and a startup status determination module 330. Among them,

[0083] The method operation monitoring module 310 is used to monitor the operation of each preset method in real time when it is detected that the application startup monitoring condition is met, and obtain the operation start time point and the operation end time point of each preset method;

[0084] The application startup phase duration determination module 320 is used to determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method;

[0085] The preset application startup phase includes at least one running start time point or running end time point of a preset method;

[0086] The startup status determination module 330 is used to determine the startup status of the target application according to the duration of each preset application startup phase.

[0087] The technical solution provided by the embodiment of the present invention monitors the operation status of each preset method in real time when it is detected that the application startup monitoring conditions are met, and obtains the operation start time point and the operation end time point of each preset method; and determines the duration of each preset application startup phase according to the operation start time point and the operation end time point of each preset method; determines the startup status of the target application according to the duration of each preset application startup phase; divides the application startup process into multiple preset application startup phases, and obtains the time consumption of each preset application startup phase by monitoring the operation status of each preset method, thereby realizing accurate monitoring of the complete application startup process.

[0088] Optionally, based on the above technical solution, the preset application startup phase includes at least two of a system preparation phase, an application preparation phase, a view loading phase and an interaction preparation phase.

[0089] Optionally, based on the above technical solution, the application startup monitoring condition includes the creation of a target application process or the start of running a target method.

[0090] Optionally, based on the above technical solution, the monitoring device for application startup further includes:

[0091] Time acquisition module, used to obtain the current time point;

[0092] The application startup phase duration determination module 320 is specifically used to determine the duration of each preset application startup phase according to the current time point, and the running start time point and the running end time point of each preset method.

[0093] Optionally, based on the above technical solution, the startup status determination module 330 includes:

[0094] an abnormal application startup phase determining unit, configured to obtain, according to the duration of each preset application startup phase, an abnormal application startup phase whose corresponding duration is greater than the standard duration in each preset application startup phase;

[0095] The abnormal startup reason determination unit is used to determine the abnormal startup reason of the target application according to the abnormal application startup stage, and send a warning message to the user based on the abnormal startup reason.

[0096] Optionally, based on the above technical solution, the abnormal startup cause determination unit is specifically used to determine that the abnormal startup cause is a lack of system memory when the abnormal application startup phase is a system preparation phase or an application preparation phase;

[0097] When the abnormal application startup phase is the view loading phase, determining that the abnormal startup cause is a business initialization logic exception; and

[0098] When the abnormal application startup phase is the interaction preparation phase, it is determined that the abnormal startup cause is a view processing logic exception.

[0099] Optionally, based on the above technical solution, the method runs the monitoring module 310, including:

[0100] An operation start time point acquisition unit is used to acquire the operation start time point of each preset method by a thread operation time detection method when monitoring that each preset method starts to run;

[0101] The operation termination time point acquisition unit acquires the operation termination time point of each preset method through a thread operation time detection method when monitoring that each preset method has terminated operation.

[0102] The above device can execute the application startup monitoring method provided by all the above embodiments of the present invention, and has the corresponding functional modules and beneficial effects of executing the above methods. For technical details not fully described in the embodiments of the present invention, please refer to the application startup monitoring method provided by all the above embodiments of the present invention.

[0103] Figure 4 A schematic diagram of the structure of an electronic device provided by another embodiment of the present invention is shown in FIG. Figure 4 As shown, the electronic device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of the processor 410 in the electronic device can be one or more. Figure 4 A processor 410 is taken as an example; the processor 410, the memory 420, the input device 430 and the output device 440 in the electronic device can be connected via a bus or other means. Figure 4 The example of connection via bus is taken. The memory 420, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to a monitoring method for application startup in any embodiment of the present invention (for example, a target method determination module 310, a target proxy function determination module 320 and an operation monitoring module 330 in a monitoring device for application startup). The processor 410 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 420, that is, implements the above-mentioned monitoring method for application startup. That is, when the program is executed by the processor, it implements:

[0104] When it is detected that the application startup monitoring conditions are met, the operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method;

[0105] Determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method;

[0106] The preset application startup phase includes at least one running start time point or running end time point of a preset method;

[0107] The startup status of the target application is determined according to the duration of each preset application startup phase.

[0108] The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the electronic device via a network.

[0109] Examples of the above network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The input device 430 may be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the electronic device, and may include a keyboard and a mouse, etc. The output device 440 may include a display device such as a display screen.

[0110] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any embodiment of the present invention is implemented. Of course, the computer-readable storage medium provided by the embodiment of the present invention can perform the relevant operations in the monitoring method for application startup provided by any embodiment of the present invention. That is, when the program is executed by the processor, it implements:

[0111] When it is detected that the application startup monitoring conditions are met, the operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method;

[0112] Determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method;

[0113] The preset application startup phase includes at least one running start time point or running end time point of a preset method;

[0114] The startup status of the target application is determined according to the duration of each preset application startup phase.

[0115] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it 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, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0116] It is worth noting that in the embodiment of the above-mentioned monitoring device initiated by an application, the various units and modules included are divided only according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0117] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for monitoring application startup, characterized in that: include: When it is detected that the application startup monitoring conditions are met, the operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method; Determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method; The preset application startup phase includes at least one running start time point or running end time point of a preset method; Determining the startup status of the target application according to the duration of each of the preset application startup phases; The step of determining the startup status of the target application according to the duration of each of the preset application startup phases includes: According to the duration of each preset application startup phase, in each preset application startup phase, an abnormal application startup phase whose corresponding duration is greater than the standard duration is obtained; According to the abnormal application startup stage, determining the abnormal startup cause of the target application, and based on the abnormal startup cause, issuing an alarm message to the user; wherein, by pre-establishing a correspondence between each preset application startup stage and the abnormal startup cause, according to the abnormal application startup stage, searching for a matching abnormal startup cause in the above correspondence; The warning information includes the preset application startup phase with abnormal time consumption, the actual time consumption of the phase, and the possible reasons for the abnormal startup; The preset application startup phase includes at least two of a system preparation phase, an application preparation phase, a view loading phase, and an interaction preparation phase; The determining the abnormal startup cause of the target application according to the abnormal application startup phase includes: When the abnormal application startup phase is a system preparation phase or an application preparation phase, determining that the abnormal startup cause is a lack of system memory; When the abnormal application startup phase is the view loading phase, determining that the abnormal startup cause is a business initialization logic exception; and When the abnormal application startup phase is the interaction preparation phase, it is determined that the abnormal startup cause is a view processing logic exception.

2. The method according to claim 1, characterized in that The application startup monitoring condition includes the creation of a target application process or the start of running a target method.

3. The method according to claim 2, characterized in that When the application startup monitoring condition is the creation of the target application process, before real-time monitoring of the running status of each preset method and obtaining the running start time point and the running end time point of each preset method, it also includes: Get the current time point, Determining the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method includes: The duration of each preset application startup phase is determined according to the current time point, and the running start time point and the running end time point of each preset method.

4. The method according to claim 1, characterized in that: The operation status of each preset method is monitored in real time to obtain the operation start time point and the operation end time point of each preset method, including: When it is monitored that each of the preset methods starts to run, the running start time point of each of the preset methods is obtained through a thread running time detection method; When it is monitored that each of the preset methods terminates execution, the execution termination time point of each of the preset methods is obtained through a thread execution time detection method.

5. A monitoring device for application startup, characterized in that: include: The method operation monitoring module is used to monitor the operation status of each preset method in real time when it is detected that the application startup monitoring conditions are met, and obtain the operation start time point and the operation end time point of each preset method; An application startup phase duration determination module, used to determine the duration of each preset application startup phase according to the running start time point and the running end time point of each preset method; The preset application startup phase includes at least one running start time point or running end time point of a preset method; A startup status determination module, used to determine the startup status of the target application according to the duration of the startup phase of each preset application; The startup situation determination module includes an abnormal application startup phase determination unit and an abnormal startup cause determination unit; The abnormal application startup phase determining unit is used to obtain, according to the duration of each preset application startup phase, an abnormal application startup phase whose corresponding duration is greater than the standard duration in each preset application startup phase; The abnormal startup cause determination unit is used to determine the abnormal startup cause of the target application according to the abnormal application startup stage, and send a warning message to the user based on the abnormal startup cause; wherein, by pre-establishing a correspondence between each preset application startup stage and the abnormal startup cause, according to the abnormal application startup stage, searching for a matching abnormal startup cause in the above correspondence; The warning information includes the preset application startup phase with abnormal time consumption, the actual time consumption of the phase, and the possible reasons for the abnormal startup; The preset application startup phase includes at least two of a system preparation phase, an application preparation phase, a view loading phase, and an interaction preparation phase; The abnormal startup cause determination unit is specifically configured to determine that the abnormal startup cause is a lack of system memory when the abnormal application startup phase is a system preparation phase or an application preparation phase; When the abnormal application startup phase is the view loading phase, determining that the abnormal startup cause is a business initialization logic exception; and When the abnormal application startup phase is the interaction preparation phase, it is determined that the abnormal startup cause is a view processing logic exception.

6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more computer programs; When the one or more computer programs are executed by the one or more processors, the one or more processors implement the application startup monitoring method as described in any one of claims 1 to 4 when executing the computer programs.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for monitoring application startup as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • BIOS (basic input / output system) program startup monitoring method and electronic device

    CN107992397A

  • System application detection method and device, terminal equipment and storage medium

    CN111352791A

  • Abnormal time consumption detection method and device, electronic equipment and storage medium

    CN112667317A