Method for adjusting application program operation and electronic device
Through adaptive updates and optimization of the compilation results of hot spots, the problem of low efficiency of electronic devices when running applications is solved, and more smooth and efficient application operation is achieved.
Patent Information
- Application Number
- CN202411154220.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-08-22
AI Technical Summary
When an electronic device runs an application, the application may not run smoothly due to its low compilation efficiency.
Modify the hotspot function by adapting, and compile and optimize according to the modified hotspot function to improve the operating efficiency of the application. Specific methods include downloading and installing the system upgrade package, updating the pre -configured hotspot function set, generating new compilation results, and restarting the compilation result after the electronic equipment is in a free state.
Improve the operating efficiency of the application, reduce memory resource occupation, and reduce the occurrence of applications abnormally, such as stuttering and losing frames.
Smart Images

Figure CN118656100B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method for adjusting the operation of an application program and an electronic device. Background Art
[0002] When an electronic device runs an application, it needs to compile the source code of the application into a machine code that the electronic device can recognize, and then execute the machine code to run the application. However, the process of electronic devices compiling the source code of the application is inefficient, which may cause the application to run unsmoothly. Therefore, how to adjust the operation of the application to improve the efficiency of the electronic device running the application is a technical problem worth studying. Summary of the invention
[0003] The embodiments of the present application provide a method for adjusting the operation of an application and an electronic device, which can adaptively modify hotspot functions during the operation of the application on the electronic device, and perform compilation optimization based on the modified hotspot functions, thereby facilitating improving the operation efficiency of the application.
[0004] In a first aspect, an embodiment of the present application provides a method for adjusting the operation of an application, which can be applied to an electronic device, the method comprising: downloading and installing a system upgrade package, the reference configuration file in the system upgrade package comprising a preconfigured hotspot function set; running the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set; determining a first hotspot function set from the functions called when the application is running; the number of calls of each hotspot function in the first hotspot function set is greater than or equal to a call number threshold corresponding to the application; updating the preconfigured hotspot function set based on the first hotspot function set to obtain a second hotspot function set, and generating a compilation result corresponding to the second hotspot function set; in response to the electronic device being in an idle state, restarting the electronic device, and running the application based on the compilation result corresponding to the second hotspot function set.
[0005] In the above embodiment, the electronic device can adaptively update the preconfigured hot function set based on the hot functions that users are accustomed to using when the application is actually running, and delete the redundant hot functions in the preconfigured hot function set, thereby saving memory resources. In addition, when the electronic device is in an idle state, a restart can be triggered so that the electronic device can run the application based on the compilation result corresponding to the updated hot function set, thereby improving the smoothness of the application operation.
[0006] In combination with the first aspect, in one possible manner, the second hotspot function set includes the intersection of the preconfigured hotspot function set and the first hotspot function set, as well as the hotspot functions in the first hotspot function set except the intersection, and does not include the hotspot functions in the preconfigured hotspot function set except the intersection.
[0007] In the technical solution, the electronic device can update the preconfigured hotspot function set by comparing the first hotspot function set with the preconfigured hotspot function set, retaining the hotspot functions in the preconfigured hotspot function set that are the same as those in the first hotspot function set, deleting the hotspot functions in the preconfigured hotspot function set that are different from those in the first hotspot function set, and adding hotspot functions in the first hotspot function set that are not included in the preconfigured hotspot function set. By deleting redundant hotspot functions in the preconfigured hotspot function set, it helps to reduce memory resource usage.
[0008] In combination with the first aspect, in one possible manner, the second hotspot function set also includes a compilation function corresponding to a just-in-time compilation exception.
[0009] In this technical solution, the electronic device can add the compilation function corresponding to the just-in-time compilation exception to the second hot function set, thereby avoiding subsequent application operation exceptions caused by just-in-time compilation locking, such as freezes, frame drops, and other problems.
[0010] In combination with the first aspect, in one possible manner, the method further includes: in response to detecting runtime exception information, searching whether there is a just-in-time compilation exception in the runtime exception information; in response to the presence of a just-in-time compilation exception in the runtime exception information, obtaining a compilation function corresponding to the just-in-time compilation exception; wherein the runtime exception information is exception information detected when running an application based on the compilation result corresponding to a preconfigured hotspot function set.
[0011] In this technical solution, the electronic device can detect whether there is operation abnormality information during the operation of the application. If a just-in-time compilation abnormality is identified, the compilation function corresponding to the just-in-time compilation abnormality can be obtained, so that the compilation function corresponding to the just-in-time compilation abnormality can be compiled and optimized as a hot function in the future, which is conducive to further improving the efficiency of the application operation.
[0012] In combination with the first aspect, in one possible manner, the idle state includes a state of charging and screen off.
[0013] In this technical solution, the electronic device can be restarted when the screen is off and charging, which can ensure that the electronic device has sufficient power to restart without affecting the user's operation.
[0014] In combination with the first aspect, in one possible manner, determining a first hot function set from functions called when an application is running includes: counting functions called when the application is running within a preset time period; and determining the first hot function set from the functions.
[0015] In this technical solution, the electronic device can periodically obtain the latest first hotspot function set, so that the determined first hotspot function set is more in line with the user's operating habits.
[0016] In combination with the first aspect, in one possible manner, the above-mentioned counting of functions called when the application is running within a preset time period includes: calling a function collection module through an application framework layer to count functions called when the application is running within a preset time period.
[0017] In a second aspect, an embodiment of the present application provides an electronic device, which includes: one or more processors, a display screen and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute: download and install a system upgrade package, the reference configuration file in the system upgrade package includes a preconfigured hotspot function set; run an application in the electronic device based on a compilation result corresponding to the preconfigured hotspot function set; determine a first hotspot function set from the functions called when the application is running; the number of calls of each hotspot function in the first hotspot function set is greater than or equal to a call number threshold corresponding to the application; update the preconfigured hotspot function set based on the first hotspot function set to obtain a second hotspot function set, and generate a compilation result corresponding to the second hotspot function set; in response to the electronic device being in an idle state, restart the electronic device, and run the application based on the compilation result corresponding to the second hotspot function set.
[0018] In combination with the second aspect, in one possible manner, the second hotspot function set includes the intersection of the preconfigured hotspot function set and the first hotspot function set, as well as the hotspot functions in the first hotspot function set except the intersection, and does not include the hotspot functions in the preconfigured hotspot function set except the intersection.
[0019] In conjunction with the second aspect, in one possible manner, the second hotspot function set also includes a compilation function corresponding to a just-in-time compilation exception.
[0020] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: in response to detecting execution exception information, searching whether there is a just-in-time compilation exception in the execution exception information; in response to the presence of a just-in-time compilation exception in the execution exception information, obtaining a compilation function corresponding to the just-in-time compilation exception; wherein the execution exception information is exception information detected when running an application based on the compilation result corresponding to a preconfigured hotspot function set.
[0021] In combination with the second aspect, in one possible manner, the idle state includes a state of charging and screen off.
[0022] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: counting functions called when the application is running within a preset time period; and determining a first hot function set from the functions.
[0023] In combination with the second aspect, in one possible manner, the one or more processors call the computer instructions to cause the electronic device to execute: calling the function collection module through the application framework layer to count the functions called when the application is running within a preset time period.
[0024] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method described in the first aspect above.
[0025] In a fourth aspect, an embodiment of the present application provides a chip system, which is coupled to a memory, and the chip system is used to read and execute a computer program stored in the memory to implement the method described in the first aspect above.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of a running jam of an application provided in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0030] Figure 4 A schematic diagram of the interaction between modules in a software structure of an electronic device provided in an embodiment of the present application;
[0031] Figure 5 A flowchart of a method for adjusting the operation of an application program provided in an embodiment of the present application;
[0032] Fig. 6A and Figure 6B A flowchart of another method for adjusting the operation of an application program provided in an embodiment of the present application;
[0033] Figure 7 A schematic diagram of updating a preconfigured hotspot function set provided in an embodiment of the present application;
[0034] Figure 8 A flowchart of another method for adjusting the operation of an application program provided in an embodiment of the present application;
[0035] Fig. 9 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0037] The terms "first", "second", "third", etc. in the embodiments of the present application are distinguished from different objects, rather than being used to describe a specific order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions. For example, a series of steps or units are included, or alternatively, steps or units not listed are also included, or other steps or units inherent to these processes, methods, products or devices are optionally included. The terms "one embodiment" or "some embodiments", etc. mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in the differences in the embodiments of the present application are not necessarily all with reference to the same embodiment, but mean "one or more but not all embodiments", unless otherwise particularly emphasized.
[0038] In addition, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects before and after the association are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can mean: a, or b, or c, or a and b, or a and c, or b and c, or a, b and c, where a, b, c can be single or plural.
[0039] To facilitate understanding, the following is a brief introduction to the relevant terms involved in the embodiments of the present application.
[0040] 1. Application source code
[0041] The source code of an application is code data written by the developer of the application in a programming language (such as Java) to support the implementation of various application services of the application. The source code of the application is contained in the executable (dex) file of the electronic device. When the electronic device downloads the application installation package (Android application package, apk) of the application, the dex file containing the source code will be written into the data partition of the electronic device along with the apk of the application. However, the source code of the application is code data that cannot be directly recognized by the electronic device. When the electronic device runs the application, the source code of the application needs to be converted into machine code that the electronic device can recognize. Among them, the way in which the electronic device executes the source code of the application can be divided into two ways: interpreted execution and compiled execution.
[0042] 2. Explain and execute
[0043] Interpreted execution refers to the way that electronic devices directly run the source code of the application and execute it line by line. In this mode, the electronic device needs to parse and translate the source code every time it executes the program, and convert it into an executable instruction sequence. Since interpretation and translation are required every time it is executed, the speed of interpreted execution is relatively slow.
[0044] 3. Compile and execute
[0045] Compile and execute refers to the way in which an electronic device compiles the source code of an application into machine code that the electronic device can recognize for execution through a compiler, such as compiling into binary code that the electronic device can directly recognize. Based on the compiled binary code, the electronic device can generate an optimized executable (odex) file. When running the application, the binary code in the odex file can be executed to provide corresponding application services. Compile and execute can include just-in-time (JIT) compilation and ahead-of-time (AOT) compilation.
[0046] 4. Just in time (JIT) compilation
[0047] JIT compilation is a compilation method that allows the source code of an application to be compiled into machine code that can be recognized by electronic devices during program execution. In the JIT compilation method, each time the application is started, it needs to be recompiled.
[0048] 5. Ahead of time (AOT) compilation
[0049] AOT compilation is a compilation method that compiles the source code of an application into machine code that can be recognized by electronic devices before the program is run. In other words, with AOT compilation, the source code of the application can be compiled into machine code and the corresponding odex file can be generated before the application is executed. In this way, there is no need to recompile the application each time it is run, which is conducive to improving the execution speed and efficiency of the program.
[0050] 6. speed-profile (a compilation optimization method)
[0051] Speed-profile is a compilation optimization method that can compile the installation package of an application based on a configuration file (also called a profile file). The methods listed in the profile file will be AOT compiled. This makes compilation based on the profile file more efficient.
[0052] 7. verify (another compilation optimization method)
[0053] Verify is a compilation optimization method that only verifies the code of dex files, that is, verifies the legality of the code. Verify does not perform AOT compilation, and its execution efficiency is lower than speed-profile.
[0054] At present, with the development of terminal technology, application developers have developed more and more applications. Usually, electronic devices can download the installation package of the application and extract the dex file in the installation package, so that the bytecode in the dex file can be interpreted and executed. However, due to the low efficiency of interpretation and execution, electronic devices can improve the execution efficiency of electronic devices for applications by using compilation and execution. However, through trace (a technology used to record the running process of a program), technicians have found that if electronic devices use JIT compilation for a long time, the running of the application will be stuck.
[0055] For example, see Figure 1 , Figure 1 A schematic diagram of a stuck application program provided in an embodiment of the present application. Figure 1 As shown, when the electronic device draws the application startup animation through the launcher (desktop display service) main thread, since the JIT thread holds locks and compiles functions using the JIT compilation method, the launcher main thread needs to wait for the JIT thread to complete execution before continuing execution, which makes the drawing efficiency of the application startup animation low, resulting in the problem of startup animation lag.
[0056] To solve the problem of JIT thread blocking the launcher main thread task, the current solution is to use speed-profile compilation optimization to improve the execution efficiency of the application. Among them, the speed-profile compilation optimization method corresponds to a profile file. The methods listed in the profile file can be AOT compiled to generate an odex file. In this way, when the electronic device runs the application, the number of JIT compilations can be reduced, thereby reducing the jamming problem caused by JIT compilation.
[0057] However, the methods listed in the profile file corresponding to the current speed-profile compilation optimization method are collected through laboratory testing or beta user testing (users who participate in public testing and provide feedback before the product is officially released). These methods often consider all possible usage scenarios, which causes the speed-profile compilation optimization method to occupy more memory (such as read-only memory (ROM)), resulting in high system load and high power consumption.
[0058] For example, please refer to Table 1, which is a comparative example of a speed-profile compilation optimization method and a verify compilation optimization method provided in an embodiment of the present application.
[0059] Table 1
[0060]
[0061] As shown in Table 1, under the speed-profile compilation optimization mode and the verify compilation optimization mode, the random access memory (RAM) usage of the system user interface (system UI), launcher, and negative one screen of the electronic device is basically unchanged. In terms of running the same application, the speed-profile compilation optimization mode has fewer JIT compilation times and higher efficiency than the verify compilation optimization mode. However, the speed-profile compilation optimization mode occupies more ROM than the verify compilation optimization mode. For example, when running the system UI, the speed-profile compilation optimization mode occupies about 13MB more ROM than the verify compilation optimization mode; when running the launcher, the speed-profile compilation mode occupies about 7MB more ROM than the verify compilation mode; when running the negative one screen, the speed-profile compilation optimization mode occupies 19MB more ROM than the verify compilation optimization mode.
[0062] In addition, with the current speed-profile compilation method, if the system application of an electronic device is reconstructed or new business features are added, the developer needs to manually add the new methods to the corresponding profile file, that is, the profile file needs to be re-adapted, and the maintenance cost is high.
[0063] Based on this, an embodiment of the present application provides a method for adjusting the operation of an application, which can be applied to an electronic device. After the electronic device is upgraded and restarted, it can adaptively update the profile file according to the user's usage habits, and perform AOT compilation based on the adjusted profile file. In this way, it can not only effectively reduce the memory resource usage and reduce the profile file maintenance cost caused by business changes, but also help improve the efficiency of application operation.
[0064] In the embodiments of the present application, the electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a personal digital assistant (PDA), etc., and the embodiments of the present application are not limited to this.
[0065] The hardware structure and software structure of the electronic device in the embodiment of the present application are introduced below.
[0066] For example, see Figure 2 , Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0067] like Figure 2As shown, the electronic device may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0068] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0069] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0070] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0071] In an embodiment of the present application, the processor 110 can run an application in the electronic device based on a profile file, and adaptively update the profile file according to the user's operation on the application in the electronic device; when the electronic device is in an idle state, control the restart of the electronic device and run the application in the electronic device based on the updated profile file.
[0072] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to monitor touch operations acting on or near it. The touch sensor 180K can pass the monitored touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device, which is different from the position of the display screen 194. In the embodiment of the present application, the touch sensor 180K can be used to detect the user's operation.
[0073] The electronic device implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0074] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (AMOLED), a flexible light emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diodes (QLED), low temperature polycrystalline oxide (LTPO), etc. In some embodiments, the electronic device may include 1 or N display screens 194, where N is a positive integer greater than 1. In the embodiment of the present application, the display screen 194 can display the interface of the application in the electronic device.
[0075] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function.
[0076] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function), etc. The data storage area may store data created during the use of the electronic device (such as audio data, a phone book), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor. The electronic device may also include an IC chip (not shown in the figure), which is used to drive the display of the display screen. In an embodiment of the present application, the internal memory 121 may be used to store a profile file.
[0077] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0078] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0079] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to electronic devices. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0080] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device. In other embodiments, the electronic device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0081] The above introduces the hardware structure of the electronic device. The following introduces the software structure of the electronic device.
[0082] The software structure of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device.
[0083] For example, see Figure 3 , Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
[0084] like Figure 3 As shown, the layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, an Android runtime (ART), a system library, and a kernel layer.
[0085] Among them, the application layer can include a series of application packages. For example, the application package can include camera, gallery, chat, map, calendar, music, call, navigation, game, video and other applications.
[0086] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0087] In an embodiment of the present application, the application framework layer may include a function acquisition module, a hot function identification module, a hot function update module, an anomaly detection module, an anomaly type identification module, a compilation optimization module, a system status identification module, and a restart module.
[0088] Among them, the function acquisition module can be used to collect functions called when running applications in electronic devices. The hot function identification module can be used to identify hot functions in functions called when electronic devices run applications. The hot function update module can be used to query whether the preconfigured profile file contains hot functions identified by the hot function identification module. The abnormality detection module can be used to print performance fault information in real time when a performance fault is detected in the electronic device. The performance fault information may include one or more of the name of the application package where the fault occurs, the name of the waiting lock, the waiting lock process, the name of the lock holding process, the event description, and the call stack function. The abnormality type identification module can be used to identify whether the current fault is caused by JIT compilation lock holding, or to describe whether the current abnormality type is a JIT compilation abnormality. The compilation optimization module can be used to call ART to compile hot functions. The system state identification module can be used to identify whether the state of the electronic device is an idle state, and the idle state can be, for example, a charging and screen-off state. The restart module can be used to call a restart function to restart the system, for example, the getArtManagerLocal().addDexoptDoneCallback function can be called to trigger the restart of the system.
[0089] Of course, the application framework layer can also include Figure 3 Services and modules not shown, such as window manager, resource manager, view system, etc.
[0090] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0091] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0092] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0093] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0094] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0095] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0096] OpenGL ES is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0097] SGL is a graphics engine for 2D graphics.
[0098] Android runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system. The virtual machine of Android runtime can run encoder (dalvik excutable file to optimized art file, dex2oat) and encoding optimization (dexopt) modules. Among them, dexopt can be used to convert dex files containing source code into odex files containing binary code. For example, dexopt can call dex2oat to compile the source code of an application, and generate the odex file corresponding to the application according to the compilation result of dex2oat.
[0099] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.
[0100] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0101] The kernel layer is a layer between hardware and software. The kernel layer at least includes a camera driver, an audio driver, a sensor driver, etc., and the present application embodiment does not impose any restrictions on this.
[0102] It should be noted that the various functional modules included in the above software structure are only exemplary and do not constitute a specific limitation on the software architecture of the mobile phone of this application. In other embodiments, the various functional modules included in the above software structure may be more or less, and this application does not limit this. Although the embodiment of this application is described using the Android system as an example, its basic principles are also applicable to electronic devices with other operating systems (such as Hongmeng system, IOS system, etc.).
[0103] To facilitate understanding of the embodiments of the present application, the process of interaction between modules in the software structure of an electronic device is schematically introduced below.
[0104] For example, see Figure 4 , Figure 4 The following is a schematic diagram of the interaction between modules in the software structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, ① the function acquisition module can send the collected functions called when the application is running to the hot function identification module. ② The hot function identification module can identify the first hot function set from the functions called when the application is running, and pass the first hot function set to the hot function update module. ③ The abnormality detection module can detect the abnormal operation information when the application is running, and send the detected abnormal operation information to the abnormality type identification module. ④ The abnormality type identification module can identify the abnormal type of the abnormal operation information and determine whether there is a just-in-time compilation abnormality. In the case of a just-in-time compilation abnormality, the compilation function corresponding to the just-in-time compilation abnormality is sent to the hot function update module. ⑤ The hot function update module can update the preconfigured hot function set according to the compilation function corresponding to the first hot function set and / or the just-in-time compilation abnormality, obtain the second hot function set, and send the second hot function set to the compilation optimization module. ⑥ The compilation optimization module can obtain the compilation result corresponding to the second hot function set. ⑦ When the system state identification module detects that the electronic device is in an idle state, it can notify the enable restart module to control the restart of the electronic device so as to run the application based on the compilation result corresponding to the second hot function set. Among them, the introduction of the first hotspot function set, the pre-configured hotspot function set, and the second hotspot function set can be found in the description in the following embodiments, which will not be repeated here.
[0105] The following is a detailed introduction to the method for adjusting the operation of an application provided in an embodiment of the present application in conjunction with the accompanying drawings.
[0106] See also Figure 5 , Figure 5 The following is a flow chart of a method for adjusting the operation of an application program provided in an embodiment of the present application. Figure 5 As shown, the method may include but is not limited to the following steps:
[0107] S501, download and install the system upgrade package.
[0108] In an embodiment of the present application, the electronic device can download a system upgrade package for upgrading the electronic device from a server through over the air technology (OTA), and install the system upgrade package after the system upgrade package is downloaded. Among them, the system upgrade package may include a reference configuration file, and the reference configuration file may include a preconfigured hotspot function set. Here, the reference configuration file can be understood as a profile file corresponding to the current speed-profile compilation optimization method, and the preconfigured hotspot function set in the reference configuration file is obtained through laboratory test collection or beta user test collection. The number of calls or executions of the preconfigured hotspot functions in the preconfigured hotspot function set during the test is greater than or equal to the threshold. In other words, the preconfigured hotspot functions in the preconfigured hotspot function set are functions with a high calling frequency and execution frequency during the test. It can be understood that since the test will be based on all possible usage scenarios during the test process, that is, the preconfigured hotspot function set in the reference configuration file is a preconfigured full amount of hotspot functions, so that the number of preconfigured hotspot functions included in the preconfigured hotspot function set is large, and more memory resources are occupied.
[0109] S502: Run the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set.
[0110] In an embodiment of the present application, the electronic device can perform AOT compilation on the preconfigured hotspot function set in the reference configuration file to obtain an odex file corresponding to the reference configuration file, that is, the compilation result corresponding to the preconfigured hotspot function set can be obtained in advance before running the application. Then the electronic device can run the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set. Here, the binary code in the odex file is an instruction that can be directly recognized by the electronic device. When the electronic device runs the application, it is more efficient to execute the binary code in the odex file.
[0111] In some embodiments, before running an application, the electronic device may first detect whether there is an odex file matching the application in the odex file corresponding to the reference configuration file. If there is no odex file matching the application in the odex file corresponding to the reference configuration file, the electronic device may run the application based on a JIT compilation method or an interpreted execution method. If there is an odex file matching the application in the odex file corresponding to the reference configuration file, the electronic device may run the application based on the odex file matching the application, so that the application runs more smoothly.
[0112] S503: Determine a first hotspot function set from functions called when the application is running.
[0113] In an embodiment of the present application, during the process of the electronic device running an application, many different application scenarios can be generated based on the received user operations, such as payment scenarios, shopping scenarios, chat scenarios, etc. The electronic device can then collect the functions called by running the application in different application scenarios, and then determine the first hot function set from the collected functions. Here, the number of calls to each hot function in the first hot function set is greater than or equal to the call number threshold corresponding to the application. It can be understood that the electronic device controls the running of different applications based on the user's operations, and then determines the first hot function set with a higher call frequency from the functions called when the application is running.
[0114] In some embodiments, the electronic device may collect the functions called when running each application, and sort the functions corresponding to each application from high to low according to the calling frequency, and then save the sorted functions of each application to a local database, and then determine the first hot function set from the functions saved in the local database according to the calling frequency threshold corresponding to each application. The first hot function set may include the hot functions of each application.
[0115] Exemplarily, assume that the electronic device collects the functions called when application A is running, including: function 1 is called 10 times; function 2 is called 8 times; function 3 is called 5 times; the functions called when application B is running include: function 4 is called 12 times; function 5 is called 10 times; function 6 is called 8 times; the functions called when application C is running include: function 7 is called 15 times; function 8 is called 12 times; function 9 is called 10 times. If the call count threshold corresponding to application A is 9 times, the call count threshold corresponding to application B is 10 times, and the call count threshold corresponding to application C is 11 times, then it can be determined that the hot functions of application A include function 1, the hot functions of application B include function 4 and function 5, and the hot functions of application C include function 7 and function 8. Therefore, it can be determined that the first hot function set includes: function 1, function 4, function 5, function 7 and function 8.
[0116] In some embodiments, the electronic device may periodically collect the functions called when running each application according to a preset time period, and then determine a first set of hot function from the functions collected within the preset time period. For example, the preset time period may be one week, and the electronic device may collect the functions called when running each application on a weekly basis, and then determine the hot functions when each application is running each week. In this way, it is possible to regularly update the hot functions of the electronic device running the application, so that the determined hot functions conform to the user's usage habits.
[0117] S504, updating the preconfigured hotspot function set based on the first hotspot function set to obtain a second hotspot function set, and generating a compilation result corresponding to the second hotspot function set.
[0118] In an embodiment of the present application, after the electronic device obtains the first hotspot function set, it can update the pre-configured hotspot function set in the reference configuration file based on the first hotspot function set to obtain a second hotspot function set, and then generate a compilation result corresponding to the second hotspot function set. It can be understood that the electronic device can update the hotspot function set in the pre-configured profile file according to the hotspot functions with high execution frequency during the actual operation of the application, and generate a corresponding odex file. In this way, the number of hotspot functions in the profile file can be streamlined, thereby reducing memory resource usage.
[0119] In some embodiments, the electronic device may update the preconfigured hotspot function set based on the first hotspot function set in such a way that the electronic device compares the first hotspot function set with the preconfigured hotspot function set, retains the hotspot functions in the preconfigured hotspot function set that are the same as those in the first hotspot function set, deletes the hotspot functions in the preconfigured hotspot function set that are different from those in the first hotspot function set, and adds hotspot functions in the first hotspot function set that are not included in the preconfigured hotspot function set. In other words, the final second hotspot function set may include the intersection of the preconfigured hotspot function set and the first hotspot function set, as well as the hotspot functions in the first hotspot function set except for the intersection, and does not include the hotspot functions in the preconfigured hotspot function set except for the intersection.
[0120] Exemplarily, it is assumed that the first hot function set includes function a, function b and function c, and the preconfigured hot function set includes function a, function c, function e and function f. The electronic device may update the preconfigured hot function set based on the first hot function set by retaining function a and function c in the preconfigured hot function set, deleting function e and function f, and adding function b. By deleting redundant hot functions in the preconfigured hot function set, it helps to reduce memory resource usage.
[0121] In some embodiments, the electronic device can detect whether there is operation exception information during the process of running the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set. If the operation exception information is detected, it can be found whether there is a just-in-time compilation (JIT) exception in the operation exception information. In the case of a just-in-time compilation exception, the compilation function corresponding to the just-in-time compilation exception can be obtained. Then the electronic device can add the compilation function corresponding to the just-in-time compilation exception to the second hotspot function set. Among them, the operation exception information can also be described as performance fault information. After the electronic device detects the operation exception information, the exception type can be identified according to the operation exception information. If it is identified that there is an exception caused by JIT compilation lock (which can be called just-in-time compilation exception), then the function being compiled when the just-in-time compilation exception occurs can be obtained, that is, the compilation function corresponding to the just-in-time compilation exception described above. In this case, even if the compilation function corresponding to the just-in-time compilation exception is not identified as a hotspot function of the application, the compilation function corresponding to the just-in-time compilation exception can also be added to the second hotspot function set, so that the compilation function corresponding to the just-in-time compilation exception can be pre-compiled into machine code before the next execution, thereby avoiding the application operation exception caused by JIT compilation lock, such as jamming, frame loss and other problems, which is conducive to further improving the efficiency of application operation.
[0122] In some embodiments, after the electronic device obtains the compilation function corresponding to the just-in-time compilation exception, it can also query whether the compilation function corresponding to the just-in-time compilation exception already exists in the second hot function set. If the compilation function corresponding to the just-in-time compilation exception already exists in the second hot function set, there is no need to execute the step of adding the compilation function corresponding to the just-in-time compilation exception to the second hot function set. This is because the compilation function corresponding to the just-in-time compilation exception may be a hot function that the electronic device has identified when the application is running. However, since the compilation result corresponding to the hot function has not yet been generated, or the compilation result corresponding to the hot function has not yet taken effect after being generated, the electronic device still needs to use JIT compilation to execute the hot function, resulting in a just-in-time compilation exception. In this case, the compilation function corresponding to the just-in-time compilation exception already exists in the second hot function set, and the electronic device does not need to add it repeatedly.
[0123] Exemplarily, assuming that the hot functions in the second hot function set include function a, function b, and function c, if the compiled function corresponding to the just-in-time compilation exception obtained by the electronic device is function d, it can be known that function d has not been recognized by the electronic device as a hot function of the application, then the electronic device can add function d to the second hot function set, that is, the second hot function can also include function d; if the compiled function corresponding to the just-in-time compilation exception obtained by the electronic device is function a, it can be known that function a has been electronically recognized as a hot function of the application, then the electronic device does not need to repeatedly add function a. In this way, the electronic device can supplement and optimize the hot function set based on the detected functions that affect the smooth operation of the application, so as to facilitate the subsequent AOT compilation of these functions that affect the smooth operation of the application, thereby improving the operation efficiency of the application.
[0124] In some embodiments, after the electronic device obtains the second hotspot function set, it can generate a compilation result of the second hotspot function set when it is in an idle state. Here, the idle state of the electronic device may include a state where the electronic device is off and the battery is sufficient, and sufficient battery power may be, for example, a battery power greater than or equal to a battery threshold. Optionally, the electronic device may call dex2oat to compile the second hotspot function set to obtain a compilation result of the second hotspot function set. In this way, the functions in the second hotspot function set can be compiled in advance into machine code that can be directly executed by the electronic device, which is beneficial to improving the operating efficiency of the application.
[0125] In some embodiments, when the electronic device generates the compilation result of the second hotspot function set, the intersection of the preconfigured hotspot function set and the first hotspot function set in the second hotspot function set can be directly obtained from the compilation result corresponding to the preconfigured hotspot function set without repeated compilation. In other words, the electronic device can only compile the part of the second hotspot function set other than the intersection of the preconfigured hotspot function set and the first hotspot function set. Optionally, the electronic device can delete the compilation results corresponding to the hotspot functions in the preconfigured hotspot function set other than the intersection with the first hotspot function set to save memory resources.
[0126] S505, in response to the electronic device being in an idle state, restarting the electronic device, and running the application based on the compilation result corresponding to the second hotspot function set.
[0127] In the embodiment of the present application, after the electronic device obtains the compilation result corresponding to the second hotspot function set, the compilation result corresponding to the second hotspot function set has not yet taken effect. The electronic device needs to be restarted, and then the compilation result corresponding to the second hotspot function set is loaded into the memory, so that when the electronic device runs the application after restarting, the compilation result corresponding to the second hotspot function set can be queried from the memory, and the application is run based on the compilation result corresponding to the second hotspot function set, so that the application runs more smoothly.
[0128] In some embodiments, the electronic device being in an idle state may include the electronic device being in a state where the screen is off and charging, or may include the electronic device being in a state where the screen is off and the power is greater than or equal to a power threshold, so that the electronic device can be guaranteed to have sufficient power to restart, and then run the application based on the compilation result corresponding to the second hotspot function set. Since the compilation result corresponding to the second hotspot function set includes not only the machine code of the hotspot function obtained based on the user's usage habits, but also the machine code of the compiled function that affects the running of the application, the electronic device can directly identify this part of the machine code when running the application without having to compile it again, thereby achieving smooth operation of the application.
[0129] By implementing the embodiments of the present application, the electronic device can adaptively update the preconfigured hot function set based on the hot functions that users are accustomed to using when the application is actually running, and delete the redundant hot functions in the preconfigured hot function set, thereby saving memory resources. In addition, when the electronic device is in an idle state, a restart can be triggered so that the electronic device can run the application based on the compilation result corresponding to the updated hot function set, thereby improving the smoothness of the application operation.
[0130] In some embodiments, the electronic device can implement the method for adjusting the operation of the application provided in the embodiment of the present application by calling different modules. The following introduces the embodiment of the present application from the perspective of interaction between modules based on the software structure of the electronic device.
[0131] For example, see Fig. 6A and Figure 6B , Fig. 6A and Figure 6B A flowchart of another method for adjusting the operation of an application program provided in an embodiment of the present application. Fig. 6A As shown, steps A to C are the process of generating a reference configuration file. Fig. 6A and Figure 6B Steps S601 to S612 are the process by which the electronic device executes the method provided in the embodiment of the present application through interaction of various modules.
[0132] The following is a brief introduction to the process of generating a reference configuration file:
[0133] A. Collect pre-configured hotspot function sets.
[0134] The hot functions in the preconfigured hot function set can be frequently called functions collected by the test equipment through running test cases, or can also be frequently called functions collected by the test user simulating different usage scenarios to operate the application. Usually, the hot functions in the preconfigured hot function set cover all possible usage scenarios and are relatively large in number.
[0135] B. The server generates a reference configuration file based on the preconfigured hotspot function set.
[0136] The server can use the profman tool to convert the pre-configured hotspot function set into a reference configuration file (i.e., a file in .profile format).
[0137] C. The server adds the reference configuration file to the system upgrade package.
[0138] The server can add the reference configuration file to the system upgrade package, so that the electronic device can obtain the reference configuration file when downloading and installing the system upgrade package.
[0139] Combine the following Fig. 6A and Figure 6B The process of an electronic device executing an adjustment method for an application program provided in an embodiment of the present application through interaction of various modules is introduced.
[0140] See also Fig. 6A ,like Fig. 6A As shown, the method may include but is not limited to the following steps:
[0141] S601, compile a preconfigured hotspot function set in a reference configuration file to obtain a compilation result corresponding to the preconfigured hotspot function set.
[0142] After the electronic device is powered on for OTA upgrade, the compilation optimization module can be triggered to compile the pre-configured hotspot function set in the reference configuration file to obtain the compilation result of the pre-configured hotspot function set. In the process of OTA upgrade, the electronic device can download and install the system upgrade package wirelessly to obtain the reference configuration file in the system upgrade package.
[0143] S602: Run the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set.
[0144] Before running the application, the electronic device has already obtained the compilation results corresponding to the pre-configured hotspot function set. When running the application, there is no need to compile these functions, which is beneficial to improving the running efficiency of the application.
[0145] S603, collecting functions called when the application is running.
[0146] When the electronic device is running an application, it can receive user operations and call different functions according to the received user operations. The electronic device can collect the functions called when the application is running through the function collection module.
[0147] Optionally, the function collection module may periodically count the functions called when the application is running according to a preset time period, so as to obtain the functions that meet the user's usage habits in each time period.
[0148] S604, determining a first hotspot function set from functions called when the application is running.
[0149] Among them, the function acquisition module can send the functions called when the application is running to the hot function identification module. Furthermore, the hot function identification module can determine the first hot function set from the functions called when the application is running. The specific implementation process of the hot function identification module determining the first hot function set can be found in the relevant description in the above step S503, which will not be repeated here.
[0150] S605, updating the preconfigured hotspot function set based on the first hotspot function set to obtain a second hotspot function set.
[0151] After the hot function identification module identifies the first hot function set, it can send the first hot function set to the hot function update module. Correspondingly, the hot function update module can receive the first hot function set from the hot function identification module. Furthermore, the hot function update module can update the preconfigured hot function based on the first hot function set to obtain a second hot function set.
[0152] For example, see Figure 7 , Figure 7 A schematic diagram of updating a preconfigured hotspot function set provided in an embodiment of the present application. Figure 7 As shown, the first hot function set may include subset A and subset B, the preconfigured hot function set may include subset B and subset C, and the intersection of the first hot function set and the preconfigured hot function set is subset B. The hot function update module may retain the intersection part (i.e., subset B) of the preconfigured hot function set with the first hot function set, delete the part (i.e., subset C) of the preconfigured hot function set other than subset B, and add the part (i.e., subset A) of the first hot function set other than subset B to the preconfigured hot function set, and finally obtain the second hot function set.
[0153] S606, detecting abnormal operation information.
[0154] The anomaly detection module can detect operation anomaly information during the operation of the application program, and can send the detected operation anomaly information to the anomaly type identification module so that the anomaly type identification module can identify the anomaly type included in the operation anomaly information.
[0155] like Figure 6B As shown, the method may also include the following steps:
[0156] S607, identifying the just-in-time compilation exception in the execution exception information.
[0157] After receiving the operation exception information from the exception detection module, the exception type identification module can identify the exception type included in the operation exception information and find out whether there is a just-in-time compilation exception. If there is a just-in-time compilation exception, the compilation function corresponding to the just-in-time compilation exception is obtained and sent to the hot function update module.
[0158] S608: Update the second hotspot function set based on the compiled function corresponding to the just-in-time compilation exception.
[0159] After receiving the compiled function corresponding to the just-in-time compilation exception sent by the exception type identification module, the hot function update module can update the second hot function set based on the compiled function corresponding to the just-in-time compilation exception. In other words, the hot function update module can add the compiled function corresponding to the just-in-time compilation exception to the second hot function set.
[0160] Optionally, before adding the compilation function corresponding to the just-in-time compilation exception to the second hot function set, the hot function update module can first query whether there is a compilation function corresponding to the just-in-time compilation exception in the second hot function set. If the compilation function corresponding to the just-in-time compilation exception already exists in the second hot function set, there is no need to execute the step of adding the compilation function corresponding to the just-in-time compilation exception to the second hot function set.
[0161] S609, compile the hotspot functions in the second hotspot function set that are different from the pre-configured hotspot function set, and determine the compilation result corresponding to the second hotspot function set.
[0162] The hot function update module can send the updated second hot function set to the compilation optimization module. After receiving the second hot function set from the hot function update module, the compilation optimization module can compile the hot functions in the second hot function set that are different from the preconfigured hot function set. In other words, the compilation optimization module can compile the hot functions in the second hot function set that are newly added compared to the preconfigured hot function set, and obtain the compilation results corresponding to the hot functions in the newly added part. Then, combined with the corresponding compilation results of the preconfigured hot function set obtained in step S601 and the corresponding compilation results of the hot functions in the newly added part, the compilation results corresponding to all hot functions in the second hot function set can be obtained.
[0163] Optionally, the compilation optimization module may also delete compilation results corresponding to hotspot functions in the preconfigured hotspot function set except for the intersection with the first hotspot function set, so as to save memory resources.
[0164] S610, identifying the status of the electronic device.
[0165] The system state identification module can identify whether the state of the electronic device is an idle state. For example, the electronic device can be identified as an idle state by the system state identification module after the screen is turned off and charged and it is left idle for a certain time threshold.
[0166] S611, restart the electronic device.
[0167] When the system status identification module identifies that the state of the electronic device is idle, the system status identification module can send a message to the restart module indicating that the current state is idle, and then the restart module can control the restart of the electronic device and trigger the restart of the system application, so that the compilation result corresponding to the second hot function set takes effect.
[0168] S612: Run the application in the electronic device based on the compilation result corresponding to the second hotspot function set.
[0169] After the electronic device is restarted, the application program can be run based on the compilation result corresponding to the second hotspot function set, thereby improving the running efficiency of the application program.
[0170] In order to more clearly illustrate the adjustment method of the application program operation provided by the present application, the following is combined with Figure 8 See Figure 8 , Figure 8 A flowchart of another method for adjusting the operation of an application program provided in an embodiment of the present application is shown below. Figure 8 As shown, the method may include but is not limited to the following steps:
[0171] S801, electronic equipment restarts after system upgrade.
[0172] Optionally, the electronic device can receive a push of the latest version of the system upgrade package, download and install the system upgrade package, execute the system upgrade process, and restart after the upgrade is complete.
[0173] S802: Run the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set.
[0174] The implementation process of step S802 can be found in Figure 5 The relevant description of step S502 in the illustrated embodiment is not repeated here.
[0175] S803, recording the functions called during the running of the application.
[0176] When running an application, the electronic device can receive user operations and call corresponding functions in response to the user operations. Among them, the electronic device can record the functions called when the application is running and count the number of calls of each function. The longer the application runs and the more user operations it receives, the more detailed the functions recorded by the electronic device are, so as to identify function information that conforms to the user's usage habits. Optionally, the electronic device can save the collected functions and the number of function calls to a local database.
[0177] S804, determining a first hotspot function set from functions called when the application is running.
[0178] For an application, the electronic device can determine the hot function corresponding to the application based on the functions called when the application is running and the number of times the function is called. The hot function corresponding to an application can be a function whose number of calls is greater than or equal to the threshold of the number of calls corresponding to the application. In this way, the electronic device can determine the hot function corresponding to each application and obtain the first hot function set. In this way, the first hot function set can be considered as a hot function set determined according to the user's operating habits, so as to more accurately improve the operating efficiency of the application.
[0179] S805: Compare whether the hotspot functions in the first hotspot function set are the same as the hotspot functions in the pre-configured hotspot function set.
[0180] After the electronic device obtains the first hot function set, it can compare whether the hot function included in the first hot function set is the same as the hot function included in the preconfigured hot function set. In the case where the hot function included in the first hot function set is completely consistent with the hot function included in the preconfigured hot function set, there is no need to perform subsequent steps. Optionally, the electronic device can update the first hot function set at a preset time interval, and execute step S605 after the first hot function set is updated.
[0181] S806: abnormal operation information is detected.
[0182] When the electronic device is running the application, it can also detect whether there is abnormal operation information. If abnormal operation information is detected, the abnormal type corresponding to the abnormal operation information can be further determined.
[0183] S807, whether there is any just-in-time compilation exception in the running information.
[0184] Optionally, the operation exception information may include one or more of the name of the application package where the exception occurs, the name of the waiting lock, the waiting lock process, the lock holding process name, the event description, and the call stack function. The electronic device can identify whether there is a just-in-time compilation exception in the operation information based on the operation exception information.
[0185] S808, obtaining the compilation function corresponding to the just-in-time compilation exception.
[0186] When the exception type is a just-in-time compilation exception, the electronic device may obtain a compilation function corresponding to the just-in-time compilation exception, and record the compilation function corresponding to the just-in-time compilation exception.
[0187] S809: Update the preconfigured hot function set according to the first hot function set and the compilation function corresponding to the just-in-time compilation exception to obtain a second hot function set.
[0188] Optionally, the electronic device may first determine whether there is a compilation function corresponding to the just-in-time compilation exception in the first hotspot function set. If there is a compilation function corresponding to the just-in-time compilation exception in the first hotspot function set, the preconfigured hotspot function set may be directly updated based on the first hotspot function set. If there is no compilation function corresponding to the just-in-time compilation exception in the first hotspot function set, the compilation function corresponding to the just-in-time compilation exception may be added to the first hotspot function set, and then the preconfigured hotspot function set may be updated based on the first hotspot function set. The process of the electronic device updating the preconfigured hotspot function set based on the first hotspot function set can be found in Figure 7 The relevant description is not repeated here.
[0189] S810, determining the compilation result corresponding to the second hotspot function set.
[0190] Based on the compilation results corresponding to the preconfigured hotspot function set, the electronic device can compile the hotspot functions in the second hotspot function set that are newly added compared to the preconfigured hotspot function set, and delete the compilation results corresponding to the redundant hotspot functions in the preconfigured hotspot function set, that is, delete the compilation results corresponding to the hotspot functions that do not conform to the user's usage habits, thereby obtaining the compilation results corresponding to the second hotspot function set.
[0191] S811, in response to the electronic device being in an idle state, restarting the electronic device, and running the application based on the compilation result corresponding to the second hotspot function set.
[0192] The implementation process of step S811 can be found in Figure 5 The relevant description of step S505 in the illustrated embodiment is not repeated here.
[0193] In the embodiment of the present application, on the one hand, the electronic device can determine the hot function set according to the user's operating habits when the application is running; on the other hand, the hot function set can be further supplemented according to the compiled functions that affect the smooth operation of the application detected by the system when the application is running, thereby determining the hot function set that helps to improve the operating efficiency of the application, and pre-compiling the compilation results of this part of the hot function. In this way, not only can the consumption of memory resources be saved, but also the problem of application running jams can be reduced.
[0194] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part 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, the process or function described in this application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk), etc.
[0195] For example, see Fig. 9 , Fig. 9 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. Fig. 9As shown, the chip system includes one or more (including two) processors 901, a communication interface 902, a memory 903, and a communication line 904. The processor 901, the communication interface 902, and the memory 903 can be interconnected through the communication line 904. For example, the communication interface 902 can be used to receive signals from other devices (such as the memory of an electronic device). For another example, the communication interface 902 can be used to send signals to other devices (such as the processor 901 or the touch screen of an electronic device). Exemplarily, the communication interface 902 can read the instructions stored in the memory 903 and send the instructions to the processor 901. When the instructions are executed by the processor 901, the electronic device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0196] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a hard disk drive (HDD), a solid-state drive (SSD), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct rambus RAM (DRRAM). Memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0197] It should also be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0198] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) is integrated in the processor.
[0199] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0200] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0201] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments provided herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0202] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0203] The modules / units in the device of the embodiment of the present application can be combined, divided and deleted according to actual needs.
[0204] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for adjusting the operation of an application, characterized in that: The method is applied to an electronic device, and the method comprises: Downloading and installing a system upgrade package, wherein the reference configuration file in the system upgrade package includes a preconfigured hotspot function set; Running the application in the electronic device based on the compilation result corresponding to the preconfigured hotspot function set; Determine a first hot function set from the functions called when the application is running; the number of calls of each hot function in the first hot function set is greater than or equal to the call number threshold corresponding to the application; In response to detecting the operation exception information, searching whether there is a just-in-time compilation exception in the operation exception information; the operation exception information is exception information detected when the application is run based on the compilation result corresponding to the preconfigured hotspot function set; In response to the existence of the just-in-time compilation exception in the operation exception information, obtaining a compilation function corresponding to the just-in-time compilation exception; Based on the first hot function set and the compilation function corresponding to the just-in-time compilation exception, the preconfigured hot function set is updated to obtain a second hot function set, and a compilation result corresponding to the second hot function set is generated; In response to the electronic device being in an idle state, the electronic device is restarted, and the application is run based on the compilation result corresponding to the second hotspot function set.
2. The method according to claim 1, characterized in that The second hotspot function set includes the intersection of the preconfigured hotspot function set and the first hotspot function set, and the hotspot functions in the first hotspot function set except the intersection, and does not include the hotspot functions in the preconfigured hotspot function set except the intersection.
3. The method according to any one of claims 1 or 2, characterized in that The idle state includes a charging and screen-off state.
4. The method according to any one of claims 1 to 3, characterized in that: Determining a first hotspot function set from functions called when the application is running includes: Counting the functions called when the application is running within a preset time period; A first set of hot spot functions is determined from the functions.
5. The method according to claim 4, characterized in that The counting of functions called when the application is running within a preset time period includes: The function collection module is called through the application framework layer to count the functions called when the application is running within a preset time period.
6. An electronic device, characterized in that: It includes a memory and one or more processors; the memory is coupled to the one or more processors and is used to store a computer program, and the computer program includes program instructions; the one or more processors call the program instructions so that the electronic device executes the method as described in any one of claims 1-5.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. A chip system, characterized in that: The chip system is coupled to a memory, and the chip system is used to read and execute a computer program stored in the memory to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Application program updating method and related device
CN116088888A