An interpreter-based performance optimization method, system and related electronic device

By using interpreter instrumentation Hook processing and dynamically adjusting the stub strategy, the problem of slow content loading speed in third-party applications was solved, achieving efficient optimization in complex scenarios and improving user experience.

CN120276792BActive Publication Date: 2026-03-20HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately and efficiently control performance optimization strategies in complex scenarios during content loading for third-party applications, resulting in slow loading speeds and poor user experience.

Method used

By using interpreter-based instrumentation hooking, the target stubs of the objective function are determined, and the execution timing of performance optimization strategies is dynamically adjusted according to the stub type (start stub, delay stub, end stub), including optimization measures such as increasing the processor operating frequency.

Benefits of technology

Accurately control performance optimization strategies in complex scenarios to reduce loading time and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120276792B_ABST
    Figure CN120276792B_ABST
Patent Text Reader

Abstract

The application provides an interpreter-based performance optimization method and system, and a related electronic device. The method comprises: performing a Hook processing on a target function, and determining a target point corresponding to the target function; when the target function is executed, determining whether a trigger condition of the target point is met; if the target point is a delay point, and the trigger condition corresponding to the delay point is met, terminating a preset time corresponding to a last triggered delay point, starting a preset time corresponding to a current delay point, and triggering the end point after the preset time. The embodiment of the application can control the execution of a corresponding performance optimization strategy for various complex content loading scenarios, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of terminals, and in particular, to an interpreter-based performance optimization method and system and related electronic device. BACKGROUND

[0002] With the development of the Internet, in order to facilitate life and entertainment, users download and use more and more third-party applications in the application market of electronic devices. However, for users, the content loading process of various related functions or associated applications in the third-party application is particularly important, which can quickly respond to user operations (such as opening a third-party application or clicking a page), quickly load page content and display, and can bring better user experience to users.

[0003] Since the processor (Central Processing Unit, CPU) of the electronic device will automatically reduce the frequency to reduce power consumption and temperature when the temperature of the electronic device is increased, and the higher the temperature of the electronic device, the lower the working frequency of the processor, therefore, the third-party application is prone to have a long loading time of page content (such as pictures, text, voice or controls, etc.) and a slow loading speed of related functions during the content loading process. In the prior art, the key functions related to the loading logic are usually found at the starting point and the ending point of the content loading process as the starting and ending stub points for judging the time range of the content loading, so as to issue the corresponding performance optimization strategy to improve the content loading speed. However, for some complex loading process scenarios (such as a content loading scenario in which it is difficult to find a key function with strong logical correlation as an ending stub point), the corresponding performance optimization strategy cannot be effectively issued, so that the content loading speed is not improved, resulting in poor user experience.

[0004] Therefore, how to accurately and efficiently control the execution of the corresponding performance optimization strategy to reduce the loading time and improve the user experience for the content loading process of the third-party application in various complex scenarios is a problem to be solved. SUMMARY

[0005] The present application provides an interpreter-based performance optimization method, system and related electronic device, wherein in the interpreter-based performance optimization method, the corresponding performance optimization strategy can be controlled to be executed to improve the user experience for various complex content loading scenarios.

[0006] In a first aspect, embodiments of this application provide an interpreter-based performance optimization method, which may include: instrumenting a target function (Hook processing) to determine a target stub corresponding to the target function; the target function is a function currently being interpreted and executed by the interpreter, and one target function corresponds to one target stub; when the target function is executed, it is determined whether the triggering condition of the target stub is met; the target stub type includes a start stub and a delay stub, the start stub is used to trigger the execution of a performance optimization strategy, the delay stub is used to trigger an end stub after a preset time, and the end stub is used to trigger the end of the performance optimization strategy; if the target stub is a delay stub and the triggering condition corresponding to the delay stub is met, then the preset time corresponding to the previously triggered delay stub is terminated, the preset time corresponding to the current delay stub is started, and the end stub is triggered after the preset time.

[0007] In the prior art, a key function related to loading logic is usually found as a start and end stub point at the start point and end point of the content loading process of a third-party application, which is used to determine the time range of content loading, so as to issue a corresponding performance optimization strategy to improve the content loading speed. However, for some complex loading process scenarios (for example, a content loading scenario in which it is difficult to find a key function with strong logical correlation as an end stub point), the corresponding performance optimization strategy cannot be effectively issued, the content loading speed is not improved, and the user experience is poor. In the embodiments of the present application, the target stub point is determined by performing a stubbing Hook process on the function currently interpreted and executed by the interpreter (that is, the target function); when the target function is executed, it is further determined whether the trigger condition of the target stub point is met. The type of the target stub point can include a start stub point and a delay stub point. Since the start stub point is used to trigger the execution of the performance optimization strategy, the delay stub point is used to trigger the end stub point after a preset time, and the end stub point is used to trigger the end of the performance optimization strategy, therefore, for all target functions in the entire content loading process of the third-party application, at least one start stub point and one delay stub point are included to control the execution process of the performance optimization strategy in the content loading process of the application, so as to avoid continuously executing the performance optimization strategy during the application runtime, so that the temperature of the electronic device is too high and the performance optimization effect is poor. Further, if the target stub point is a delay stub point and the trigger condition corresponding to the delay stub point is met, the preset time corresponding to the last triggered delay stub point is terminated, the preset time corresponding to the current delay stub point is started, and the end stub point is triggered after the preset time. Therefore, in the embodiments of the present application, the preset time corresponding to the last triggered delay stub point is terminated, the preset time corresponding to the current delay stub point is started when the delay stub point (for example, the delay stub point corresponding to a target function and / or different delay stub points corresponding to different target functions) is repeatedly triggered, so as to dynamically adjust the trigger time of the end stub point, so that in a complex loading process scenario (for example, a content loading scenario in which it is difficult to find a key function with strong logical correlation as an end stub point), without finding a key function related to loading logic as an end stub point of the performance optimization strategy, the corresponding performance optimization strategy can be accurately controlled according to the content loading process to control the electronic device to execute the corresponding performance optimization strategy, thereby reducing the loading time to improve the user experience.

[0008] In a possible implementation manner, the method further includes: obtaining function information of a function to be interpreted and executed, the function information including a function name of the function; determining whether the function is a key function based on the function information and a pre-obtained configuration file, the configuration file including one or more function names corresponding to one or more key functions; and in a case where the function is the key function, determining that the function is the target function.

[0009] The embodiment of the application can acquire function information such as a function name of a function to be interpreted and executed, and determine whether the function to be interpreted and executed is a key function based on a pre-acquired configuration file. If the function is a key function, the function is a trigger point of a key event in an application content loading process, and the function can be determined as a target function, so that the function is subjected to a hooking process, a target probe point corresponding to the function is determined, and a performance optimization strategy is accurately and efficiently determined for the content loading process to improve user experience.

[0010] In a possible implementation, the determining whether the function is a key function based on the function information and the pre-acquired configuration file can include: determining whether a function name same as the function name of the function exists in the configuration file based on the function information and the configuration file; if the function name exists, determining that the function is the corresponding key function; and if the function name does not exist, determining that the function is a non-key function.

[0011] The embodiment of the application can determine whether a function to be interpreted and executed is a key function based on a function name, greatly improves the efficiency of confirming a key function, and accurately and efficiently determines a trigger execution and an end time of a performance optimization strategy based on the key function to position a content loading process in running of a third-party application, so as to reduce a loading time and improve user experience.

[0012] In a possible implementation, the method further includes: determining probe point information corresponding to the target probe point based on the target probe point; the probe point information includes position information, a trigger condition, and a trigger rule; the position information is used to indicate a hooking position of the target probe point in the target function, the trigger condition is used to indicate a condition for triggering the target probe point, and the trigger rule is used to indicate an operation performed when the target probe point is triggered.

[0013] The embodiment of the present application determines the stake point information containing the related information such as the position information, the trigger condition and the trigger rule, and then determines the insertion position of the target stake point in the key function (i.e. the target function) currently interpreted and executed by the interpreter based on the position information in the stake point information, so as to ensure that the target stake point triggered can accurately reflect the key time point of the content loading process; meanwhile, based on the trigger condition of the stake point information, it can be determined whether the target stake point is triggered when the corresponding target function is executed, so as to avoid the situation that the target stake point is triggered in advance or repeatedly triggered; in addition, based on the trigger rule in the stake point information, the operation performed by the electronic device when the target stake point is triggered can be determined, so that the corresponding performance optimization strategy of the electronic device is controlled in the content loading process to reduce the loading time to improve the user experience.

[0014] In a possible implementation manner, the determining whether the trigger condition of the target stake point is met when the target function is executed can include: when the target function is executed, determining whether the trigger condition of the target stake point is met based on the stake point information corresponding to the target function.

[0015] The embodiment of the present application, when the key function (i.e. the target function) currently interpreted and executed by the interpreter is executed, the trigger condition of the corresponding target stake point can be determined based on the stake point information corresponding to the target function, so as to determine whether the corresponding target stake point is triggered currently, so as to avoid the situation that the target stake point is triggered in advance or repeatedly triggered, improve the accuracy of the electronic device performing the corresponding performance optimization strategy for the content loading process, ensure that the target stake point is triggered at the correct time, so as to reduce the loading time to improve the user experience.

[0016] In a possible implementation manner, the type of the target stake point further includes a start pre-stake point and / or a delay pre-stake point; the start pre-stake point is used to change the pre-state to a start pre-state, and the delay pre-stake point is used to change the pre-state to a delay pre-state, and the pre-state is the program state before the target function corresponding to the target stake point is executed.

[0017] In the embodiment of the present application, since the type of the key function (i.e., the target function) currently interpreted and executed by the interpreter can further include a start pre-instrumentation point and / or a delay pre-instrumentation point, the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the target point can be changed to the start pre-state through the start pre-instrumentation point, and the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the target point can be changed to the delay pre-state through the pre-instrumentation point. Therefore, during the entire content loading process of the third-party application, different types of target points can be set for the key function according to the complexity of the actual situation, and the target points of different types are freely combined, so that the key events corresponding to various content loading scenarios can be ensured, thereby more flexibly and accurately controlling the timing of triggering and ending the performance optimization strategy to adapt to various content loading scenarios.

[0018] In a possible implementation manner, the start point is further configured to record a time of triggering the performance optimization strategy, and change the pre-state to a start state; and the end point is further configured to record a time of ending the performance optimization strategy, and change the pre-state to an end state.

[0019] In the embodiment of the present application, the start point can be used to trigger the performance optimization strategy and record a time of triggering the performance optimization strategy, and change the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the target point to a start state; and the end point can be used to trigger the end of the performance optimization strategy and record a time of ending the performance optimization strategy, and change the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the target point to an end state. The timestamps recorded when the start point and the end point are triggered are used to calculate the duration of the performance optimization strategy and other related measurement information, and the change of the pre-state is particularly helpful for quickly determining the execution of each key event in the content loading process in the case of complex loading logic, which is conducive to more comprehensive and detailed analysis and understanding of the behavior of the program in the debugging, measurement or performance analysis scenarios, so as to further perform corresponding fault analysis or optimization to improve the user experience.

[0020] In a possible implementation manner, the performance optimization strategy includes increasing the working frequency of the processor.

[0021] The performance optimization strategy in the embodiment of the present application can include increasing the working frequency of the processor (e.g., sending a frequency increasing instruction to the processor), so that the third-party application can quickly respond to user operations (e.g., opening the third-party application or clicking a page) during the content loading process, rapidly load page content and display, thereby improving the user experience.

[0022] In a possible implementation, the type of the target stake point further includes the start pre-stake point; and the determining whether the trigger condition of the target stake point is met currently can include: if the target stake point is the start stake point, determining, based on the stake point information corresponding to the start stake point, whether the pre-state is the start pre-state; if yes, determining that the trigger condition corresponding to the start stake point is met; and if no, determining that the trigger condition corresponding to the start stake point is not met.

[0023] In the embodiment of the application, when the type of the target stake point corresponding to all target functions in the whole content loading process of the third-party application further includes the start pre-stake point, if the target stake point corresponding to the key function (that is, the target function) currently interpreted and executed by the interpreter is the start stake point, the pre-state (that is, the pre-state) of the program executed by the electronic device before the target function corresponding to the start stake point (that is, the target stake point) can be determined based on the stake point information corresponding to the start stake point, to determine whether the start pre-state is met. The trigger condition of the start stake point (that is, the target stake point) is met. Further, if the pre-state is the start pre-state, it can be determined that the trigger condition corresponding to the start stake point is met; and if the pre-state is not the start pre-state, it can be determined that the trigger condition corresponding to the start stake point is not met, so that the start stake point can be triggered only after the start pre-stake point is triggered, thereby ensuring that the start stake point cannot be triggered in advance in the content loading process, to ensure that the trigger of the start stake point can accurately reflect the start node of the content loading process, and improve the positioning accuracy.

[0024] In a possible implementation, the type of the target stake point further includes the start pre-stake point; and the determining whether the trigger condition of the target stake point is met currently can include: if the target stake point is the start stake point, determining, based on the stake point information corresponding to the start stake point, whether the pre-state is the start pre-state; if yes, determining that the trigger condition corresponding to the start stake point is met; and if no, determining that the trigger condition corresponding to the start stake point is not met.

[0025] In the embodiment of the present application, when the entire content loading process of the third-party application is loaded, and the types of the target probe points corresponding to all target functions in the content loading process further include the delay pre-probe point, if the target probe point corresponding to the key function (i.e., the target function) currently interpreted and executed by the interpreter is the delay probe point, the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the delay probe point (i.e., the target probe point) can be determined based on the probe point information corresponding to the delay probe point by the probe insertion module, so as to determine whether the trigger condition of the delay probe point (i.e., the target probe point) is met at present. Further, if the pre-state is the delay pre-state, it can be determined that the trigger condition of the delay probe point is met; if the pre-state is not the delay pre-state, it can be determined that the trigger condition of the delay probe point is not met, so that the delay probe point can be triggered only after the delay pre-probe point is triggered, thereby ensuring that the delay probe point will not be triggered in advance in the content loading process, so as to ensure that the triggering of the delay probe point can accurately reflect the delay node of the content loading process, and improve the positioning accuracy.

[0026] In a possible implementation, the determining whether the trigger condition of the target probe point is met at present can include: if the target probe point is the delay pre-probe point, determining whether the pre-state is the start state based on the probe point information corresponding to the delay pre-probe point; if yes, it is determined that the trigger condition of the delay pre-probe point is met; if no, it is determined that the trigger condition of the delay pre-probe point is not met.

[0027] In the embodiment of the present application, if the target probe point corresponding to the key function (i.e., the target function) currently interpreted and executed by the interpreter is the delay pre-probe point, the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the delay pre-probe point (i.e., the target probe point) can be determined based on the probe point information corresponding to the delay pre-probe point, so as to determine whether the trigger condition of the delay pre-probe point (i.e., the target probe point) is met at present. Further, if the pre-state is the start state, it can be determined that the trigger condition of the delay pre-probe point is met; if the pre-state is not the start state, it can be determined that the trigger condition of the delay pre-probe point is not met, so that the delay pre-probe point can be triggered only after the start probe point is triggered, thereby ensuring that the delay pre-probe point will not be triggered in advance in the content loading process, so as to ensure that the triggering of the delay pre-probe point can accurately reflect the delay pre-node of the content loading process, and improve the positioning accuracy.

[0028] In a possible implementation, the method further includes: if the target stake point is the start pre-stake point and a trigger condition corresponding to the start pre-stake point is met, changing the pre-state to the start pre-state; if the target stake point is the start stake point and a trigger condition corresponding to the start stake point is met, triggering execution of the performance optimization strategy, recording a time of triggering execution of the performance optimization strategy, and changing the pre-state to the start state; and if the target stake point is the delay pre-stake point and a trigger condition corresponding to the delay pre-stake point is met, changing the pre-state to the delay pre-state.

[0029] When the interpreter is currently interpreting and executing a key function (i.e., a target function) corresponding to a target breakpoint that is a start preposition breakpoint, and the trigger condition corresponding to the start preposition breakpoint is met, the electronic device changes the program state (i.e., a preposition state) before the target function corresponding to the start preposition breakpoint (i.e., a target breakpoint) is executed to a start preposition state, so as to ensure that the start preposition breakpoint (including a start preposition breakpoint corresponding to one target function and / or different start preposition breakpoints corresponding to different target functions) is not repeatedly triggered in the content loading process, i.e., the start preposition breakpoint can be triggered only once in the entire content loading process, so as to ensure that the triggering of the start preposition breakpoint accurately reflects the start preposition node of the content loading process, and improve the positioning accuracy. When the interpreter is currently interpreting and executing a key function (i.e., a target function) corresponding to a target breakpoint that is a start breakpoint, and the trigger condition corresponding to the start breakpoint is met, the electronic device triggers the performance optimization strategy, and records the time of triggering the performance optimization strategy, so as to quickly determine the start time of the performance optimization strategy and other measurement information in a measurement scene, and further perform corresponding fault analysis or optimization, so as to improve the user experience. In addition, the electronic device changes the program state (i.e., a preposition state) before the target function corresponding to the start breakpoint (i.e., a target breakpoint) is executed to a start state, so as to ensure that the start breakpoint (including a start breakpoint corresponding to one target function and / or different start breakpoints corresponding to different target functions) is not repeatedly triggered in the content loading process, i.e., the start breakpoint can be triggered only once in the entire content loading process, so as to ensure that the triggering of the start breakpoint accurately reflects the start node of the content loading process. When the interpreter is currently interpreting and executing a key function (i.e., a target function) corresponding to a target breakpoint that is a delay preposition breakpoint, and the trigger condition corresponding to the delay preposition breakpoint is met, the electronic device changes the program state (i.e., a preposition state) before the target function corresponding to the delay preposition breakpoint (i.e., a target breakpoint) is executed to a delay preposition state, so as to ensure that the delay preposition breakpoint (including a delay preposition breakpoint corresponding to one target function and / or different delay preposition breakpoints corresponding to different target functions) is not repeatedly triggered in the content loading process, i.e., the delay preposition breakpoint can be triggered only once in the entire content loading process, so as to ensure that the triggering of the delay preposition breakpoint accurately reflects the delay preposition node of the content loading process, and improve the positioning accuracy.

[0030] In a possible implementation, if the target stake point is a delay stake point and the trigger condition corresponding to the delay stake point is met, the method can further include: if the target stake point is the delay stake point and the trigger condition corresponding to the delay stake point is met, sending delay information, the delay information being used to trigger the end stake point after the preset time; during the preset time in which the delay message waits in the message queue and a process of executing a next target function, continuously determining whether the trigger condition of the delay stake point is met; if the trigger condition of the delay stake point is met, removing the delay message previously sent in the message queue, sending a latest delay message, and updating the latest delay message to the message queue; and if the trigger condition of the delay stake point is not met, triggering the end stake point after the delay message passes the preset time.

[0031] In the embodiment of the present application, when the interpreter currently interprets a target stake point corresponding to a key function (i.e., a target function) being executed as a delay stake point and the trigger condition corresponding to the delay stake point is met, delay information that can be used to trigger an end stake point after a preset time (e.g., 500 ms) can be sent. Further, during the preset time (e.g., 500 ms) in which the delay message waits in the message queue and a process of executing a next target function, it is continuously determined whether the trigger condition of the delay stake point is met. If the trigger condition of the delay stake point is met, the delay message previously sent in the message queue is removed, a latest delay message is sent, and the latest delay message is updated to the message queue. In this way, when the delay stake point is repeatedly triggered (e.g., a delay stake point corresponding to a target function is repeatedly triggered and / or different delay stake points corresponding to different target functions are repeatedly triggered), the preset time corresponding to the last triggered delay stake point is terminated, the preset time corresponding to the current delay stake point is started, and the end stake point is triggered to end the performance optimization strategy before the preset time (e.g., 500 ms) ends without the delay stake point being triggered again. Through the embodiment of the present application, the trigger time of the end stake point can be dynamically adjusted, so that in a scenario in which a loading process is relatively complex (e.g., a content loading scenario in which it is difficult to find a key function with strong logical correlation as the end stake point), the end stake point of the performance optimization strategy does not need to be a key function related to a loading logic, and the content loading process can be accurately controlled to control the electronic device to execute the corresponding performance optimization strategy, thereby reducing the loading time to improve the user experience.

[0032] In a possible implementation, the end stub point is further configured to record a time when the performance optimization strategy ends, and change the pre-state to an end state; and the method further includes: when the end stub point is triggered, triggering the performance optimization strategy to end, recording the time when the performance optimization strategy ends, and changing the pre-state to the end state.

[0033] In the embodiments of the present application, the end stub point can also be used to record the time when the performance optimization strategy ends, and change the pre-state before the program is executed to the target function corresponding to the target stub point to the start state to the end state. Accordingly, when the end stub point is triggered, the electronic device triggers the performance optimization strategy to end, records the time when the performance optimization strategy ends, and changes the pre-state before the program is executed to the target function corresponding to the target stub point to the end state, so as to ensure that the triggering of the end stub point can accurately reflect the end node of the content loading process. Further, the electronic device ends the performance optimization strategy while recording the time when the performance optimization strategy is triggered to end, which is beneficial to monitor the process of the electronic device executing the performance optimization strategy, so as to quickly determine the end time of the performance optimization strategy and other performance measurement information, so as to facilitate corresponding fault analysis or optimization in the performance measurement scenario of the third-party application, and improve the user experience.

[0034] In a second aspect, the embodiments of the present application provide a performance optimization system based on an interpreter, which includes a stubbing module and a performance management module; the stubbing module is configured to: perform stubbing Hook processing on a target function, and determine a target stub point corresponding to the target function; the target function is a function currently interpreted and executed by the interpreter, and one target function corresponds to one target stub point; when the target function is executed, it is determined whether the triggering condition of the target stub point is met; the type of the target stub point includes a start stub point and a delay stub point, the start stub point is used to trigger the execution of a performance optimization strategy, the delay stub point is used to trigger an end stub point after a preset time, and the end stub point is used to trigger the end of the performance optimization strategy; the performance management module is configured to: if the target stub point is a delay stub point and the triggering condition corresponding to the delay stub point is met, terminate the preset time corresponding to the last triggered delay stub point, start the preset time corresponding to the current delay stub point, and trigger the end stub point after the preset time.

[0035] By the embodiment of the present application, when repeatedly triggering a delay stake point (for example, repeatedly triggering a delay stake point corresponding to a target function and / or different delay stake points corresponding to different target functions), the preset time corresponding to the last triggered delay stake point is terminated, and the preset time corresponding to the current delay stake point is started, so that the triggering time of the end stake point is dynamically adjusted, so that in a scene in which the loading process is relatively complex (for example, a content loading scene in which it is difficult to find a key function with strong logical correlation as an end stake point), without finding a key function related to the loading logic as an end stake point of the performance optimization strategy, the content loading process can be accurately controlled to control the electronic device to execute the corresponding performance optimization strategy, thereby reducing the loading time to improve the user experience.

[0036] In a possible implementation, the instrumenting module is further configured to: obtain function information of a function to be interpreted and executed, the function information comprising a function name of the function; determine, based on the function information and a pre-obtained configuration file, whether the function is a key function, the configuration file comprising one or more key functions respectively corresponding to function names; and determine, in a case where the function is the key function, that the function is the target function.

[0037] In a possible implementation, the instrumenting module is specifically configured to: determine, based on the function information and the configuration file, whether there is a function name same as the function name of the function in the configuration file; if there is, determine that the function is the corresponding key function; and if there is not, determine that the function is a non-key function.

[0038] In a possible implementation, the instrumenting module is further configured to: determine, based on the target stake point, stake point information corresponding to the target stake point; the stake point information comprising position information, a triggering condition, and a triggering rule; the position information is used to indicate an instrumenting position of the target stake point in the target function, the triggering condition is used to indicate a condition under which the target stake point is triggered, and the triggering rule is used to indicate an operation performed when the target stake point is triggered.

[0039] In a possible implementation, the instrumenting module is specifically configured to: when the target function is executed, determine, based on the stake point information corresponding to the target function, whether the triggering condition of the target stake point is met at present.

[0040] In a possible implementation, the type of the target stake point further comprises a start pre-stake point and / or a delay pre-stake point; the start pre-stake point is used to change a pre-state to a start pre-state, and the delay pre-stake point is used to change the pre-state to a delay pre-state, the pre-state being a program state before execution of a target function corresponding to the target stake point.

[0041] In a possible implementation, the start stub point is further used to record a time of triggering the performance optimization strategy and change the pre-state to a start state; and the end stub point is further used to record a time of ending the performance optimization strategy and change the pre-state to an end state.

[0042] In a possible implementation, the performance optimization strategy comprises increasing a working frequency of a processor.

[0043] In a possible implementation, the type of the target stub point further comprises the start pre-state; and the stubbing module is specifically configured to: if the target stub point is the start stub point, determine whether the pre-state is the start pre-state based on stub point information corresponding to the start stub point; if yes, determine that the triggering condition corresponding to the start stub point is met; and if no, determine that the triggering condition corresponding to the start stub point is not met.

[0044] In a possible implementation, the type of the target stub point further comprises the delay pre-state; and the stubbing module is specifically configured to: if the target stub point is the delay stub point, determine whether the pre-state is the delay pre-state based on stub point information corresponding to the delay stub point; if yes, determine that the triggering condition corresponding to the delay stub point is met; and if no, determine that the triggering condition corresponding to the delay stub point is not met.

[0045] In a possible implementation, the stubbing module is specifically configured to: if the target stub point is the delay pre-state, determine whether the pre-state is the start state based on stub point information corresponding to the delay pre-state; if yes, determine that the triggering condition corresponding to the delay pre-state is met; and if no, determine that the triggering condition corresponding to the delay pre-state is not met.

[0046] In a possible implementation, the performance management module is further configured to: if the target stub point is the start pre-state and the triggering condition corresponding to the start pre-state is met, change the pre-state to the start pre-state; if the target stub point is the start stub point and the triggering condition corresponding to the start stub point is met, trigger the performance optimization strategy, record a time of triggering the performance optimization strategy, and change the pre-state to the start state; and if the target stub point is the delay pre-state and the triggering condition corresponding to the delay pre-state is met, change the pre-state to the delay pre-state.

[0047] In a possible implementation, the performance management module is specifically configured to: if the target stake point is the delay stake point, and the trigger condition corresponding to the delay stake point is met, send a delay message, the delay message being used to trigger the end stake point after the preset time; during the preset time when the delay message is waiting in the message queue, and a process of executing a next target function, continue to determine whether the trigger condition of the delay stake point is met at present; if yes, remove the delay message sent previously in the message queue, send a latest delay message, and update the latest delay message to the message queue; if no, trigger the end stake point after the delay message passes the preset time.

[0048] In a possible implementation, the end stake point is further configured to record a time of ending the performance optimization strategy, and change the preposition state to an end state; and the performance management module is further configured to: when the end stake point is triggered, trigger the ending of the performance optimization strategy, record the time of ending the performance optimization strategy, and change the preposition state to the end state.

[0049] In a third aspect, an electronic device is provided, which can include a memory and a processor, wherein the memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory, so that the electronic device executes the method in any possible implementation manner of the first aspect.

[0050] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the method in any possible implementation manner of the first aspect.

[0051] In a fifth aspect, a computer program product is provided, which, when running on a computer, causes the computer to execute the method in any possible implementation manner of the first aspect.

[0052] It can be understood that the system provided in the second aspect, the electronic device provided in the third aspect, the computer readable storage medium provided in the fourth aspect, and the computer program product provided in the fifth aspect are all used to execute the method provided in the embodiments of the present application. Therefore, the beneficial effects that can be achieved are referred to the beneficial effects in the corresponding method, which will not be described here. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background art, the drawings needed to be used in the embodiments of the present application or the background art will be described below.

[0054] Figures 1-4 is a user interface schematic diagram of a set of electronic devices provided by embodiments of the present application.

[0055] Figure 5 is a running schematic diagram of a third-party application provided by embodiments of the present application.

[0056] Figure 6 is a hardware structure schematic diagram of an electronic device provided by embodiments of the present application.

[0057] Figure 7 is a software structure block diagram of an electronic device provided by embodiments of the present application.

[0058] Figure 8 is another software structure block diagram of an electronic device provided by embodiments of the present application.

[0059] Figure 9 is a Hook method flow schematic diagram provided by embodiments of the present application.

[0060] Figure 10 is a flow schematic diagram of a performance optimization method based on an interpreter provided by embodiments of the present application.

[0061] Figure 11 is a specific flow schematic diagram of a performance optimization method based on an interpreter provided by embodiments of the present application.

[0062] Figure 12 is a flow schematic diagram of a performance optimization method in which a stub point is triggered provided by embodiments of the present application.

[0063] Figure 13 is a flow schematic diagram of a performance optimization method in which a delay stub point is triggered provided by embodiments of the present application.

[0064] Figure 14 is a schematic diagram of a dynamic search end point provided by embodiments of the present application.

[0065] Figure 15 is a flow schematic diagram of a performance optimization method in which a delay stub point is triggered provided by embodiments of the present application.

[0066] Figure 16 is a structure schematic diagram of a performance optimization device provided by embodiments of the present application.

[0067] Figure 17 is another hardware structure schematic diagram of an electronic device provided by embodiments of the present application. DETAILED DESCRIPTION

[0068] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " represents the meaning of or, for example, A / B can represent A or B; "and / or" in the text only represents a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0069] The term "user interface (UI)" in the following embodiments of the present application is a medium interface for interaction and information exchange between an application program or an operating system and a user, which realizes the conversion between the internal form of information and the form that the user can accept. The user interface of the application program is the source code written by a specific computer language such as Java, extensible markup language (XML), etc. The interface source code is parsed, rendered on the electronic device, and finally presented as content that the user can recognize, such as pictures, texts, button controls, etc. The control (widget) is the basic element of the user interface, and typical controls include toolbar, menu bar, text box, button, scrollbar, picture and text. The properties and content of the controls in the interface are defined by tags or nodes, such as XML <textview> 、 <imgview> 、 <videoview>The interface contains controls defined by nodes. One node corresponds to one control or attribute in the interface, and the node is rendered into content visible to the user after parsing and rendering. In addition, many applications, such as hybrid applications, usually also contain web pages in the interface. A web page, also referred to as a page, can be understood as a special control embedded in the interface of an application. The web page is a source code written in a specific computer language, such as hyper text markup language (HTML), cascading style sheets (CSS), JavaScript (JS), etc. The web page source code can be loaded and displayed into content recognizable to the user by a browser or a web page display component similar to the function of the browser. The specific content contained in the web page is also defined by tags or nodes in the web page source code, such as HTML through 、 、 <video> 、 <canvas>to define the elements and attributes of the web page.

[0070] A common form of user interface is a graphic user interface (GUI), which refers to a user interface that displays in a graphical manner. It can be an icon, a window, a control, etc. interface element displayed in the display screen of an electronic device, wherein the control can include an icon, a button, a menu, a tab, a text box, a dialog box, a status bar, a navigation bar, a Widget, and the like visible interface element.

[0071] In addition, embodiments for using such electronic devices, user interfaces for such electronic devices, and electronic devices are also introduced below. In some embodiments, the electronic device can be a portable electronic device that also contains other functions such as message management, message receiving and pushing functions, such as a mobile phone, a tablet computer, a wearable electronic device (such as a smart watch) with wireless communication function, and the like. Exemplary embodiments of the portable electronic device include, but are not limited to, a portable electronic device running an operating system such as Android, iOS, Windows Phone, or other operating system. The portable electronic device described above can also be other portable electronic devices, such as a laptop computer (Laptop) with a touch-sensitive surface or touch panel. It should also be understood that in other embodiments, the electronic device described above can not be a portable electronic device, but a desktop computer, an in-vehicle computer, etc. with a touch-sensitive surface or touch panel. It can be understood that the embodiments of the present application are introduced by taking a smart phone as an example, but are not limited to a smart phone, and can also be other smart devices with communication function, such as a smart watch, a smart bracelet, etc. It can be understood that the embodiments of the present application are introduced by taking a smart phone as an example, but are not limited to a smart phone, and can also be other smart devices with communication function, such as a smart watch, a smart bracelet, etc.

[0072] In order to facilitate understanding of the embodiments of the present application, the technical problems to be solved by the embodiments of the present application are analyzed in detail below.

[0073] With the development of the Internet, in order to facilitate life and entertainment, users download and use more and more third-party software in the application market of the electronic device. However, for users, the content loading process of various related functions or associated applications in the third-party application is particularly important, which can quickly respond to user operations (such as opening the third-party application or clicking the page), quickly load and display the page content, and can bring better user experience to the user.

[0074] Please refer to the accompanying drawings Figure 1 to the accompanying drawings Figure 4 , Figures 1-4 are a group of user interface schematic diagrams of electronic devices provided by the embodiments of the present application.

[0075] First, the electronic device can display a user interface as shown in Figure 1 , which is a user interface as shown in Figure 1 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 2 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 2 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 2 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 3 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in

[0076] Currently, due to the overall temperature control limitations of the electronic device and other related influencing factors, before displaying a user interface as shown in Figure 3 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 4 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 4 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in Figure 4 The illustrated user interface is an entry user interface of a mini-program accessed through WeChat. The user interface can include one or more third-party applications (for example, a shopping mini-program 101). The user can click (or other user operations) the shopping mini-program 101. In the case of a very short content loading time, the electronic device can quickly respond to the user's click operation and display a user interface as shown in

[0077] Exemplarily, please refer to Table 1 below. Table 1 is a table of content loading time of a third-party application (for example, a shopping mini-program) running on different electronic devices at different temperatures in the prior art.

[0078] Table 1

[0079]

[0080] As shown in Table 1 above, the content loading time of the third-party application (for example, a shopping mini-program) running on different electronic devices will become longer as the temperature rises. This is because when the temperature of the electronic device rises, the processor (Central Processing Unit, CPU) will automatically reduce the frequency to reduce power consumption and temperature. The higher the temperature of the electronic device, the lower the working frequency of the processor. Therefore, the content loading time of the third-party application is longer, and the display time of the user interface as shown in Figure 4 The longer the user's experience is worse. Therefore, it is necessary to shorten the display time of the user interface as shown in Figure 4 The display time of the user interface is shown to improve the user experience. It can be understood that the above-mentioned user interface is only an example of the loading application interface of the third-party application, and different loading application interfaces can be presented for different third-party applications, and do not limit the embodiments of the present application.

[0081] The electronic device does not involve the relevant running events of the operating system in the running of the third-party application. Please refer to the accompanying drawings Figure 5 , Figure 5 is a running schematic diagram of a third-party application provided by an embodiment of the present application. As Figure 5 shown, when the third-party application runs, it is often a collection of multiple functions. By taking the key functions related to the loading logic as the starting point and the ending point of the content loading process, the frequency adjustment optimization is started based thereon. In the prior art, when the third-party application loads content, the working frequency of the corresponding processor is higher than that of the processor at the initial running time, thereby shortening the content loading time and improving the user experience. However, for some complex loading scenarios (for example, a content loading scenario in which it is difficult to find a key function with strong logical correlation as an ending point), the corresponding performance optimization strategy cannot be effectively issued, the content loading speed is not improved, and the user experience is poor. Therefore, the embodiment of the present application provides a performance optimization method based on an interpreter and a related electronic device, which can dynamically adjust the triggering time of the ending stake point, so that in a complex loading scenario (for example, a content loading scenario in which it is difficult to find a key function with strong logical correlation as an ending stake point), the key function related to the loading logic does not need to be found as the ending stake point of the performance optimization strategy, and the content loading process can be accurately controlled to control the electronic device to execute the corresponding performance optimization strategy to improve the performance of the processor, thereby shortening the loading time of a certain page content in the third-party application and improving the user experience.

[0082] The specific implementation of the method is described in detail in the following related embodiments, and the embodiments of the present application are not described here.

[0083] First, the following example takes the electronic device 100 as an example to introduce the above-mentioned Figures 1-4 electronic device.

[0084] Please refer to the accompanying drawings Figure 6 , Figure 6 is a hardware structure schematic diagram of an electronic device provided by an embodiment of the present application.

[0085] The following will be described in detail with the electronic device 100 as an example. It should be understood that the electronic device 100 is a smart terminal device, which can be of various types, and the embodiments of the present application do not limit the specific type thereof. For example, the electronic device can be a mobile phone, and can also include a tablet computer, a desktop computer, a desktop computer with a touch-sensitive surface or a touch panel, a laptop, a handheld computer, a notebook computer, a smart screen, a wearable device (such as a smart watch, a smart bracelet, etc.), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a car machine, a smart earphone, a game machine, and can also be an internet of things (IOT) device or a smart home device such as a smart water heater, a smart lamp, a smart air conditioner, etc.

[0086] The electronic device 100 can include a processor 101, a memory 102, a wireless communication module 103, a mobile communication module 104, an antenna 103A, an antenna 104A, a power switch 105, a sensor module 106, a focusing motor 107, a camera 108, a display screen 109, a display screen controller 110, a power management module 111, a battery 112, etc. The sensor module 106 can include a gyroscope sensor 106A, an acceleration sensor 106B, an ambient light sensor 106C, an image sensor 106D, a distance sensor 106E, etc. The wireless communication module 103 can include a WLAN communication module, a Bluetooth communication module, etc. The above-mentioned multiple parts can transmit data through a bus.

[0087] The processor 101 is a control center of the electronic device 100, connects each part of the entire electronic device 100 by using various interfaces and lines, performs various functions of the electronic device 100 and processes data by running or executing software programs and / or modules stored in the memory 102 and calling data stored in the memory 102, and thus performs overall control of the electronic device 100. Optionally, the processor 101 can include one or more processing units, for example, the processor 101 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units can be independent devices, or can be integrated in one or more processors.

[0088] The memory 102 can be used to store software programs and modules, and the processor 101 performs various functions of the electronic device 100 and data processing by running the software programs and modules stored in the memory 102. The memory 102 can include, but is not limited to, a read-only memory (ROM), a static random access memory (SRAM), a synchronous dynamic random access memory (SDRAM), or a random access memory (RAM), etc. Further, the memory 102 can include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), etc.; and the data storage area can store data created according to the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.

[0089] The wireless communication function of the electronic device 100 can be realized by the antenna 103A, the antenna 104A, the mobile communication module 104, the wireless communication module 103, the modem processor, and the baseband processor, etc.

[0090] The antenna 103A and the antenna 104A can be used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of the antennas.

[0091] The mobile communication module 104 can provide a solution including 2G / 3G / 4G / 5G wireless communication applied to the electronic device 100. The mobile communication module 104 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like. The mobile communication module 104 can receive electromagnetic waves by the antenna 104A, and perform filtering, amplification, and the like on the received electromagnetic waves, and transfer the processed signals to the modem processor for demodulation. The mobile communication module 104 can also amplify the signals modulated by the modem processor, and radiate the signals as electromagnetic waves through the antenna 104A.

[0092] The modem processor can include a modulator and a demodulator. The modulator is used to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transfers the demodulated low-frequency baseband signal to the baseband processor for processing. The low-frequency baseband signal processed by the baseband processor is transmitted to the application processor. The application processor outputs a sound signal through an audio device, or displays an image or a video through the display screen 109.

[0093] The wireless communication module 103 can provide a solution including wireless local area networks (WLAN), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), and the like, applied to the electronic device 100. The wireless communication module 103 can be one or more devices integrated with at least one communication processing module. The wireless communication module 103 receives electromagnetic waves via the antenna 103A, performs frequency modulation and filtering processing on the electromagnetic wave signals, and transmits the processed signals to the processor 101. The wireless communication module 103 can also receive signals to be transmitted from the processor 101, perform frequency modulation and amplification, and radiate the signals as electromagnetic waves through the antenna 103A.

[0094] The power switch 105 can be used to control the power supply to the electronic device 100.

[0095] The gyroscope sensor 106A can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 106A. The gyroscope sensor 106A can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 106A detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate according to the angle, and makes the lens offset the shaking of the electronic device 100 by reverse movement to achieve anti-shake. The gyroscope sensor 106A can also be used for navigation and motion sensing game scenarios.

[0096] The acceleration sensor 106B can detect the acceleration of the electronic device 100 in various directions (usually three axes). When the electronic device 100 is stationary, the acceleration sensor 106B can detect the size and direction of gravity. It can also be used to identify the posture of the electronic device, for example, the acceleration sensor 106B can be applied to landscape / portrait screen switching, pedometer, etc.

[0097] The ambient light sensor 106C is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 109 according to the sensed brightness of the ambient light. The ambient light sensor 106C can also be used to automatically adjust the white balance when shooting.

[0098] The image sensor 106D, also known as a photosensitive element, can convert the light image on the photosensitive surface into an electrical signal in a corresponding proportional relationship with the light image by using the photoelectric conversion function of the photoelectric device. The image sensor can be a charge coupled device (CCD) sensor or a complementary metal-oxide-semiconductor (CMOS) sensor.

[0099] The distance sensor 106E can be used to measure distance. The electronic device 100 can measure distance by infrared or laser. In some shooting scenarios, the electronic device 100 can use the distance sensor 106E to measure distance to achieve fast focusing.

[0100] The focus motor 107 can be used for fast focusing. The electronic device 100 can control the movement of the lens by the focus motor 107 to achieve automatic focusing.

[0101] The electronic device 100 can realize the shooting function through the ISP, the camera 108, the video codec, the GPU, the display screen 109, and the application processor, etc.

[0102] ISP is used to process data fed back by the camera 108. For example, when taking a photo, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, and the optical signal is converted into an electrical signal. The camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into a visible image. The ISP can also optimize the noise and brightness of the image through an algorithm. The ISP can also optimize the exposure, color temperature, and other parameters of the shooting scene. In some embodiments, the ISP can be arranged in the camera 108.

[0103] The camera 108 can be used to capture still images or videos. Objects generate optical images through lenses and project them onto image sensors. The image sensor can convert the optical signal into an electrical signal, and then transmit the electrical signal to the ISP to convert it into a digital image signal. The ISP can output the digital image signal to the DSP for processing. The DSP converts the digital image signal into a standard RGB, YUV, or other format image signal. In some embodiments, the electronic device 100 can include one or N cameras 108, where N is a positive integer greater than 1.

[0104] The video codec is used to compress or decompress digital images. The electronic device 100 can support one or more image codecs. In this way, the electronic device 100 can open or save pictures or videos in multiple encoding formats.

[0105] The electronic device 100 can implement display functions through the GPU, the display screen 109, the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 109 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 101 can include one or more GPUs that execute program instructions to generate or change display information.

[0106] The display screen 109 is used to display images, videos, etc. The display screen 109 includes a display panel. The display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active-matrix organic light-emitting diode (AMOLED), flex light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 can include one or N display screens 109, where N is a positive integer greater than 1.

[0107] The display screen controller 110, which can also be referred to as a display screen IC controller, can be configured to control the display of images, brightness, color, and other parameters on the display screen 109. The display screen controller 110 can be implemented as an electronic chip or integrated circuit that controls and manages the parameters of the display screen 109 to control the hardware functions of the display screen, such as adjusting the brightness of the display screen, rendering images, and generating the final image output. In some embodiments, the GPU can be integrated on the same chip as the display screen controller 110, but the functions are separate. The GPU can perform image computation, and the display screen controller 110 manages the hardware characteristics of the display screen 109.

[0108] The power management module 111 can be connected to the battery 112 to detect the state of the battery 112 and control the charging and discharging process to manage the power supply and power consumption of the electronic device 100 and ensure the safe and efficient use of the battery 112. In addition, the power management module 111 can also control the electronic device 100 to enter the sleep mode, turn off the display screen 109 by sending corresponding instructions to the display screen controller 110, and also wake up the device when the electronic device 100 needs to resume normal operation to reduce power consumption.

[0109] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different component arrangements. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0110] Please refer to Figure 7 , Figure 7 is a software structure block diagram of an electronic device provided by an embodiment of the present application.

[0111] As Figure 7 indicated, the software structure block diagram can be applied to the hardware architecture of the electronic device 100 as illustrated in Figure 6 , the layered architecture can divide the software in the electronic device 100 into several layers, each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In other embodiments, the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer (which can also be referred to as the application management layer in the embodiments of the present application), the Android runtime and the system library, and the kernel layer.

[0112] The application layer can include a series of application packages.

[0113] As Figure 7 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, and health.

[0114] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0115] In some embodiments, the application framework layer can obtain a configuration file, which includes the function names corresponding to one or more key functions. Based on this configuration file, it can be used to determine whether a function is a key function when the application calls a function and to perform instrumentation and hooking.

[0116] like Figure 7 As shown, the application framework layer may include a display manager, a sensor manager, a cross-device connectivity manager, an event manager, an activity manager, a window manager, a content provider, a view system, a resource manager, a notification manager, etc.

[0117] The display manager is used for system display management, and is responsible for managing all display-related tasks, including creation, destruction, orientation switching, size and status changes. Generally, there will only be one default display module, i.e., the main display module, on a single device.

[0118] The sensor manager is responsible for managing the state of the sensors and managing applications to monitor sensor events and report the events to the applications in real time.

[0119] The cross-device connection manager is used to establish communication connections with other devices.

[0120] The Event Manager is used for the system's event management services. It is responsible for receiving events uploaded from the underlying layer and distributing them to various windows, completing tasks such as event reception and distribution.

[0121] The Task Manager is used to manage Activity components, including startup management, lifecycle management, and task direction management.

[0122] The window manager is used to manage window applications. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture screenshots. The window manager is also responsible for window display management, including window display mode, size, coordinate position, and hierarchy.

[0123] For details on the execution process of the above embodiments, please refer to the relevant content on human-computer dialogue methods below.

[0124] The content provider stores and retrieves data and makes it accessible to applications. The data can include videos, images, audio, dialed and received calls, browsing history and bookmarks, phonebook, etc.

[0125] The view system includes visual controls, such as controls that display text, controls that display pictures, etc. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface that includes a short message notification icon can include a view that displays text and a view that displays a picture.

[0126] The resource manager provides various resources for an application, such as localized strings, icons, pictures, layout files, video files, etc.

[0127] The notification manager enables an application to display notification information in the status bar, which can be used to convey a message of the notification type that can automatically disappear after a short stay without user interaction. For example, the notification manager is used to notify the completion of a download, a message reminder, etc. The notification manager can also be a notification that appears in the form of a chart or a scroll bar text in the top status bar of the system, such as a notification of an application running in the background, or a notification that appears in the form of a dialog window on the screen. For example, a text message is prompted in the status bar, a prompt sound is emitted, the electronic device vibrates, the indicator light flashes, etc.

[0128] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.

[0129] The core library contains two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.

[0130] The application layer and the application framework layer are both run in the virtual machine. The virtual machine executes the java files of the application layer and the application framework layer into binary files, provides an isolated running environment, is responsible for loading, interpreting or compiling program code, and performs corresponding operations. The virtual machine is used to perform object lifecycle management, stack management, thread management, security and exception management, and garbage collection functions.

[0131] The system library (also referred to as the data management layer) can include multiple functional modules. For example: hardware abstraction layer (Hardware Abstraction Layer, HAL), surface manager, media library (Media Libraries), three-dimensional graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL) and event data, etc.

[0132] The Hardware Abstraction Layer (HAL) can be used to provide an abstract interface to specific hardware devices, such as providing an abstract interface to hardware for virtual machines, so that programs running on them can be independent of the underlying hardware.

[0133] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0134] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0135] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0136] A 2D graphics engine is a graphics engine for 2D drawing.

[0137] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0138] In one possible implementation, please refer to the appendix. Figure 8 , Figure 8 This is a software structure block diagram of another electronic device provided in an embodiment of this application.

[0139] It should be noted that, as Figure 8 The software structure shown is based on the above. Figure 7 The software structure shown is illustrated in one embodiment applicable to this application.

[0140] like Figure 8 As shown in the embodiments of this application, the application layer may also include third-party applications, which may be third-party applications that users can download and install through app stores, or mini-programs that users can run directly on a specific platform without installation. This embodiment of the application does not limit this. The application framework layer may also include a performance management module (e.g., IAware) and an instrumentation module for intelligent sensing and energy consumption management. The instrumentation module can perform targeted system optimization or maintenance information processing on the third-party application based on configuration files and latency information in the message queue.

[0141] Specifically, the instrumentation module can instrument the critical functions in the third-party application to be interpreted and executed based on the configuration file, and send a message to the message queue when the stub point is triggered, so that the performance management module can make corresponding processing based on the message queue. In addition, the message queue supports asynchronous communication mode, and the instrumentation module can continue to perform other operations after putting the message into the message queue without waiting for the response of the message, thereby improving the performance of the system.

[0142] The performance management module can include a third-party application program for process creation, and a performance monitoring and energy consumption management submodule. The performance monitoring submodule can monitor and analyze the real-time performance of the system by intelligently sensing the running state and user behavior of the system, so as to adjust and optimize the system in a timely manner according to the corresponding monitoring information. The energy consumption management submodule can intelligently manage the system resources such as CPU and memory according to the system load and performance requirements, thereby executing corresponding performance optimization strategies.

[0143] The hardware abstraction layer (HAL) can include a compiler and an interpreter. In addition to display drivers, camera drivers, audio drivers, and sensor drivers, the kernel layer can also include function modules scheduled by the kernel part, which are responsible for managing and scheduling various processes or threads running in the system. The embodiments of the present application do not elaborate on each function module, and the specific description of each function module can be referred to the related description below.

[0144] Specifically, the compiler is responsible for converting source code written in one programming language into another computer code, which is usually in binary form and is called object code. The purpose of this conversion process is usually to generate an executable program, which is then executed by computer hardware. For example, the compiler can compile the entire source code of the third-party application into machine code, so that the hardware of the electronic device can directly execute the compiled machine code.

[0145] The interpreter is used to directly execute code written in a programming language or a scripting language, and does not pre-compile the source code into machine code. For example, an interpreter usually executes program code in the following ways: the interpreter reads the source code of the third-party application line by line, i.e., analyzes the source code line by line (for example, the java file corresponding to the third-party application), and directly executes it; or, the source code is translated into relatively more efficient intermediate code, which is then executed immediately; or, the code pre-compiled and saved by the compiler inside the interpreter is executed. It can be understood that the interpreter can be regarded as a black box, and the source code is input, and the result is returned in real time.

[0146] For example, in the embodiment of the present application, the interpreter can continue to interpret and execute the corresponding next function in the third-party application after the delay information is updated into the message queue.

[0147] For another example, in the case that it is determined that the function currently being interpreted and executed is not a critical function, the function is continued to be interpreted and executed. The interpreter can interpret and execute the function corresponding to the third-party application, and can also interpret and execute the hook function after the function corresponding to the third-party application is instrumented, and the embodiment of the present application is not limited in this regard.

[0148] In the embodiment of the present application, the instrumenting module can be used to instrument Hook the function currently interpreted and executed by the interpreter (i.e., the target function) to determine the target breakpoint corresponding to the target function. Hook refers to intercepting the original function originally to be called in the original target application program through a hook program, modifying the entry address of the original function to the entry address of the hook function, so as to realize the function of calling the hook function before executing the call to the original function, thereby realizing the modification or expansion of the function corresponding to the target application program. In the process of program running, the operations of inserting, removing and changing the hook program can be called dynamic hooking. Dynamic hooking can be realized by using the dynamic hooking mechanism, and the function of the target application program can be modified and expanded flexibly.

[0149] By instrumenting Java functions that are about to be executed or are currently being executed in a third-party application—that is, by hooking key functions (i.e., instrumentation)—the corresponding target stubs can be identified. Based on this instrumentation information, the location of key events in the third-party application can be indicated, thereby enabling targeted optimization of the application's performance and improving the user experience. For example, instrumentation can be performed when a third-party application calls a function at the start point and a delay point during the content loading process. This allows the electronic device's operating system to locate the start and delay stubs of the content loading process. The start stub triggers the execution of a performance optimization strategy, the delay stub triggers the end stub after a preset time, and the end stub triggers the termination of the performance optimization strategy. Based on these start and delay stubs, relevant performance metrics such as the content loading time of the third-party application can be determined. Furthermore, by repeatedly triggering the delay stub (e.g., repeatedly triggering the delay stub corresponding to a target function and / or different target functions), further performance optimization can be achieved. By using different delay stubs, the preset time corresponding to the previously triggered delay stub is terminated, and the preset time corresponding to the current delay stub is started, thereby dynamically adjusting the trigger time of the end stub. This allows for the control and execution of corresponding performance optimization strategies based on the performance optimization module for various complex content loading scenarios. For example, the processor's working frequency during the content loading process of third-party applications can be adjusted (e.g., increased). This can significantly reduce the content loading time of third-party applications while allowing for more flexible and accurate control over the triggering and termination of performance optimization strategies to adapt to various content loading scenarios, greatly improving the user experience.

[0150] The specific implementation methods of each of the above modules can be referred to in the following related embodiments, which will not be elaborated here.

[0151] Additionally, please refer to the appendix. Figure 9 , Figure 9 This is a schematic diagram of a hook instrumentation method provided in an embodiment of this application, such as... Figure 9 As shown, after the electronic device is powered on, the Iaware process is automatically started, and configuration files are automatically scanned and read by Iaware. These configuration files contain the system's management policies for different scenarios (which may be performance, resource, or other control scenarios). Once the configuration files are read, Iaware will start a process to execute these management scenarios to control system characteristics and ensure that the system has the best configuration during runtime to achieve more efficient performance or resource management. Further, Iaware initializes and configures various characteristics, functions, or resources in the system to ensure that the system can run in the best state at startup or during operation. After the characteristics are initialized, Iaware reads the configuration files of some initialized parameters or characteristics to ensure that the system configuration can reflect the latest requirements and conditions during actual operation. Then iAware can respond to Binder to pass specific data, configuration information, or perform corresponding control operations to enable effective communication and cooperation between different processes. Binder is a mechanism for inter-process communication in the Android system, and cross-process object transmission can be achieved by passing Binder objects between processes.

[0152] Further, during the application compilation phase, the dex2oat process is first started, which is responsible for converting the Dalvik bytecode of the Android application into native machine code to improve the efficiency of the application. In this process, the Binder mechanism is needed to obtain function information. After obtaining the function information related to Binder, the inline operation of the intercepted associated function is further compiled. Inline is a compiler optimization technique that replaces the code at the function call site with the actual code of the called function to reduce the overhead of function calls. The inline operation of the intercepted associated function facilitates subsequent identification of key functions based on the names of the key functions.

[0153] Further, in the application process phase, when the application is started, the interaction with the three-party process is involved, including the creation of the three-party process, the acquisition of function information through Binder, the transmission of information to the runtime through the Java native interface (JNI), and the loading of the function to determine and mark the process. Specifically, when the application is started, a three-party process related to the application is created, which can be used to perform some specific tasks, provide services, or perform other processing required by the application. Then through the Binder mechanism, information related to a specific function is obtained, and then the obtained function information is transmitted to the runtime through the Java native interface (JNI). JNI is an interface provided by the Java virtual machine to realize the interaction between Java programs and native code. Finally, when the function is loaded, the key functions are determined and marked, so that corresponding operations (such as hooking operations, etc.) are performed in the subsequent execution process. When the application is running, the execution of the key function, the triggering of the hook point, the sending of the message after the triggering, and the further processing of the hook point message are involved. Specifically, when the application starts running, the key functions are executed, which may include the core logic of the application or the function of performing specific tasks. Further, based on the key function, the corresponding hook point is triggered and the hook message is sent, wherein the triggering of the hook point will inject custom code before or after the execution of the key function, so as to monitor the behavior of the function. The corresponding hook message sent can be used to notify other components or modules that a specific event has occurred, and the message usually includes context information of the triggering hook, event type, etc. Further processing the hook message, judging the event type based on the hook message, and executing specific logic related to the event or taking corresponding measures. So that the application can send messages at a specific time, and then further logical judgment is performed by processing these messages.

[0154] It should be noted that the above method embodiment is only one possible implementation of the hooking method flow provided by the embodiment of the present application, and does not constitute a specific limitation on the following method embodiment. In other embodiments, the hooking method flow can include more or fewer steps, some steps can be performed in other order or simultaneously, or some steps can be omitted, a plurality of steps can be combined into one step, and / or one step can be divided into a plurality of steps.

[0155] Next, based on the software structure shown in the above Figure 8 , the overall flow of the interpreter-based hooking method is exemplarily introduced.

[0156] First of all, it needs to be pointed out that the user involved in the embodiments of the present application and the following related embodiments is the user of the electronic device, and in other embodiments, the user can also be the associate of the electronic device, and the embodiments of the present application do not make specific limitations.

[0157] Secondly, based on the above Figure 8 software structure, the technical problems proposed in the present application are analyzed and solved in combination with the performance optimization method based on the interpreter provided in the present application.

[0158] Please refer to Figure 10 , Figure 10 is a flowchart of a performance optimization method based on an interpreter provided by the embodiments of the present application.

[0159] The performance optimization method based on the interpreter can be applied to the software architecture described in the above Figure 8 The method can be applied to the electronic device described in the above Figure 6 , and can also be implemented through the software architecture in the above Figure 7 , so that the electronic device can be used to support and execute the method flow steps S201-S203 shown in the above Figure 10 . Among them, the specific related description of each step is as follows:

[0160] Step S201: performing Hook processing on the target function to determine the target stake point corresponding to the target function.

[0161] Specifically, the target function is the function currently interpreted and executed by the interpreter, and one target function corresponds to one target stake point. The Hook processing can be performed on the function currently interpreted and executed by the interpreter (i.e. the target function) by the Hook processing module to determine the corresponding target stake point, so as to further judge whether the trigger condition of the target stake point is met based on the target stake point.

[0162] In one possible implementation manner, before performing the Hook processing on the target function, the Hook processing module can also obtain function information of the function to be interpreted and executed, the function information including the function name of the function; based on the function information and the pre-obtained configuration file, it is judged whether the function is a key function, the configuration file including one or more function names corresponding to the key functions respectively. It can be understood that the present application does not make specific limitations on the obtaining manner of the configuration file. In the case where the function is the key function, it is determined that the function is the target function.

[0163] Specifically, the embodiment of the present application can obtain the function name and other related function information of the function to be interpreted and executed, and determine whether the function to be interpreted and executed is a key function based on the pre-obtained configuration file. If the function is a key function, it means that the function is a trigger point of a key event in the application content loading process, and the function can be determined as a target function, so that the function is processed by the hooking, the corresponding target point is determined, and the performance optimization strategy for the content loading process is accurately and efficiently optimized to improve the user experience.

[0164] Further, since the configuration file includes one or more function names corresponding to the key functions respectively, the hooking module can determine whether there is a function name same as the function name of the function in the configuration file based on the function information and the configuration file. If there is, it is determined that the function is the corresponding key function. If there is not, it is determined that the function is a non-key function. The embodiment of the present application can determine whether the function to be interpreted and executed by the interpreter is a key function through the function name, thereby greatly improving the efficiency of confirming the key function, so as to accurately and efficiently determine the trigger execution and end time of the performance optimization strategy, thereby reducing the loading time to improve the user experience.

[0165] It can be understood that if the function to be interpreted and executed is a non-key function, it means that the running function is not a trigger point of a key event of the third-party application when it is called. At this time, the interpreter can still continue to interpret and execute the running function.

[0166] For example, if the configuration file includes the following information: function name A1 of key function 1, function name A2 of key function 2. When determining whether the function to be interpreted and executed is a key function, it is learned that the function name of the function to be interpreted and executed is A1, and it is determined that the function to be interpreted and executed is a key function and is the key function 1 in the configuration file. If the function name of the running function 1 is B2, the function to be interpreted and executed is a non-key function.

[0167] In a possible implementation manner, after the hooking module determines the target point corresponding to the target function, the target point information corresponding to the target point is determined based on the target point. The target point information includes position information, trigger condition and trigger rule. The position information is used to indicate the hooking position of the target point in the target function, the trigger condition is used to indicate the condition of triggering the target point, and the trigger rule is used to indicate the operation performed when the target point is triggered.

[0168] Specifically, based on the position information in the stake point information, the embodiment of the present application can determine the insertion position of the target stake point in the key function (i.e. target function) currently interpreted and executed by the interpreter, to ensure that the target stake point triggered can accurately reflect the key time point of the content loading process; at the same time, based on the trigger condition of the stake point information, it can be determined whether the target stake point is triggered when the corresponding target function is executed, to avoid the situation that the target stake point is triggered in advance or repeatedly triggered; in addition, based on the trigger rule in the stake point information, the operation performed by the electronic device when the target stake point is triggered can be determined, so as to realize the targeted control of the electronic device to execute the corresponding performance optimization strategy in the content loading process, to reduce the loading time to improve the user experience.

[0169] Step S202: When the target function is executed, it is judged whether the trigger condition of the target stake point is met.

[0170] Specifically, when the target function is executed by the electronic device, it is further judged by the insertion module whether the trigger condition of the target stake point is met. Wherein, the type of target stake point includes start stake point and delay stake point, the start stake point is used to trigger the execution of performance optimization strategy, the delay stake point is used to trigger the end stake point after a preset time, and the end stake point is used to trigger the end of the performance optimization strategy. Therefore, for all target functions in the entire content loading process of the third-party application, at least one start stake point and one delay stake point are included, to realize the targeted control of the performance optimization strategy in the content loading process of the application, to avoid the continuous execution of the performance optimization strategy during the application running, which leads to the substantial rise of the temperature of the electronic device, and the automatic frequency reduction makes the performance optimization effect poor.

[0171] In one possible implementation, when the target function is executed, it is judged whether the trigger condition of the target stake point is met, which can include: when the target function is executed, it is judged whether the trigger condition of the target stake point is met based on the stake point information corresponding to the target function.

[0172] Specifically, when the key function (i.e. target function) currently interpreted and executed by the interpreter is executed, the insertion module can determine whether the trigger condition of the corresponding target stake point is met through the stake point information corresponding to the target function, to determine whether the corresponding target stake point is triggered, to avoid the situation that the target stake point is triggered in advance or repeatedly triggered, to improve the accuracy of the electronic device to execute the corresponding performance optimization strategy for the content loading process, to ensure that the target stake point is triggered at the correct time, to reduce the loading time to improve the user experience.

[0173] In a possible implementation, the type of the target stake point can further include a start pre-stake point and / or a delay pre-stake point; the start pre-stake point can be used to change the pre-state to a start pre-state, and the delay pre-stake point can be used to change the pre-state to a delay pre-state, where the pre-state is a program state before execution of a target function corresponding to the target stake point.

[0174] Specifically, the start pre-stake point can be used to change the pre-state (i.e., a program state before execution of a target function corresponding to the target stake point) to a start pre-state, and the pre-stake point can be used to change the pre-state to a delay pre-state, so that in the entire content loading process of the third-party application, different types of target stake points can be set for key functions according to the complexity of the actual situation, and different types of target stake points can be freely combined to ensure that key events corresponding to various content loading scenarios can be controlled, so that the timing of triggering and ending of the performance optimization strategy can be more flexibly and accurately controlled to adapt to various content loading scenarios.

[0175] In a possible implementation, the start stake point is further configured to record a time of triggering execution of the performance optimization strategy, and change the pre-state to a start state; and the end stake point is further configured to record a time of ending execution of the performance optimization strategy, and change the pre-state to an end state.

[0176] Specifically, the start stake point (which can also be referred to as a strategy issuing stake point) can be used to trigger execution of the performance optimization strategy, record a time of triggering execution of the performance optimization strategy, and change a pre-state (i.e., a program state before execution of a target function corresponding to the target stake point) to a start state; and the end stake point can be used to trigger ending of the performance optimization strategy, record a time of ending execution of the performance optimization strategy, and change the pre-state to an end state, so as to facilitate calculation of a performance optimization strategy execution duration and other related measurement information by using time stamps recorded when the start stake point and the end stake point are triggered, and facilitate more comprehensive and detailed analysis and understanding of program behavior in debugging, measurement, or performance analysis scenarios, so as to facilitate further fault analysis or optimization to improve user experience.

[0177] In a possible implementation, the performance optimization strategy comprises increasing the working frequency of the processor. The performance optimization strategy in the embodiments of the present application can comprise increasing the working frequency of the processor (for example, sending a frequency increase instruction to the processor), so as to enable a quick response to a user operation (for example, opening a third-party application or clicking a page) in the process of content loading of the third-party application, rapidly load page content and display, and thus improve the experience of the user.

[0178] In a possible implementation, the type of the target stake point further comprises the start pre-stake point; and the determining whether the trigger condition of the target stake point is met currently can comprise: if the target stake point is the start stake point, determining, based on the stake point information corresponding to the start stake point, whether the pre-state is the start pre-state; if yes, determining that the trigger condition corresponding to the start stake point is met; and if no, determining that the trigger condition corresponding to the start stake point is not met.

[0179] Specifically, when all the target stake points corresponding to the target functions in the entire content loading process of the third-party application further comprise the start pre-stake point, if the target stake point corresponding to the key function (that is, the target function) currently interpreted and executed by the interpreter is the start stake point, the stake module can determine, based on the stake point information corresponding to the start stake point, whether the program state (that is, the pre-state) before the electronic device executes the target function corresponding to the start stake point (that is, the target stake point) is the start pre-state, so as to determine whether the trigger condition of the start stake point (that is, the target stake point) is met currently. Further, if the pre-state is the start pre-state, it can be determined that the trigger condition corresponding to the start stake point is met; and if the pre-state is not the start pre-state, it can be determined that the trigger condition corresponding to the start stake point is not met, so that the start stake point can be triggered only after the start pre-stake point is triggered, thereby ensuring that the start stake point cannot be triggered in advance in the content loading process, so as to ensure that the triggering of the start stake point accurately reflects the start node of the content loading process, and improve the positioning accuracy.

[0180] In a possible implementation, the type of the target stake point further comprises the delay pre-stake point; and the determining whether the trigger condition of the target stake point is met currently can comprise: if the target stake point is the delay stake point, determining, based on the stake point information corresponding to the delay stake point, whether the pre-state is the delay pre-state; if yes, determining that the trigger condition corresponding to the delay stake point is met; and if no, determining that the trigger condition corresponding to the delay stake point is not met.

[0181] Specifically, in the case that the types of all target functions corresponding to target probes in the whole content loading process of the third-party application further include a delay pre-probe, if the target probe corresponding to the key function (i.e., the target function) currently interpreted and executed by the interpreter is a delay probe, the patching module can determine whether the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the delay probe (i.e., the target probe) is a delay pre-state based on the probe information corresponding to the delay probe, so as to determine whether the trigger condition of the delay probe (i.e., the target probe) is met. Further, if the pre-state is the delay pre-state, it can be determined that the trigger condition of the delay probe is met; if the pre-state is not the delay pre-state, it can be determined that the trigger condition of the delay probe is not met, so that the delay probe can be triggered only after the delay pre-probe is triggered, thereby ensuring that the delay probe will not be triggered in advance in the content loading process, so as to ensure that the triggering of the delay probe can accurately reflect the delay node of the content loading process, and improve the positioning accuracy.

[0182] In a possible implementation, the determining whether the trigger condition of the target probe is met can include: if the target probe is the delay pre-probe, determining whether the pre-state is the start state based on the probe information corresponding to the delay pre-probe; if yes, determining that the trigger condition of the delay pre-probe is met; and if no, determining that the trigger condition of the delay pre-probe is not met.

[0183] Specifically, if the target probe corresponding to the key function (i.e., the target function) currently interpreted and executed by the interpreter is a delay pre-probe, the patching module can determine whether the program state (i.e., the pre-state) before the electronic device executes the target function corresponding to the delay pre-probe (i.e., the target probe) is a start state based on the probe information corresponding to the delay pre-probe, so as to determine whether the trigger condition of the delay pre-probe (i.e., the target probe) is met. Further, if the pre-state is the start state, it can be determined that the trigger condition of the delay pre-probe is met; if the pre-state is not the start state, it can be determined that the trigger condition of the delay pre-probe is not met, so that the delay pre-probe can be triggered only after the start probe is triggered, thereby ensuring that the delay pre-probe will not be triggered in advance in the content loading process, so as to ensure that the triggering of the delay pre-probe can accurately reflect the delay pre-node of the content loading process, and improve the positioning accuracy.

[0184] Step S203: If the target probe is a delay probe and the trigger condition of the delay probe is met, terminate the preset time corresponding to the last triggered delay probe, start the preset time corresponding to the current delay probe, and trigger the end probe after the preset time.

[0185] Specifically, if the target stake point is a delay stake point and the trigger condition corresponding to the delay stake point is met, the preset time corresponding to the last triggered delay stake point can be terminated by the performance management module, the preset time corresponding to the current delay stake point can be started, and the end stake point can be triggered after the preset time. Therefore, in the embodiments of the present application, when repeatedly triggering delay stake points (for example, repeatedly triggering a delay stake point corresponding to a target function and / or different delay stake points corresponding to different target functions), the preset time corresponding to the last triggered delay stake point can be terminated, the preset time corresponding to the current delay stake point can be started, and the trigger time of the end stake point can be dynamically adjusted, so that in a scenario in which the loading process is relatively complex (for example, a content loading scenario in which it is difficult to find a key function with strong logical correlation as an end stake point), it is not necessary to find a key function related to the loading logic as an end stake point of the performance optimization strategy, and the content loading process can be accurately controlled to control the electronic device to execute the corresponding performance optimization strategy, thereby reducing the loading time to improve the user experience.

[0186] In a possible implementation, if the target stake point is a delay stake point and the trigger condition corresponding to the delay stake point is met, the preset time corresponding to the last triggered delay stake point can be terminated, the preset time corresponding to the current delay stake point can be started, and the end stake point can be triggered after the preset time. In one possible implementation, if the target stake point is a delay stake point and the trigger condition corresponding to the delay stake point is met, delay information can be sent, the delay information being used to trigger the end stake point after the preset time. In the preset time in which the delay message is waiting in the message queue and in the process of executing the next target function, it is continuously determined whether the trigger condition of the current delay stake point is met. If yes, the delay message sent previously in the message queue is removed, the latest delay message is sent, and the latest delay message is updated to the message queue. If no, the end stake point is triggered after the delay message passes the preset time.

[0187] Specifically, when the interpreter currently interprets a key function (i.e., a target function) corresponding to a target probe point as a delay probe point, and the trigger condition corresponding to the delay probe point is met, the delay information that can be used to trigger the end probe point after a preset time (e.g., 500 ms) can be sent by the probe module. Further, within the preset time (e.g., 500 ms) during which the delay message waits in the message queue and the process of executing the next target function, it is continuously determined whether the trigger condition of the delay probe point is met. If the trigger condition is met, the delay message previously sent in the message queue is removed by the performance management module, and the latest delay message is sent by the probe module and updated to the message queue by the performance management module. In this way, when the delay probe point is repeatedly triggered (e.g., the delay probe point corresponding to a target function and / or different delay probe points corresponding to different target functions are repeatedly triggered), the preset time corresponding to the last triggered delay probe point is terminated, the preset time corresponding to the current delay probe point is started, and the end probe point is triggered to end the performance optimization strategy before the preset time (e.g., 500 ms) ends in the case that the delay probe point is not triggered again. Through the embodiments of the present application, the trigger time of the end probe point can be dynamically adjusted, so that in the case of a complex loading process (e.g., a content loading scenario in which it is difficult to find a key function with strong logical correlation as an end probe point), the performance optimization strategy can be accurately controlled for the content loading process without finding a key function related to the loading logic as an end probe point, so as to reduce the loading time and improve the user experience.

[0188] In a possible implementation, the method further includes: if the target probe point is the start pre-probe point and the trigger condition corresponding to the start pre-probe point is met, the pre-probe state is changed to the start pre-probe state; if the target probe point is the start probe point and the trigger condition corresponding to the start probe point is met, the performance optimization strategy is triggered to be executed, the time of triggering the performance optimization strategy to be executed is recorded, and the pre-probe state is changed to the start state; and if the target probe point is the delay pre-probe point and the trigger condition corresponding to the delay pre-probe point is met, the pre-probe state is changed to the delay pre-probe state.

[0189] Specifically, when the interpreter currently interprets a key function (i.e., a target function) corresponding to a target probe point as a start pre-probe point, and the start pre-probe point satisfies a trigger condition corresponding thereto, the electronic device can change a program state (i.e., a pre-state) before execution of a target function corresponding to the start pre-probe point (i.e., a target probe point) to a start pre-state through the probe module, so as to ensure that the start pre-probe point (including a start pre-probe point corresponding to one target function and / or different start pre-probe points corresponding to different target functions) is not repeatedly triggered in a content loading process, that is, the start pre-probe point can be triggered only once in the entire content loading process, so as to ensure that triggering of the start pre-probe point can accurately reflect a start pre-node of the content loading process, and improve positioning accuracy. When the interpreter currently interprets a key function (i.e., a target function) corresponding to a target probe point as a start probe point, and the start probe point satisfies a trigger condition corresponding thereto, the electronic device can trigger an execution performance optimization strategy through the performance management module, and record a time of triggering the execution performance optimization strategy, so as to quickly determine start time and other measurement information of the execution performance optimization strategy in a measurement scenario, and further perform corresponding fault analysis or optimization, so as to improve user experience. In addition, the electronic device can change a program state (i.e., a pre-state) before execution of a target function corresponding to the start probe point (i.e., a target probe point) to a start state through the probe module, so as to ensure that the start probe point (including a start probe point corresponding to one target function and / or different start probe points corresponding to different target functions) is not repeatedly triggered in a content loading process, that is, the start probe point can be triggered only once in the entire content loading process, so as to ensure that triggering of the start probe point can accurately reflect a start node of the content loading process. When the interpreter currently interprets a key function (i.e., a target function) corresponding to a target probe point as a delay pre-probe point, and the delay pre-probe point satisfies a trigger condition corresponding thereto, the electronic device can change a program state (i.e., a pre-state) before execution of a target function corresponding to the delay pre-probe point (i.e., a target probe point) to a delay pre-state through the probe module, so as to ensure that the delay pre-probe point (including a delay pre-probe point corresponding to one target function and / or different delay pre-probe points corresponding to different target functions) is not repeatedly triggered in a content loading process, that is, the delay pre-probe point can be triggered only once in the entire content loading process, so as to ensure that triggering of the delay pre-probe point can accurately reflect a delay pre-node of the content loading process, and improve positioning accuracy.

[0190] In a possible implementation, the end probe point is further configured to record a time of ending the performance optimization strategy, and change the pre-state to an end state; and the method further includes: when the end probe point is triggered, triggering ending of the performance optimization strategy, recording the time of ending the performance optimization strategy, and changing the pre-state to the end state.

[0191] Specifically, termination stubs can also be used to record the time when a performance optimization strategy ends, and change the program state (i.e., the pre-execution state) before the execution of the target function corresponding to the target stub to the start state and then to the end state. Correspondingly, when a termination stub is triggered, the electronic device can trigger the termination of the performance optimization strategy through the performance management module, simultaneously recording the time when the performance optimization strategy ends, and changing the program state (i.e., the pre-execution state) before the execution of the target function corresponding to the target stub to the end state through the instrumentation module. This ensures that the triggering of the termination stub accurately reflects the end point of the content loading process. Furthermore, recording the time when the electronic device terminates the performance optimization strategy facilitates monitoring the execution process of the performance optimization strategy, thereby quickly determining the end time of the performance optimization strategy and other maintenance information. This allows for corresponding fault analysis or optimization in maintenance scenarios involving third-party applications, improving user experience.

[0192] Please see Figure 11 , Figure 11 This is a schematic flowchart illustrating a performance optimization method based on an interpreter provided in an embodiment of this application. This performance optimization method can be applied to the above... Figure 6 The aforementioned electronic device also implements the above-mentioned Figure 8 The software architecture includes an interpreter that can interpret and execute functions corresponding to third-party applications, and an instrumentation module that can support and execute the functions. Figure 11 The method flow shown includes steps S301-S309B and part of step S309A. The performance management module can be used to support and execute the above steps. Figure 11 The method flow shown includes steps S309A and S310.

[0193] Step S301: Obtain the function information of the function to be interpreted and executed. The function information includes the function name.

[0194] Step S302: Based on the function information and the pre-acquired configuration file, determine whether the function is a critical function. The configuration file includes the function names corresponding to one or more critical functions.

[0195] Step S303: If the function is a key function, determine that the function is the objective function.

[0196] Specifically, the descriptions of steps S301-S303 can be found above. Figure 10 The description of S201 of the foregoing embodiment can be referred to, and will not be repeated here.

[0197] Step S304: performing a hooking process on the target function to determine a target probe point corresponding to the target function. The target function is a function currently interpreted and executed by the interpreter, and one target function corresponds to one target probe point.

[0198] Step S305: determining probe point information corresponding to the target probe point based on the target probe point.

[0199] The probe point information includes position information, a triggering condition, and a triggering rule. The position information is used to indicate a hooking position of the target probe point in the target function, the triggering condition is used to indicate a condition under which the target probe point is triggered, and the triggering rule is used to indicate an operation performed when the target probe point is triggered.

[0200] The description of steps S304-S305 can be referred to the description of S201 of the foregoing embodiment, and will not be repeated here. Figure 10

[0201] Step S306: when the target function is executed, determining whether the triggering condition of the target probe point is met based on the probe point information corresponding to the target function.

[0202] The type of the target probe point includes a start probe point and a delay probe point. The start probe point is used to trigger execution of the performance optimization strategy, and the delay probe point is used to trigger the end probe point after a preset time, and the end probe point is used to trigger an end of the performance optimization strategy.

[0203] In a possible implementation, the type of the target probe point can further include a start pre-probe point and / or a delay pre-probe point. The start pre-probe point can be used to change a pre-state to a start pre-state, and the delay pre-probe point can be used to change the pre-state to a delay pre-state. The pre-state is a program state before execution of the target function corresponding to the target probe point.

[0204] In a possible implementation, the performance optimization strategy can include increasing a working frequency of a processor.

[0205] For example, when the type of the target probe point further includes the start pre-probe point, if the target probe point is the start probe point, it is determined whether the pre-state is the start pre-state based on the probe point information corresponding to the start probe point. If yes, it is determined that the triggering condition of the start probe point is met. If no, it is determined that the triggering condition of the start probe point is not met.

[0206] ​Exemplarily, the type of the target stake point further comprises a delay pre-stake point, and if the target stake point is the delay pre-stake point, it is determined, based on the stake point information corresponding to the delay pre-stake point, whether the pre-state is a delay pre-state; if yes, it is determined that the trigger condition corresponding to the delay pre-stake point is met; if no, it is determined that the trigger condition corresponding to the delay pre-stake point is not met.

[0207] Exemplarily, if the target stake point is the delay pre-stake point, it is determined, based on the stake point information corresponding to the delay pre-stake point, whether the pre-state is a start state; if yes, it is determined that the trigger condition corresponding to the delay pre-stake point is met; if no, it is determined that the trigger condition corresponding to the delay pre-stake point is not met. In a possible implementation manner, the start stake point is further used to record the time of triggering the performance optimization strategy, and the pre-state is changed to the start state; and the end stake point is further used to record the time of ending the performance optimization strategy, and the pre-state is changed to the end state.

[0208] Specifically, the description about the step S306 can be referred to the description about the step S202 of the method 1, which will not be repeated here. Figure 10

[0209] The step S307: if the target stake point is the delay pre-stake point and the trigger condition corresponding to the delay pre-stake point is met, delay information is sent. The delay information can be used to trigger the end stake point after a preset time (for example, 500 ms).

[0210] The step S308: during the preset time when the delay message is waiting in the message queue and the process of executing the next target function, it is continuously determined whether the trigger condition of the delay pre-stake point is met.

[0211] The step S309A: if yes, the delay message sent in the message queue before is removed, the latest delay message is sent, and the latest delay message is updated to the message queue. Since the delay pre-stake point can be repeatedly triggered (for example, the delay pre-stake point corresponding to a target function and / or different delay pre-stake points corresponding to different target functions are repeatedly triggered) in the embodiment of the present application, after the step S309A, the step S308 is entered.

[0212] The step S309B: if no, the end stake point is triggered after the delay message passes the preset time.

[0213] The step S310: when the end stake point is triggered, the end performance optimization strategy is triggered, the time of ending the performance optimization strategy is recorded, and the pre-state is changed to the end state.

[0214] ​In a possible implementation, if the target stake point is the start pre-stake point and the trigger condition corresponding to the start pre-stake point is met, the embodiment of the present application can change the pre-state to the start pre-state through the stake insertion module; if the target stake point is the start stake point and the trigger condition corresponding to the start stake point is met, the performance management module is triggered to execute the performance optimization strategy, the time of triggering the execution of the performance optimization strategy is recorded, and the pre-state is changed to the start state through the stake insertion module; if the target stake point is the delay pre-stake point and the trigger condition corresponding to the delay pre-stake point is met, the pre-state can be changed to the delay pre-state through the stake insertion module.

[0215] Specifically, for the description of steps S307-S310, refer to the description of S203 of the above embodiment, which will not be repeated here. Figure 10

[0216] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously, or certain steps can be omitted, a plurality of steps can be combined into one step, and / or one step can be divided into a plurality of steps.

[0217] The above detailed the method of the embodiment of the present application, it can be understood that, in order to realize the corresponding functions described above, each device contains the hardware structure and / or software module corresponding to the execution of each function. The units and steps of the example described in combination with the embodiments disclosed herein can be realized in the form of hardware or hardware and computer software. Whether a certain function is executed by hardware or computer software driven hardware depends on the specific application and design constraints of the technical solution.

[0218] Exemplarily, refer to Figure 12 , Figure 12 is a stake point trigger flow diagram in a performance optimization method provided by the embodiment of the present application.

[0219] As Figure 12 ​As shown, among all the performance optimization methods triggered by the stubs for the entire content loading process of the third-party application, at least one start stub and one delay stub are included in the stub types, and after the delay stub is triggered, it can be determined whether the delay stub is triggered again during the delay waiting process. If the delay stub is triggered again during the delay waiting process (i.e., a preset time, for example, 500 ms), it is determined again during the latest delay waiting process. The repeated triggering of the delay stub can be the repeated triggering of the delay stub corresponding to a target function, or the triggering of different delay stubs corresponding to different target functions, and the number of times the delay stub is triggered is an integer greater than 1, which is not limited in the embodiments of the present application. If it is not triggered again during the delay waiting process, the end stub can be triggered after the preset time to ensure the integrity of the stub triggering process. Optionally, the types of the triggered stubs in the flowchart can also include a pre-start stub and / or a delay pre-stub. In actual application, different types of target stubs can be freely combined according to the complexity of the content loading scene to ensure that the key events of various content loading scenes can be corresponded, so that the triggering and ending time of the performance optimization strategy can be more flexibly and accurately controlled to adapt to various content loading scenes. In the embodiments of the present application, the pre-start stub is triggered before the start stub, and the delay pre-stub is triggered after the start stub and before the delay stub. In addition, in addition to the delay stub, triggering other corresponding stubs will change the program state (i.e., the pre-state) before the target function corresponding to the delay stub (i.e., the target stub) to the type corresponding to the triggered stub. Therefore, in addition to the delay stub, which can be repeatedly triggered, the remaining types of stubs can only be triggered once in the stub triggering process, and the remaining types of stubs are ensured not to be triggered in advance during the content loading process to ensure that the triggering of the corresponding stubs can accurately reflect the key nodes of the content loading process and improve the accuracy of positioning. In addition, since the delay stub can be repeatedly triggered, the remaining types of stubs can be triggered multiple times in the stub triggering process, so that the present application can dynamically adjust the triggering time of the end stub through the delay stub, so that in the scene with a relatively complex loading process (for example, a content loading scene in which it is difficult to find a key function with strong logical correlation as an end stub), it is not necessary to find a key function related to the loading logic as an end stub of the performance optimization strategy, and the electronic device can accurately control the corresponding performance optimization strategy for the content loading process, thereby reducing the loading time to improve the user experience.

[0220] Further, based on the above description of the delay stub triggering process of steps S306-S310, see Figure 13 , Figure 13 is a delay stub triggering process provided by the embodiments of the present application.

[0221] As shown in Figure 13 , in the process of content loading of the third-party application, in the case that the target function corresponding to the delay stake point is executed, that is, when the target stake point corresponding to the key function (that is, the target function) currently interpreted and executed by the interpreter is the delay stake point, the current trigger condition of the delay stake point can be determined by the stake insertion module. For example, when the type of the target stake point in the entire stake point triggering flow includes the delay pre-stake point, the trigger condition of the delay stake point can determine whether the program state (that is, the pre-state) before the electronic device executes the target function corresponding to the delay stake point (that is, the target stake point) is the delay pre-state. It can be understood that the trigger condition of the delay stake point in the embodiment of the application is self-defined, which can be changed according to different content loading scenarios of different applications. The embodiment of the application only exemplarily introduces a possible implementation manner. In some embodiments, the trigger condition of the delay stake point can include other information, which is not limited in the embodiment of the application. Further, when the target stake point does not satisfy the trigger condition of the delay stake point, no related operation about the delay stake point is performed; when the target stake point satisfies the trigger condition of the delay stake point, the delay message previously sent in the message queue is removed by the performance management module, and the latest delay message is sent by the stake insertion module, and the latest delay message is updated to the message queue by the performance management module, so as to terminate the preset time corresponding to the last triggered delay stake point and start the preset time corresponding to the current delay stake point when the delay stake point is repeatedly triggered (for example, the delay stake point corresponding to a target function and / or different delay stake points corresponding to different target functions are repeatedly triggered). Further, within the preset time (that is, the delay process) of the delay message waiting in the message queue, when the electronic device executes the next target function, it is continuously determined whether the trigger condition of the delay stake point is satisfied, that is, it is determined whether the delay stake point is triggered again during the delay process. If yes, the delay stake point is triggered again; if not, after the delay process ends, that is, after the preset time, the end stake point is triggered to end the execution of the performance optimization strategy. It can be understood that the preset time of the delay stake point triggering the end stake point in the embodiment of the application can be self-defined, which is not limited in the embodiment of the application.

[0222] Further, please refer to Figure 14 , Figure 14 is a schematic diagram of dynamically searching an end point provided by the embodiment of the application.

[0223] As shown in Figure 14 As shown, among all the stubs triggered by the performance optimization method during the entire content loading process of the third-party application, the delay stub can be triggered multiple times, and each time the delay stub is triggered, the preset time corresponding to the last triggered delay stub is terminated, the preset time corresponding to the current delay stub is started, and in the case that the delay stub is not triggered again before the end of the preset time (for example, 500 ms), the end stub is triggered to end the execution of the performance optimization strategy. The embodiment of the present application can realize a dynamic search method through the delay stub, and is no longer limited to finding a key function related to the loading logic as a fixed end point in the prior art. In the face of repeated scenarios of loading logic, the delay stub can continue to be captured during the delay message to cover the entire content loading interval. It should be noted that the delay stub in the method embodiment of the present application can be triggered multiple times, which can be repeated triggering of the delay stub corresponding to a target function, or triggering of different delay stubs corresponding to different target functions, and the embodiment of the present application does not limit this.

[0224] Exemplarily, please refer to Figure 15 , Figure 15 is a flow diagram of processing a delay message by a switch structure provided by the embodiment of the present application.

[0225] As Figure 15 shown, for the running function of the third-party application written in java language, the performance management module can first call the message processing function handlemessage() to process the received delay message after the function being interpreted and executed by the interpreter corresponds to the delay stub and meets the triggering condition of the delay stub, and sends the corresponding delay message. Further, based on the switch structure, the type of the delay message corresponding to the stub is identified, the condition matching function conditionmatch() is called to judge whether the current state meets the precondition and can execute the system behavior, if yes, the message removal function removeMessages() is called to remove the last delay message from the message queue, and then the delay end function sendEndMsgDelay() is called to send the latest delay message to delay the trigger end node. It should be noted that the above embodiment only exemplarily illustrates a possible implementation manner of processing the delay message, and does not constitute a specific limitation of the method of the present application.

[0226] Exemplarily, please refer to Table 2 below, which is a table of content loading time of running the third-party application after the performance optimization method of the present application is adopted.

[0227] Table 2

[0228]

[0229] As shown in Table 2 above, compared with the performance optimization method using the prior art (i.e., the scheme of the present application is not started), after using the performance optimization method provided by the embodiment of the present application, the time for the electronic device to run the third-party application (such as the Dianping applet, the Meituan applet, etc.) to load content is significantly reduced, and the time benefit increases with the increase of the temperature of the electronic device, thereby avoiding the problem of too long loading time caused by temperature control and frequency reduction limitation when the electronic device runs the third-party application to load content. In addition, the method of the present application can be applied to various different loading scenarios. The above method embodiments only exemplarily introduce several possible loading scenarios. In another embodiment, the performance optimization method provided by the embodiment of the present application can be applied to content loading scenarios of various applets, application programs APP, etc., which are not limited by the embodiment of the present application. Through the embodiment of the present application, for various complex content loading scenarios, such as content loading scenarios that are difficult to find key functions with strong logical correlation as end stakes, by dynamically adjusting the triggering time of the end stake, the electronic device accurately controls the corresponding performance optimization strategy for the content loading process, thereby reducing the loading time to improve the user experience.

[0230] The above describes the application scenarios and method embodiments of the embodiments of the present application in detail. It can be understood that each device contains the hardware structure and / or software module corresponding to the execution of each function in order to realize the corresponding functions described above. The units and steps of the examples described in combination with the embodiments disclosed herein can be realized in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software driven hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application. Next, the system and device provided by the embodiments of the present application are introduced.

[0231] Please refer to Figure 16 , Figure 16 is a structural schematic diagram of a performance optimization system provided by the embodiments of the present application. The performance optimization system 1600 can include a stake insertion module 1601 and a performance management module 1602; the detailed description of each module is as follows:

[0232] The instrumenting module 1601 is configured to perform a Hook process on a target function, and determine a target instrument point corresponding to the target function; the target function is a function currently interpreted and executed by the interpreter; one target function corresponds to one target instrument point; when the target function is executed, it is determined whether a trigger condition of the target instrument point is met; the type of the target instrument point includes a start instrument point and a delay instrument point; the start instrument point is used to trigger execution of a performance optimization strategy; the delay instrument point is used to trigger an end instrument point after a preset time; and the end instrument point is used to trigger an end of the performance optimization strategy.

[0233] The performance management module 1602 is configured to, if the target instrument point is a delay instrument point and the trigger condition corresponding to the delay instrument point is met, terminate a preset time corresponding to a last triggered delay instrument point, start a preset time corresponding to a current delay instrument point, and trigger the end instrument point after the preset time.

[0234] By the embodiments of the present application, when repeatedly triggering a delay instrument point (for example, repeatedly triggering a delay instrument point corresponding to a target function and / or different delay instrument points corresponding to different target functions), the preset time corresponding to a last triggered delay instrument point is terminated, and the preset time corresponding to a current delay instrument point is started, so that the trigger time of the end instrument point is dynamically adjusted, so that in a scene in which a loading process is relatively complex (for example, a content loading scene in which it is difficult to find a key function with strong logical correlation as an end instrument point), without finding a key function related to a loading logic as an end instrument point of a performance optimization strategy, a content loading process can be accurately controlled to control the electronic device to execute a corresponding performance optimization strategy, so that the loading time is reduced to improve user experience.

[0235] In a possible implementation manner, the instrumenting module 1601 is further configured to obtain function information of a function to be interpreted and executed, the function information including a function name of the function; determine, based on the function information and a pre-obtained configuration file, whether the function is a key function, the configuration file including one or more key functions respectively corresponding to function names; and in a case where the function is the key function, determine that the function is the target function.

[0236] In a possible implementation manner, the instrumenting module 1601 is specifically configured to determine, based on the function information and the configuration file, whether there is a function name same as the function name of the function in the configuration file; if yes, determine that the function is the corresponding key function; and if no, determine that the function is a non-key function.

[0237] In a possible implementation, the instrumenting module 1601 is further configured to: determine, based on the target probe point, probe point information corresponding to the target probe point; the probe point information comprises position information, a triggering condition, and a triggering rule; the position information is used to indicate a position of the target probe point in the target function, the triggering condition is used to indicate a condition under which the target probe point is triggered, and the triggering rule is used to indicate an operation performed when the target probe point is triggered.

[0238] In a possible implementation, the instrumenting module 1601 is specifically configured to: when the target function is executed, determine whether a triggering condition of the target probe point is met based on the probe point information corresponding to the target function.

[0239] In a possible implementation, the type of the target probe point further comprises a start pre-probe point and / or a delay pre-probe point; the start pre-probe point is used to change a pre-probe state to a start pre-probe state, and the delay pre-probe point is used to change the pre-probe state to a delay pre-probe state; the pre-probe state is a program state before a target function corresponding to the target probe point is executed.

[0240] In a possible implementation, the start probe point is further used to record a time at which the performance optimization strategy is triggered to be executed, and change the pre-probe state to a start state; and the end probe point is further used to record a time at which the performance optimization strategy is ended to be executed, and change the pre-probe state to an end state.

[0241] In a possible implementation, the performance optimization strategy comprises increasing a working frequency of a processor.

[0242] In a possible implementation, the type of the target probe point further comprises the start pre-probe point; and the instrumenting module 1601 is specifically configured to: if the target probe point is the start probe point, determine, based on probe point information corresponding to the start probe point, whether the pre-probe state is the start pre-probe state; if yes, determine that a triggering condition corresponding to the start probe point is met; or if no, determine that the triggering condition corresponding to the start probe point is not met.

[0243] In a possible implementation, the type of the target probe point further comprises the delay pre-probe point; and the instrumenting module 1601 is specifically configured to: if the target probe point is the delay probe point, determine, based on probe point information corresponding to the delay probe point, whether the pre-probe state is the delay pre-probe state; if yes, determine that a triggering condition corresponding to the delay probe point is met; or if no, determine that the triggering condition corresponding to the delay probe point is not met.

[0244] In a possible implementation, the instrumentation module 1601 is specifically configured to: if the target instrumentation point is the delay pre-instrumentation point, determine whether the pre-instrumentation state is the start state based on the instrumentation point information corresponding to the delay pre-instrumentation point; if yes, determine that the trigger condition corresponding to the delay pre-instrumentation point is met; and if no, determine that the trigger condition corresponding to the delay pre-instrumentation point is not met.

[0245] In a possible implementation, the performance management module 1602 is further configured to: if the target instrumentation point is the start pre-instrumentation point and the trigger condition corresponding to the start pre-instrumentation point is met, change the pre-instrumentation state to the start pre-instrumentation state; if the target instrumentation point is the start instrumentation point and the trigger condition corresponding to the start instrumentation point is met, trigger execution of the performance optimization strategy, record a time of triggering execution of the performance optimization strategy, and change the pre-instrumentation state to the start state; and if the target instrumentation point is the delay pre-instrumentation point and the trigger condition corresponding to the delay pre-instrumentation point is met, change the pre-instrumentation state to the delay pre-instrumentation state.

[0246] In a possible implementation, the performance management module 1602 is specifically configured to: if the target instrumentation point is the delay instrumentation point and the trigger condition corresponding to the delay instrumentation point is met, send delay information, where the delay information is used to trigger the end instrumentation point after the preset time; during the preset time in which the delay message is waiting in the message queue and a process of executing a next target function, continue to determine whether the trigger condition of the delay instrumentation point is met; if yes, remove the delay message previously sent in the message queue, send a latest delay message, and update the latest delay message to the message queue; and if no, trigger the end instrumentation point after the delay message passes the preset time.

[0247] In a possible implementation, the end instrumentation point is further configured to record a time of ending the performance optimization strategy, and change the pre-instrumentation state to an end state; and the performance management module 1602 is further configured to: when the end instrumentation point is triggered, trigger ending of the performance optimization strategy, record the time of ending the performance optimization strategy, and change the pre-instrumentation state to the end state.

[0248] It should be noted that the functions of each module of the performance optimization system 1600 described in the embodiments of the present application can refer to the related description of the method embodiments, which will not be repeated here. It can be understood that the apparatus and method provided in the embodiments of the present application can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above modules or units is only a logical function division, and another division mode can be used in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0249] Please refer to Figure 17 , Figure 17 is another hardware structure schematic diagram of an electronic device provided by the embodiments of the present application. As Figure 17 shown, the electronic device 1700 includes at least one processor 1701 and a memory 1702. Wherein, the processor 1701 is coupled with the memory 1702, the coupling in the embodiments of the present application can be communication connection, can be electrical, or other forms. The processor 1701 and the memory 1702 can be connected through a bus 1703. Specifically, the memory 1702 is used to store program instructions. The processor 1701 is used to invoke the program instructions stored in the memory 1702, so that the electronic device 1700 can execute the steps in the method for dividing a geofence provided by the embodiments of the present application. The description of each component and related steps can refer to the foregoing, and will not be repeated here.

[0250] It should be noted that the electronic device 1700 provided by the embodiments of the present application can include more or fewer components than those shown, or combine some components, or split some components, or different arrangement of components. The components shown can be implemented in hardware, software or any combination of software and hardware.

[0251] The embodiments of the present application also provide a computer readable storage medium, wherein the computer readable storage medium can store a program, and the computer program is executed by a processor to implement part or all of the steps of any one of the methods for dividing a geofence described in the above method embodiments.

[0252] The embodiments of the present application also provide a computer program, which includes instructions, and when the computer program is executed by a computing device, the computing device can execute part or all of the steps of any one of the methods for dividing a geofence described above.

[0253] In the above embodiments, the description of each embodiment is focused on a certain aspect, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0254] In the above embodiments, according to the context, the term "when" can be interpreted to mean "if" or "after" or "in response to determining" or "in response to detecting". Similarly, according to the context, the phrase "upon determining" or "if detecting (a stated condition or event)" can be interpreted to mean "if determining" or "in response to determining" or "upon detecting (a stated condition or event)" or "in response to detecting (a stated condition or event)".

[0255] It should be noted that, for the foregoing method embodiments, the series of acts combinations are described for simplicity, but those skilled in the art should know that the present application is not limited to the order of the acts described, because according to the present application, certain steps can be performed in other orders or at the same time, or certain steps can be omitted, or multiple steps can be combined into one step, and / or one step can be divided into multiple steps. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the acts and modules involved are not necessarily required by the present application. It should also be noted that the features and functions of two or more devices according to the present disclosure can be embodied in one device. Conversely, the features and functions of one device described above can be further divided into devices for embodiment.

[0256] In the above embodiments, all or part of the processes can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the processes can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes described in the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes one or more available media sets. The available media can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk), etc.

[0257] Those of ordinary skill in the art can understand that all or part of the processes in the above embodiments can be implemented by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The storage medium includes ROM or random access memory (RAM), magnetic disk or optical disk, and various media that can store program codes.

[0258] In summary, the above only describes the embodiments of the technical scheme of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made according to the disclosure of the present application shall be included in the protection scope of the present application.< / canvas> < / video> < / videoview> < / imgview> < / textview>

Claims

1. A performance optimization method based on an interpreter, characterized in that, The method includes: The target function is instrumented and hooked to determine the target stub corresponding to the target function; the target function is a key function in the function currently interpreted and executed by the interpreter, and one target function corresponds to one target stub. When the objective function is executed, it is determined whether the triggering condition of the objective stub is met. The types of objective stubs include start stubs, delay stubs, and end stubs. The start stub is used to trigger the execution of the performance optimization strategy. The delay stub is used to trigger the end stub after a preset time. The end stub is used to trigger the end of the performance optimization strategy. If the target point is a time-delay point and the triggering condition corresponding to the time-delay point is met, then the preset time corresponding to the previously triggered time-delay point is terminated, the preset time corresponding to the current time-delay point is started, and the end point is triggered after the preset time, including: If the target pile is the delay pile and the triggering condition corresponding to the delay pile is met, then delay information is sent, and the delay information is used to trigger the end pile after the preset time. During the preset time during which the delay information waits in the message queue and during the execution of the next objective function, it is continued to determine whether the triggering condition of the delay stub is met. If the conditions are met, the previously sent delay information is removed from the message queue, and the latest delay information is sent and updated in the message queue. If the conditions are not met, the termination point will be triggered after the preset time has elapsed in the delay information.

2. The method according to claim 1, characterized in that, The method further includes: Obtain the function information of the function to be interpreted and executed, the function information including the function name; Based on the function information and the pre-acquired configuration file, it is determined whether the function is a key function. The configuration file includes the function names corresponding to one or more key functions. If the function is the key function, then the function is determined to be the target function.

3. The method according to claim 2, characterized in that, The step of determining whether a function is a critical function based on the function information and a pre-acquired configuration file includes: Based on the function information and the configuration file, determine whether there is a function name in the configuration file that is the same as the function name of the function; If it exists, then the function is determined to be the corresponding key function; If it does not exist, then the function is determined to be a non-critical function.

4. The method according to claim 1, characterized in that, The method further includes: Based on the target pile, determine the pile information corresponding to the target pile; the pile information includes location information, triggering conditions, and triggering rules; the location information is used to indicate the insertion position of the target pile in the target function, the triggering conditions are used to indicate the conditions under which the target pile is triggered, and the triggering rules are used to indicate the operation to be performed when the target pile is triggered.

5. The method according to claim 4, characterized in that, When the objective function is executed, determining whether the triggering condition of the target stub is currently met includes: When the objective function is executed, it is determined whether the triggering condition of the objective point is met based on the stub information corresponding to the objective function.

6. The method according to any one of claims 1-5, characterized in that, The types of target stubs also include start-preceding stubs and / or delay-preceding stubs; the start-preceding stub is used to change the preceding state to the start-preceding state, and the delay-preceding stub is used to change the preceding state to the delay-preceding state, wherein the preceding state is the program state before execution reaches the target function corresponding to the target stub.

7. The method according to claim 6, characterized in that, The start stub is also used to record the time when the performance optimization strategy is triggered and to change the previous state to the start state; the end stub is also used to record the time when the performance optimization strategy is terminated and to change the previous state to the end state.

8. The method according to any one of claims 1-5, characterized in that, The performance optimization strategy includes increasing the processor's operating frequency.

9. The method according to claim 6, characterized in that, The type of target pile also includes the starting pre-set pile; the determination of whether the triggering condition of the target pile is currently met includes: If the target pile point is the starting pile point, determine whether the previous state is the starting previous state based on the pile point information corresponding to the starting pile point; If yes, it is determined that the triggering condition corresponding to the starting pile point is met; if no, it is determined that the triggering condition corresponding to the starting pile point is not met.

10. The method according to claim 6, characterized in that, The type of target stake point also includes the delayed pre-stake stake point; the determination of whether the triggering condition of the target stake point is currently met includes: If the target pile is a delayed pile, determine whether the previous state is the delayed previous state based on the pile information corresponding to the delayed pile. If yes, it is determined that the triggering condition corresponding to the delay point is met; if no, it is determined that the triggering condition corresponding to the delay point is not met.

11. The method according to claim 6, characterized in that, The determination of whether the triggering condition of the target pile point is met includes: If the target pile is the delay-preceding pile, determine whether the preceding state is the start state based on the pile information corresponding to the delay-preceding pile; If yes, it is determined that the triggering condition corresponding to the delay pre-stake point is met; if no, it is determined that the triggering condition corresponding to the delay pre-stake point is not met.

12. The method according to claim 6, characterized in that, The method further includes: If the target pile is the starting pre-pile point and the triggering condition corresponding to the starting pre-pile point is met, then the pre-pile state is changed to the starting pre-pile state. If the target pile is the starting pile and the triggering condition corresponding to the starting pile is met, the performance optimization strategy is triggered and executed. At the same time, the time when the performance optimization strategy is triggered is recorded, and the previous state is changed to the starting state. If the target pile is the delay-preceding pile and the triggering condition corresponding to the delay-preceding pile is met, then the preceding state is changed to the delay-preceding state.

13. The method according to claim 6, characterized in that, The termination point is also used to record the time when the performance optimization strategy ends and to change the previous state to the termination state; the method further includes: When the termination point is triggered, the performance optimization strategy is terminated, the time of termination of the performance optimization strategy is recorded, and the previous state is changed to the terminated state.

14. A performance optimization system based on an interpreter, characterized in that, The system includes an instrumentation module and a performance management module; The insertion module is used for: The target function is instrumented and hooked to determine the target stub corresponding to the target function; the target function is a key function in the function currently interpreted and executed by the interpreter, and one target function corresponds to one target stub. When the objective function is executed, it is determined whether the triggering condition of the objective stub is met. The types of objective stubs include start stubs, delay stubs, and end stubs. The start stub is used to trigger the execution of the performance optimization strategy. The delay stub is used to trigger the end stub after a preset time. The end stub is used to trigger the end of the performance optimization strategy. The performance management module is used for: If the target point is a time-delay point and the triggering condition corresponding to the time-delay point is met, then the preset time corresponding to the previously triggered time-delay point is terminated, the preset time corresponding to the current time-delay point is started, and the end point is triggered after the preset time. The performance management module is further configured to: if the target stub is the delay stub and the triggering condition corresponding to the delay stub is met, send delay information, the delay information being used to trigger the end stub after the preset time; and during the preset time in which the delay information waits in the message queue and while the next target function is being executed, continue to determine whether the triggering condition of the delay stub is currently met. If the conditions are met, the previously sent delay information is removed from the message queue, and the latest delay information is sent and updated in the message queue. If the conditions are not met, the termination point will be triggered after the preset time has elapsed in the delay information.

15. An electronic device, characterized in that, The electronic device includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, causing the electronic device to perform the method according to any one of claims 1-13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-13.

17. A computer program product, characterized in that, The computer program product includes instructions that are executed by a computing device to implement the method of any one of claims 1-13.

Citation Information

Patent Citations

  • Method for reducing power consumption of mobile terminal and mobile terminal

    CN106095059A

  • Method for triggering and controlling Packet-In message

    CN107809385A