Application performance detection method and device, electronic equipment and storage medium

By using preset section expressions to collect and analyze multiple performance parameters in application performance detection, the problems of inefficiency and insufficient accuracy in the prior art are solved, and efficient and accurate performance detection is achieved.

CN120196526APending Publication Date: 2025-06-24BEIJING BAIDUPAY SCI & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510357059.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

The prior art is inefficient and has low accuracy in application performance detection, and requires inserting monitoring codes into each functional module to be monitored, resulting in complex programs and difficult to maintain.

Method used

During the operation of the target application, multiple performance parameters are collected based on preset section expressions, and performance analysis is performed in combination with exception discrimination thresholds to obtain performance detection results. The facet expression is used to indicate the identification of the method to be detected, and different methods correspond to different application functions.

Benefits of technology

Improve the efficiency and accuracy of performance detection, reduce the need to manually add performance detection codes in each method to be detected, realize automated performance detection, and enhance the accuracy of subsequent performance analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196526A_ABST
    Figure CN120196526A_ABST
Patent Text Reader

Abstract

The invention provides an application performance detection method and device, electronic equipment and a storage medium, and relates to the technical field of computers. In the application, in a running process of a target application, a plurality of performance parameters of the target application are collected based on a preset section expression, and a performance parameter collection result is obtained; wherein the section expression is used for indicating an identifier of at least one to-be-detected method included in the target application, and different to-be-detected methods correspond to different application functions; performing performance analysis on the target application on the basis of the performance parameter acquisition result and abnormal judgment thresholds set for the plurality of performance parameters to obtain a performance detection result; the performance detection result is used for indicating the performance problem existing in the target application at the current moment and / or the performance problem possibly existing in the future moment. Therefore, the efficiency and accuracy of performance detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technologies, and in particular, to an application performance detection method, apparatus, electronic device, and storage medium. Background Art

[0002] During the application development process for various operating systems (OS), application performance has always been a key concern for developers. With the increasing complexity of application functions, it has become increasingly difficult to accurately monitor and analyze the performance of applications.

[0003] Currently, the methods for detecting the performance of an application usually require inserting monitoring code into each function module to be monitored in the application (such as, a target method or target code). This method is not only inefficient, error-prone, but also makes the application program complex and difficult to maintain. That is, using the foregoing method, the efficiency and accuracy of performance detection are relatively low. Summary of the Invention

[0004] Embodiments of the present application provide an application performance detection method, apparatus, electronic device, and storage medium, so as to improve the efficiency and accuracy of performance detection.

[0005] In a first aspect, embodiments of the present application provide an application performance detection method, and the method includes:

[0006] During the running of a target application, collect multiple performance parameters of the target application based on a preset aspect expression to obtain a performance parameter collection result; wherein, the aspect expression is used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions;

[0007] Based on the performance parameter collection result and the exception discrimination thresholds respectively set for the multiple performance parameters, perform performance analysis on the target application to obtain a performance detection result; the performance detection result is used to indicate the performance problems existing at the current moment and / or the performance problems that may exist at a future moment of the target application.

[0008] In an optional embodiment, the aspect expression is created in the following manner:

[0009] Obtain the class information corresponding to multiple classes included in the target application; wherein, each class includes one or more methods set for the target application;

[0010] Perform aspect analysis for performance detection on the obtained multiple class information to obtain multiple aspect points, and create an aspect expression based on the multiple aspect points.

[0011] In an alternative embodiment, multiple performance parameters of a target application are collected based on a preset aspect expression to obtain a performance parameter collection result, including:

[0012] For at least one method to be detected in the aspect expression, the following operations are respectively performed:

[0013] Intercept the first method to be detected based on the call time of the first method to be detected; wherein, the first method to be detected is any one of the at least one method to be detected;

[0014] When successfully intercepting the call operation for the first method to be detected, add the performance parameter detection method corresponding to the first method to be detected, and collect multiple performance parameters based on the performance parameter detection method to obtain the performance parameter collection sub-result corresponding to the first method to be detected.

[0015] In an alternative embodiment, multiple performance parameters are collected based on the performance parameter detection method to obtain the performance parameter collection sub-result corresponding to the first method to be detected, including:

[0016] Determine the application program interfaces (APIs) respectively set for multiple performance parameters;

[0017] Collect multiple performance parameters based on the performance parameter detection method and multiple APIs to obtain the performance parameter collection sub-result corresponding to the first method to be detected.

[0018] In an alternative embodiment, performance analysis of the target application is performed based on the performance parameter collection result and the exception discrimination thresholds respectively set for multiple performance parameters, including:

[0019] For multiple performance parameters, the following operations are respectively performed:

[0020] Obtain the collection result of the first performance parameter from the performance parameter collection result; wherein, the first performance parameter is any one of the multiple performance parameters;

[0021] Based on the comparison result between the collection result of the first performance parameter and the exception discrimination threshold corresponding to the first performance parameter, determine whether there is a performance problem corresponding to the first performance parameter in the target application.

[0022] In an alternative embodiment, based on the comparison result between the collection result of the first performance parameter and the exception discrimination threshold corresponding to the first performance parameter, determine whether there is a performance problem corresponding to the first performance parameter in the target application, including:

[0023] Input the acquisition result of the first performance parameter and the anomaly discrimination threshold corresponding to the first performance parameter into a pre-trained performance problem discrimination model to obtain whether there is a performance problem corresponding to the first performance parameter for the target application at the current moment and / or future moments.

[0024] In an alternative embodiment, after performing performance analysis on the target application based on the performance parameter acquisition result and the anomaly discrimination thresholds respectively set for multiple performance parameters to obtain a performance detection result, it further includes:

[0025] Generate a first chart and / or first text information based on the performance detection result; wherein, the first chart is used to describe the application performance change of the target application during the running process of the target application, and the first text information includes a specific description of the performance problems existing in the target application;

[0026] Present a first interface; the first interface is used to display the first chart and / or the first text information.

[0027] In a second aspect, an embodiment of the present application further provides an application performance detection device, and the device includes:

[0028] A parameter acquisition module, configured to collect multiple performance parameters of the target application based on a preset aspect expression during the running process of the target application to obtain a performance parameter acquisition result; wherein, the aspect expression is used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions;

[0029] A performance detection module, configured to perform performance analysis on the target application based on the performance parameter acquisition result and the anomaly discrimination thresholds respectively set for multiple performance parameters to obtain a performance detection result; the performance detection result is used to indicate the performance problems existing in the target application at the current moment and / or the performance problems that may exist in the future.

[0030] In an alternative embodiment, the aspect expression is created by the parameter acquisition module in the following manner:

[0031] Obtain the class information corresponding to multiple classes included in the target application; wherein, each class includes one or more methods set for the target application;

[0032] Perform aspect pointcut analysis on the obtained multiple class information for performance detection to obtain multiple pointcuts, and create an aspect expression based on the multiple pointcuts.

[0033] In an alternative embodiment, when collecting multiple performance parameters of the target application based on a preset aspect expression to obtain a performance parameter acquisition result, the parameter acquisition module specifically is used for:

[0034] For at least one method to be detected in the aspect expression, the following operations are performed respectively:

[0035] Intercept the first method to be detected based on the call time of the first method to be detected; wherein, the first method to be detected is any one of the at least one method to be detected;

[0036] When successfully intercepting the call operation for the first method to be detected, add the performance parameter detection method corresponding to the first method to be detected, and collect multiple performance parameters based on the performance parameter detection method to obtain the performance parameter collection sub-result corresponding to the first method to be detected.

[0037] In an alternative embodiment, when collecting multiple performance parameters based on the performance parameter detection method to obtain the performance parameter collection sub-result corresponding to the first method to be detected, the parameter collection module is specifically used for:

[0038] Determine the APIs respectively set for multiple performance parameters;

[0039] Collect multiple performance parameters based on the performance parameter detection method and multiple APIs to obtain the performance parameter collection sub-result corresponding to the first method to be detected.

[0040] In an alternative embodiment, when performing performance analysis on the target application based on the performance parameter collection result and the exception discrimination thresholds respectively set for multiple performance parameters, the performance detection module is specifically used for:

[0041] For multiple performance parameters, the following operations are performed respectively:

[0042] Obtain the collection result of the first performance parameter from the performance parameter collection result; wherein, the first performance parameter is any one of the multiple performance parameters;

[0043] Based on the comparison result between the collection result of the first performance parameter and the exception discrimination threshold corresponding to the first performance parameter, determine whether the target application has a performance problem corresponding to the first performance parameter.

[0044] In an alternative embodiment, when determining whether the target application has a performance problem corresponding to the first performance parameter based on the comparison result between the collection result of the first performance parameter and the exception discrimination threshold corresponding to the first performance parameter, the performance detection module is specifically used for:

[0045] Input the collection result of the first performance parameter and the exception discrimination threshold corresponding to the first performance parameter into a pre-trained performance problem discrimination model to obtain whether the target application has a performance problem corresponding to the first performance parameter at the current moment and / or in the future.

[0046] In an alternative embodiment, after performing performance analysis on the target application based on the performance parameter collection results and the anomaly discrimination thresholds respectively set for multiple performance parameters to obtain performance detection results, the apparatus further includes a result display module, which is specifically configured to:

[0047] Generate a first chart and / or first text information based on the performance detection results; wherein, the first chart is used to describe the change in the application performance of the target application during the running process of the target application, and the first text information includes a specific description of the performance problems existing in the target application;

[0048] Present a first interface; the first interface is used to display the first chart and / or the first text information.

[0049] In a third aspect, an embodiment of the present application further provides an electronic device, including:

[0050] A processor; and

[0051] A memory storing a program,

[0052] wherein the program includes instructions that, when executed by the processor, cause the processor to execute the application performance detection method as described in the first aspect.

[0053] In a fourth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the application performance detection method as described in the first aspect.

[0054] In a fifth aspect, the present application provides a computer program product, which, when called by a computer, causes the computer to execute the steps of the application performance detection method as described in the first aspect.

[0055] The beneficial effects of the present application are as follows:

[0056] In the application performance detection method provided by the embodiment of the present application, during the running process of the target application, multiple performance parameters of the target application are collected based on a preset aspect expression to obtain performance parameter collection results; wherein, the aspect expression can be used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; based on the performance parameter collection results and the anomaly discrimination thresholds respectively set for multiple performance parameters, performance analysis is performed on the target application to obtain performance detection results; the performance detection results can be used to indicate the performance problems existing in the target application at the current moment and / or the performance problems that may exist at a future moment.

[0057] In this way, multiple performance parameters of the target application are collected through pre-defined aspect expressions, eliminating the need to manually add performance detection code to each method to be detected, greatly improving the writing efficiency and maintainability of performance monitoring code. Moreover, through the aspect corresponding to the method to be detected defined by the aspect expression, automatic detection of the performance of the target application can be achieved. In addition, since the performance parameter collection results include the collection results corresponding to multiple performance parameters respectively, the accuracy of subsequent performance analysis of the target application is improved, that is, the accuracy of performance detection is improved.

[0058] In addition, other features and advantages of the present application will be described in the subsequent specification, and will, in part, be obvious from the specification, or will be understood by implementing the present application. The objectives and other advantages of the present application can be realized and obtained through the structures specifically pointed out in the written specification, claims, and drawings. Brief Description of the Drawings

[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for description in the embodiments. Obviously, the drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute an improper limitation to the present application. In the drawings:

[0060] Figure 1 It is a schematic diagram of an optional system architecture applicable to the embodiments of the present application;

[0061] Figure 2 It is a schematic diagram of the implementation process of an application performance detection method provided by the embodiments of the present application;

[0062] Figure 3 It is a schematic diagram of the logic for displaying performance detection results provided by the embodiments of the present application;

[0063] Figure 4 It is a schematic diagram of the system architecture of an application performance detection system based on aspect-oriented programming provided by the embodiments of the present application;

[0064] Figure 5 It is a schematic diagram of the structure of an application performance detection device provided by the embodiments of the present application;

[0065] Figure 6 It is a schematic diagram of the structure of an electronic device provided by the embodiments of the present application. Detailed Embodiments

[0066] Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not used to limit the protection scope of the present application.

[0067] It should be understood that the various steps described in the method embodiments of the present application can be executed 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 application is not limited in this regard.

[0068] The term "including" and its variants used herein are open-ended, i.e., "including but not limited to". The term "based on" means "at least partially based 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. It should be noted that the concepts such as "first" and "second" mentioned in the present application are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependent relationships.

[0069] It should be noted that the modifications of "one" and "multiple" mentioned in the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".

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

[0071] Some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0072] (1) Aspect Oriented Programming (AOP): It is a programming paradigm that aims to solve the problem of cross-cutting concerns that are difficult to handle in Object Oriented Programming (OOP). AOP separates cross-cutting concerns (such as logging, transaction management, permission control, etc.) from the business logic and encapsulates them into independent modules called "aspects", thereby achieving code modularization and improving reusability.

[0073] (2) Cross-cutting concerns: These refer to concerns in the software development process that span multiple software modules or functional areas. These concerns are usually not directly related to specific business logic but are prevalent throughout the system and affect multiple different parts. Exemplarily, common cross-cutting concerns can include, but are not limited to, logging, security checks, performance monitoring, etc.

[0074] (3) Aspect: A modular cross-cutting concern that contains a series of related advices and pointcuts. Among them, the pointcut defines which join points should be affected by the aspect, usually by an expression to match specific methods or classes. Advice defines the specific operations to be executed at the pointcut. For example, in the before advice, certain logic can be executed before a method call. The aforementioned pointcut can also be referred to as the entry point.

[0075] (4) Join point: A point in the program execution process where an aspect can be inserted. For example, join points can include, but are not limited to, method calls, exception throws, etc.

[0076] (5) Runtime: Refers to the state of a program when it is running (or being executed). In other words, when a program is opened and made to run, the program is in the runtime state.

[0077] Based on the above explanations of terms and related terminologies, the design concept of the embodiments of the present application is briefly introduced below:

[0078] In the process of application development for various operating systems (such as iOS), application performance has always been a key concern for developers. As application functions become increasingly complex, it has become more and more difficult to accurately monitor and analyze the performance of each part or module in the application. Traditional performance detection methods usually require inserting monitoring code into each function module to be monitored in the application (such as the target method or target code). This method is not only inefficient but also error-prone, and will make the application program complex and difficult to maintain. That is, using the aforementioned method, the efficiency of performance detection is low and the accuracy is low.

[0079] In view of this, to solve or improve the above problems, an embodiment of the present application provides an application performance detection method, which may specifically include: during the running of the target application, collecting multiple performance parameters of the target application based on a preset aspect expression to obtain a performance parameter collection result; wherein, the aspect expression can be used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; based on the performance parameter collection result and the anomaly discrimination thresholds set for the multiple performance parameters respectively, performing performance analysis on the target application to obtain a performance detection result; the performance detection result can be used to indicate the performance problems existing at the current moment and / or the performance problems that may exist at a future moment of the target application. By adopting this method, the collection of multiple performance parameters of the target application is realized through a preset aspect expression, which greatly improves the efficiency and accuracy of performance detection.

[0080] Specifically, the preferred embodiments of the present application will be described below with reference to the accompanying drawings of the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application and are not used to limit the present application. And without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.

[0081] Refer to Figure 1 As shown, it is a schematic diagram of a system architecture applicable to an embodiment of the present application. The system architecture may include: terminal devices (101a, 101b) and a server 102. Information interaction can be carried out between the terminal devices (101a, 101b) and the server 102 through a communication network. Among them, the communication methods adopted by the communication network may include: wireless communication methods and wired communication methods. Exemplarily, the terminal devices (101a, 101b) can access the network through cellular mobile communication technology and communicate with the server 102. Among them, the cellular mobile communication technology, for example, includes the fifth generation mobile networks (5G) technology or the next generation mobile communication technology. Optionally, the terminal devices (101a, 101b) can access the network through short-range wireless communication methods and communicate with the server 102. Among them, the short-range wireless communication methods, for example, include wireless fidelity (Wi-Fi) technology.

[0082] The embodiment of the present application does not impose any restrictions on the number of communication devices involved in the above system architecture. For example, the above system architecture may include more terminal devices, or include fewer terminal devices, or further include other network devices. As Figure 1 shown, only the terminal devices (101a, 101b) and the server 102 are taken as examples for description. Below, a brief introduction to the above communication devices and their respective functions will be given.

[0083] The terminal devices (101a, 101b) are devices that can provide voice and / or data connectivity to users and can be devices supporting wired and / or wireless connection methods.

[0084] Exemplarily, the terminal devices (101a, 101b) may include, but are not limited to: mobile phones, tablet computers, laptop computers, handheld computers, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminal devices in industrial control, wireless terminal devices in unmanned driving, wireless terminal devices in smart grids, wireless terminal devices in transportation safety, wireless terminal devices in smart cities, or wireless terminal devices in smart homes, etc.

[0085] In addition, relevant clients may be installed on the terminal devices (101a, 101b), and the clients may be software, for example, application programs (APPs), browsers, short video software, etc. Of course, they may also be web pages, applets, etc. It should be noted that the terminal devices (101a, 101b) in the embodiments of the present application may enable the above-mentioned clients related to application performance detection to send application performance detection requests for a target application to the server 102, so as to perform method steps such as application performance detection for the foregoing target application subsequently.

[0086] The server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms.

[0087] It is worth noting that the server 102 in the embodiments of the present application may be used to collect multiple performance parameters of a target application based on a preset aspect expression during the running of the target application to obtain a performance parameter collection result; wherein, the aspect expression may be used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; perform performance analysis on the target application based on the performance parameter collection result and the exception discrimination thresholds respectively set for the multiple performance parameters to obtain a performance detection result; the performance detection result may be used to indicate the performance problems existing at the current moment and / or the performance problems that may exist at a future moment of the target application.

[0088] The application performance detection method provided by the exemplary embodiments of the present application will be described below in combination with the above system architecture and with reference to the accompanying drawings. It should be noted that the above system architecture is only shown for the convenience of understanding the spirit and principle of the present application, and the embodiments of the present application are not limited in this regard.

[0089] Refer to Figure 2 As shown, it is a schematic diagram of the implementation process of an application performance detection method provided by an embodiment of the present application. Taking the server as an example of the execution entity, the specific implementation process of this method is as follows:

[0090] S201: During the running of the target application, collect multiple performance parameters of the target application based on a preset aspect expression to obtain a performance parameter collection result.

[0091] Among them, the above aspect expression can be used to indicate the identifiers of at least one method to be detected included in the target application, that is, the above aspect expression specifies which methods in the target application should be intercepted to achieve the collection of multiple performance parameters of the target application. Therefore, the above aspect expression can be used to match methods of a specific type, methods under a specific package, or methods with specific parameters, etc. The embodiments of the present application do not make specific limitations in this regard. Optionally, among the methods to be detected indicated by the above aspect expression, different methods to be detected can correspond to different application functions.

[0092] The above multiple performance parameters can include but are not limited to: network request latency, traffic usage, memory usage changes, central processing unit (CPU) usage rate, frame rate, method execution time, etc., which are performance indicators or parameters that can be used to measure the application performance of the target application. It should be understood that the multiple data included in the above performance parameter collection result are the relevant data before and after the execution of the method to be detected. In addition, the above target application can be an application service deployed on various operating systems, such as iOS applications. The embodiments of the present application do not make specific limitations in this regard.

[0093] Exemplarily, for the detection of network request latency, the server can use the callback mechanism of the network library used by the operating system to record the start and end times of the network request. For the detection of memory usage changes, the server can combine the memory management mechanism of the operating system to obtain the memory allocation and release situations before and after the execution of the method to be detected. For the detection of method execution time, the server can determine it by calculating the time difference between the time stamp when the method to be detected starts to execute and the time stamp when it ends. In addition, the server can also adopt corresponding data collection methods to collect performance parameters such as traffic usage, CPU usage rate, and frame rate corresponding to the target application. The embodiments of the present application do not make specific limitations in this regard.

[0094] In an alternative implementation, the above aspect expression can be constructed by the server in the following manner: obtaining class information corresponding to multiple classes included in the target application, thereby performing entry point analysis for performance detection on the obtained multiple class information, obtaining multiple entry points, and creating an aspect expression based on the multiple entry points. By adopting this method, an aspect for performance detection of the target application is defined. By analyzing the class information of each class included in the target application, the key entry points that need to be subjected to performance detection are determined, ensuring the smooth progress of subsequent application performance detection.

[0095] Each of the above class information may include, but is not limited to: method calls of the class, user interaction events (such as click operations, swipe operations, etc.), operations related to system resources (such as memory allocation, network requests, etc.), and the like. Therefore, the above multiple entry points may be: method calls of the class, user interaction events, operations related to system resources, and the like.

[0096] Optionally, the server may formulate an aspect expression for the method to be intercepted and detected (i.e., the method to be detected) based on the characteristics and syntax rules of the runtime of the operating system.

[0097] In an alternative implementation, when executing step S201, the server may perform the following operations respectively for at least one method to be detected included in the above aspect expression: intercept the first method to be detected based on the call time of the first method to be detected; then, when it is determined that the call operation for the first method to be detected is successfully intercepted, add a performance parameter detection method corresponding to the first method to be detected, and collect multiple performance parameters of the target application based on the performance parameter detection method, obtaining a performance parameter collection sub-result corresponding to the first method to be detected. The first method to be detected may be any one of the at least one method to be detected. In this way, not only can the interception of the method to be detected in the target application be achieved, but also the real-time injection of performance detection code (i.e., adding a performance parameter detection method) can be realized.

[0098] Taking the iOS operating system of the target application as an example, the server can implement AOP using the iOS runtime. Exemplarily, the server can make full use of its message forwarding mechanism and dynamic method resolution function according to the powerful dynamic features provided by the iOS runtime. Specifically, during the message forwarding process, the server can intercept the method to be detected and inject the performance monitoring code (i.e., the performance parameter detection method) by overriding methods such as -(id)forwardingTargetForSelector:(SEL)aSelector, -(NSMethodSignature*)methodSignatureForSelector:(SEL)aSelector, and -(void)forwardInvocation:(NSInvocation*)anInvocation. In the dynamic method resolution stage, the server can use the +(BOOL)resolveInstanceMethod:(SEL)sel method and the +(BOOL)resolveClassMethod:(SEL)sel method to handle the methods that may need to be monitored and determined only at runtime (i.e., the methods to be detected).

[0099] It should be noted that the above-mentioned Selector (i.e., the selector) can be used to reference and call methods in the code. The selector can be the name of the method or the unique identifier used to replace the method name during compilation. The compiled selector type is SEL. All methods with the same name can have the same selector.

[0100] It should be understood that the performance parameter detection methods corresponding to different methods to be detected can be the same, or of course, different. The embodiments of the present application do not limit this. For example, if the performance parameters that change when two methods to be detected are executed are the same, the same performance parameter detection method can be used; otherwise, different performance parameter detection methods need to be used.

[0101] In order to accurately collect various performance parameters, the server can collect the above-mentioned multiple performance parameters by combining multiple APIs used by the operating system where the target application is located. Therefore, the server can determine the APIs respectively set for the multiple performance parameters, and then collect the multiple performance parameters based on the performance parameter detection method and the multiple APIs, so as to obtain the performance parameter collection sub-results corresponding to the first method to be detected.

[0102] Exemplarily, in terms of memory monitoring, the server can utilize hooks of memory management functions such as malloc and free to obtain memory allocation and release information, thereby achieving data collection of memory usage changes. For network request performance monitoring, the server can integrate with callback functions of network request libraries such as NSURLSession to obtain the start and end times of network requests, and then determine the duration of network requests. At the same time, the server can also combine with APIs related to frame rate such as CADisplayLink to achieve frame rate monitoring, and through the collaborative work of APIs related to obtaining CPU usage rate such as mach_task_basic_info, comprehensively collect performance data of the target application.

[0103] It can be seen from the above that based on the above methods, by combining the runtime environment corresponding to the target application and multiple APIs of the operating system, multiple performance parameters (or performance metrics) during the operation of the target application can be comprehensively and accurately monitored, thus ensuring the accuracy of subsequent performance analysis of the target application based on the performance parameter collection results.

[0104] In addition, when intercepting the call operation for the first method to be detected, the server can identify the selector and the class to which the first method to be detected belongs, and determine again whether the first method to be detected needs to perform performance parameter collection, thereby ensuring the accuracy and reliability of performance parameter collection, and also avoiding incorrect performance parameter collection to a certain extent.

[0105] S202: Based on the performance parameter collection results and the exception discrimination thresholds set for multiple performance parameters respectively, perform performance analysis on the target application to obtain performance detection results.

[0106] The above-mentioned performance detection results can be used to indicate the performance problems existing at the current moment and / or the possible performance problems at future moments of the target application. In this way, the server can perform performance analysis on the target application based on the performance parameter collection results and the exception discrimination thresholds set for multiple performance parameters respectively, so as to determine the performance situation of the target application at the current moment and predict the performance situation of the target application at future moments.

[0107] In an optional implementation manner, when executing step S202, for any one of the above-mentioned multiple performance parameters, for example, the first performance parameter, the server can perform the following operations: Obtain the collection result of the first performance parameter from the performance parameter collection results, and thereby determine whether the target application has a performance problem corresponding to the first performance parameter based on the comparison result between the collection result and the exception discrimination threshold corresponding to the first performance parameter.

[0108] In this way, by judging whether the first performance parameter exceeds the normal range according to the preset abnormal discrimination threshold, it is possible to quickly and accurately determine whether there are performance problems in the target application.

[0109] Taking the method execution time as the first performance parameter as an example, if the method execution time corresponding to the first method to be detected exceeds the preset maximum execution time threshold (i.e., the abnormal discrimination threshold set for the method execution time), it can be determined that there are performance problems corresponding to the method execution time in the target application.

[0110] Taking the change in memory usage as the first performance parameter as an example again, if the change in memory usage corresponding to the first method to be detected exceeds the safe memory usage change threshold (for example, the memory usage grows too fast and exceeds the aforementioned safe memory usage change threshold), it can be determined that there are performance problems corresponding to the change in memory usage in the target application.

[0111] Optionally, when determining whether there are performance problems corresponding to the first performance parameter in the target application, the server can mark the first performance parameter as a performance problem point for subsequent quick obtaining of the performance detection results of the target application.

[0112] In an optional implementation manner, when the server determines whether there are performance problems corresponding to the first performance parameter based on the comparison result between the acquisition result of the first performance parameter and the abnormal discrimination threshold corresponding to the first performance parameter, it can input the acquisition result of the first performance parameter and the abnormal discrimination threshold corresponding to the first performance parameter into a pre-trained performance problem discrimination model, so as to obtain whether there are performance problems corresponding to the first performance parameter in the target application at the current moment and / or in the future. In this way, through the intelligent data analysis algorithm, the server can quickly and accurately judge whether there are performance problems in the collected performance data (such as the acquisition result of the first performance parameter).

[0113] It can be understood that the server realizes the identification of performance problems in the target application by means of machine learning or statistical analysis methods through the established performance parameter model (i.e., the aforementioned pre-trained performance problem discrimination model). For example, using cluster analysis to group similar performance data (i.e., performance parameters) to identify abnormal data clusters different from the normal performance data clusters; or using time series analysis to predict the trend of performance data to discover potential performance problems in advance.

[0114] To more intuitively display the performance detection results of the target application, the performance detection results can be visualized. Refer to Figure 3As shown, after the server performs performance analysis on the target application based on the performance parameter collection results and the exception discrimination thresholds set for multiple performance parameters respectively, and obtains the performance detection results, it can also generate a first chart and / or first text information based on the performance detection results, so as to present a first interface. Among them, the aforementioned first chart can be used to describe the application performance change of the target application during the running process of the target application, the aforementioned first text information can include a specific description of the performance problems existing in the target application, and the aforementioned first interface can be used to display the first chart and / or the first text information.

[0115] In this way, the server can generate a detailed performance report (i.e., the first icon and / or the first text information) according to the performance detection results of the target application. The performance report may include the specific location of the performance problem (e.g., which method in which class has a problem), the abnormal value of the performance index, the possible impact of the performance problem on the user experience, etc.

[0116] Based on the application performance detection method described in the above steps S201 - S202, refer to Figure 4 As shown, it is an application performance detection system based on aspect - oriented programming provided by an embodiment of the present application. The application performance detection system may include: an aspect definition module, an interception and injection module, a performance data collection module, and a data analysis and reporting module. Among them, the aspect definition module can be used to define the aspect for performing performance detection on the target application, the interception and injection module can implement the interception of the method to be detected, and inject the performance parameter detection method set for the method to be detected. The performance data collection module can be responsible for collecting the data obtained by the performance parameter detection method injected before and after the execution of the method to be detected. The data analysis and reporting module can analyze and process the collected performance data, so as to obtain and display the performance detection results.

[0117] Therefore, the application performance detection method provided by the embodiments of the present application has the following advantages: 1. High efficiency: By means of aspect-oriented programming, there is no need to manually add performance monitoring code to each method to be detected that needs to be monitored, which improves the writing efficiency and maintainability of the performance monitoring code. Developers only need to define the aspects to be monitored in the aspect definition module, and the performance of relevant methods to be detected can be automatically monitored. 2. Comprehensiveness: It can comprehensively monitor various performance indicators in the target application, and thus can help developers more accurately discover and locate performance bottlenecks. 3. Accuracy: Combining the runtime environment and APIs, it can accurately collect performance data. Through intelligent data analysis algorithms, it can more precisely analyze performance data, reduce false positives and false negatives, and provide reliable performance evaluation results for developers. 4. Real-time and preventive: It can collect and analyze performance data in real time, and can timely discover performance problems. At the same time, by predicting the trend of performance data, potential performance problems can be discovered in advance, helping developers take measures to optimize before the problems affect the user experience.

[0118] In summary, in the application performance detection method provided by the embodiments of the present application, during the running process of the target application, multiple performance parameters of the target application are collected based on a preset aspect expression to obtain a performance parameter collection result; wherein, the aspect expression can be used to indicate the identifier of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; based on the performance parameter collection result and the exception discrimination thresholds respectively set for the multiple performance parameters, performance analysis is performed on the target application to obtain a performance detection result; the performance detection result can be used to indicate the performance problems existing at the current moment of the target application and / or the performance problems that may exist at a future moment.

[0119] Adopting this method, multiple performance parameters of the target application are collected through a predefined aspect expression, without manually adding performance detection code to each method to be detected, which greatly improves the writing efficiency and maintainability of the performance monitoring code. Moreover, through the aspect corresponding to the method to be detected defined by the aspect expression, automatic detection of the performance of the target application can be realized. In addition, since the performance parameter collection result includes the collection results corresponding to multiple performance parameters respectively, the accuracy of subsequent performance analysis of the target application is improved, that is, the accuracy of performance detection is improved.

[0120] Furthermore, based on the same technical concept, the embodiments of the present application provide an application performance detection device, and this application performance detection device is used to implement the above method flow of the embodiments of the present application. Refer to Figure 5 As shown, this user data processing device 500 includes: a parameter collection module 501, a performance detection module 502, and a result display module 503, where:

[0121] A parameter collection module 501 is configured to collect multiple performance parameters of a target application during the running of the target application based on a preset aspect expression, and obtain a performance parameter collection result; wherein, the aspect expression is used to indicate the identifiers of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions.

[0122] A performance detection module 502 is configured to perform performance analysis on the target application based on the performance parameter collection result and the abnormal discrimination thresholds respectively set for the multiple performance parameters, and obtain a performance detection result; the performance detection result is used to indicate the performance problems existing at the current moment of the target application and / or the performance problems that may exist at a future moment.

[0123] In an optional embodiment, the aspect expression is created by the parameter collection module 501 in the following manner:

[0124] Obtain the class information corresponding to multiple classes included in the target application; wherein, each class includes one or more methods set for the target application.

[0125] Perform aspect pointcut analysis for performance detection on the obtained multiple class information, obtain multiple pointcuts, and create an aspect expression based on the multiple pointcuts.

[0126] In an optional embodiment, when collecting multiple performance parameters of the target application based on a preset aspect expression to obtain a performance parameter collection result, the parameter collection module 501 specifically is configured to:

[0127] For at least one method to be detected in the aspect expression, perform the following operations respectively:

[0128] Intercept a first method to be detected based on the call time of the first method to be detected; wherein, the first method to be detected is any one of the at least one method to be detected.

[0129] When successfully intercepting the call operation for the first method to be detected, add a performance parameter detection method corresponding to the first method to be detected, and collect multiple performance parameters based on the performance parameter detection method to obtain a performance parameter collection sub-result corresponding to the first method to be detected.

[0130] In an optional embodiment, when collecting multiple performance parameters based on the performance parameter detection method to obtain a performance parameter collection sub-result corresponding to the first method to be detected, the parameter collection module 501 specifically is configured to:

[0131] Determine the APIs respectively set for the multiple performance parameters.

[0132] Collect multiple performance parameters based on a performance parameter detection method and multiple APIs to obtain a performance parameter collection sub-result corresponding to a first method to be detected.

[0133] In an alternative embodiment, when performing performance analysis on a target application based on a performance parameter collection result and an abnormal discrimination threshold respectively set for multiple performance parameters, the performance detection module 502 is specifically configured to:

[0134] For multiple performance parameters, perform the following operations respectively:

[0135] Obtain the collection result of a first performance parameter from the performance parameter collection result; wherein, the first performance parameter is any one of the multiple performance parameters;

[0136] Based on the comparison result between the collection result of the first performance parameter and the abnormal discrimination threshold corresponding to the first performance parameter, determine whether there is a performance problem corresponding to the first performance parameter in the target application.

[0137] In an alternative embodiment, when determining whether there is a performance problem corresponding to the first performance parameter in the target application based on the comparison result between the collection result of the first performance parameter and the abnormal discrimination threshold corresponding to the first performance parameter, the performance detection module 502 is specifically configured to:

[0138] Input the collection result of the first performance parameter and the abnormal discrimination threshold corresponding to the first performance parameter into a pre-trained performance problem discrimination model to obtain whether there is a performance problem corresponding to the first performance parameter in the target application at the current moment and / or in the future.

[0139] In an alternative embodiment, after performing performance analysis on a target application based on a performance parameter collection result and an abnormal discrimination threshold respectively set for multiple performance parameters to obtain a performance detection result, the result display module 503 is specifically configured to:

[0140] Generate a first chart and / or first text information based on the performance detection result; wherein, the first chart is used to describe the application performance change of the target application during the running process of the target application, and the first text information includes a specific description of the performance problems existing in the target application;

[0141] Present a first interface; the first interface is used to display the first chart and / or the first text information.

[0142] Based on the descriptions of the above method embodiments and apparatus embodiments, an exemplary embodiment of the present invention further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, it is used to cause the electronic device to execute the method according to the embodiments of the present invention.

[0143] An embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to execute the method according to the embodiments of the present application.

[0144] An embodiment of the present application further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to execute the method according to the embodiments of the present application.

[0145] Referring to Figure 6 as shown, the structural block diagram of an electronic device 600 that can be used as a server or a client of the present application will now be described. It is an example of a hardware device applicable to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer devices, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0146] As Figure 6 shown, the electronic device 600 includes a computing unit 601, which can execute various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0147] Multiple components in the electronic device 600 are connected to the I / O interface 605, including: an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. The input unit 606 can be any type of device capable of inputting information into the electronic device 600. The input unit 606 can receive input digital or character information and generate key signal inputs related to user settings and / or function controls of the electronic device. The output unit 607 can be any type of device capable of presenting information and can include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 608 can include, but is not limited to, a magnetic disk and an optical disk. The communication unit 609 allows the electronic device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks and can include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a worldwide interoperability for microwave access (WiMax) device, a cellular communication device, and / or the like.

[0148] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU, a graphics processing unit (GPU), various artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 executes the various methods and processes described above. For example, in some embodiments, the above application performance detection method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 600 via the ROM 602 and / or the communication unit 609. In some embodiments, the computing unit 601 can be configured to execute the above application performance detection method by any other suitable means (e.g., by means of firmware).

[0149] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, executed partially on the machine as an independent software package and partially on a remote machine, or executed entirely on a remote machine or server.

[0150] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM) or flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0151] As used in the present application, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or apparatus for providing machine instructions and / or data to a programmable processor (e.g., a disk, an optical disk, a memory, a programmable logic device (PLD)), including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0152] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a cathode ray tube (CRT) or a liquid crystal display (LCD) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0153] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0154] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of the client and the server is generated by computer programs running on the respective computers and having a client-server relationship to each other.

[0155] Also, it should be understood that the above-disclosed are only the preferred embodiments of the present application, and of course cannot be used to limit the scope of the rights of the present invention. Therefore, equivalent changes made in accordance with the claims of the present invention are still within the scope covered by the present application.

Claims

1. A method for detecting application performance, characterized in that: include: During the operation of the target application, multiple performance parameters of the target application are collected based on a preset aspect expression to obtain a performance parameter collection result; wherein the aspect expression is used to indicate an identifier of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; Based on the performance parameter collection results and the abnormality discrimination thresholds set for the multiple performance parameters, a performance analysis is performed on the target application to obtain a performance detection result; the performance detection result is used to indicate the performance problems of the target application at the current moment and / or the performance problems that may exist in the future.

2. The method according to claim 1, characterized in that The aspect expression is created as follows: Acquire class information corresponding to a plurality of classes included in the target application; wherein each class includes one or more methods set for the target application; The obtained multiple class information is subjected to entry point analysis for performance detection to obtain multiple entry points, and the section expression is created based on the multiple entry points.

3. The method according to claim 1 or 2, characterized in that The collecting of multiple performance parameters of the target application based on the preset section expression to obtain performance parameter collection results includes: For the at least one method to be detected in the slice expression, perform the following operations respectively: Intercepting the first method to be detected based on the calling time of the first method to be detected; wherein the first method to be detected is any one of the at least one method to be detected; When the call operation for the first method to be detected is successfully intercepted, a performance parameter detection method corresponding to the first method to be detected is added, and the multiple performance parameters are collected based on the performance parameter detection method to obtain a performance parameter collection sub-result corresponding to the first method to be detected.

4. The method according to claim 3, characterized in that The collecting the multiple performance parameters based on the performance parameter detection mode to obtain the performance parameter collection sub-results corresponding to the first to-be-detected method includes: Determine application program interfaces APIs set respectively for the multiple performance parameters; The multiple performance parameters are collected based on the performance parameter detection method and multiple APIs to obtain performance parameter collection sub-results corresponding to the first method to be detected.

5. The method according to claim 1 or 2, characterized in that: The performing performance analysis on the target application based on the performance parameter collection result and the abnormality discrimination thresholds respectively set for the multiple performance parameters includes: For the multiple performance parameters, the following operations are performed respectively: Acquire a collection result of a first performance parameter from the performance parameter collection result; wherein the first performance parameter is any one of the multiple performance parameters; Based on a comparison result between the collection result and an abnormality discrimination threshold corresponding to the first performance parameter, it is determined whether the target application has a performance problem corresponding to the first performance parameter.

6. The method according to claim 5, characterized in that The comparing result between the collection result of the first performance parameter and the abnormality discrimination threshold corresponding to the first performance parameter, determining whether the target application has a performance problem corresponding to the first performance parameter, includes: The collection result of the first performance parameter and the abnormality discrimination threshold corresponding to the first performance parameter are input into a pre-trained performance problem discrimination model to obtain whether the target application has a performance problem corresponding to the first performance parameter at the current moment and / or the future moment.

7. The method according to claim 1 or 2, characterized in that: After the performance analysis of the target application is performed based on the performance parameter collection result and the abnormality discrimination thresholds respectively set for the multiple performance parameters to obtain the performance detection result, the method further includes: Generate a first chart and / or first text information based on the performance detection result; wherein the first chart is used to describe the application performance change of the target application during the operation of the target application, and the first text information includes a specific description of the performance problem existing in the target application; Present a first interface; the first interface is used to display the first chart and / or the first text information.

8. An application performance detection device, characterized in that: include: A parameter collection module, used to collect multiple performance parameters of the target application based on a preset aspect expression during the operation of the target application to obtain a performance parameter collection result; wherein the aspect expression is used to indicate the identifier of at least one method to be detected included in the target application, and different methods to be detected correspond to different application functions; A performance detection module is used to perform performance analysis on the target application based on the performance parameter collection results and the abnormal discrimination thresholds set for the multiple performance parameters to obtain performance detection results; the performance detection results are used to indicate the performance problems of the target application at the current moment and / or the performance problems that may exist in the future.

9. An electronic device, comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.