A load processing method and related device
Through prediction and dynamic time regularization algorithm based on historical load data, the accurate scheduling of electronic device resource modules is achieved, the traditional scheduling lag problem is solved, and the response speed is improved.
Patent Information
- Application Number
- CN202110211494.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-25
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-02-25
AI Technical Summary
The load calculation and resource scheduling of traditional electronic devices have certain lags, resulting in slow response speed.
By predicting the current load based on historical load data, using dynamic time regularization (DTW) algorithm to match history and current load, accurately scheduling of resource modules.
Improve the accuracy of resource scheduling and improve the response speed of electronic devices.
Smart Images

Figure CN114968546B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic technology, and in particular to a load processing method and related devices. Background Art
[0002] With the development of technology, electronic devices such as smart phones and tablet computers support more and more functions, and users can use various APPs on smart terminals. In order to ensure the performance of electronic devices and thus meet user experience, electronic devices need to perform resource scheduling based on the load conditions of electronic devices. In traditional technology, electronic devices generally count the load contribution of the current task to the system based on the load (capacity) of the previous period of execution of the task, and schedule resources for the task based on the above load contribution. For example, the PELT algorithm or the WALT algorithm is called to count the CPU load of the current task based on the load conditions of the previous period. When the CPU load of the current task is large, the frequency of the central processing unit (CPU) can be increased, and when the CPU load of the current task is small, the frequency of the CPU can be reduced.
[0003] Since user operations on electronic devices are sudden, and traditional technologies schedule resources based on the load conditions in the previous period at the current moment, there is a certain lag in load calculation and resource scheduling, which leads to slow response speed of electronic devices. Summary of the Invention
[0004] The embodiments of the present application provide a load processing method and related devices, which can improve the accuracy of resource scheduling and effectively improve the response speed of electronic devices.
[0005] In the first aspect, the present application provides a load processing method, comprising: in response to a first instruction, a first electronic device executes a first transaction and determines that the transaction type of the first transaction is a first transaction type; at the starting moment of the j-th load cycle of executing the first transaction, the first electronic device predicts, based on the first current load data and the first historical load data of the first transaction type of the first resource module, that the first current load of the first resource module in the above-mentioned j-th load cycle is equal to the historical load value of the H-th load cycle in the first historical load data, and performs resource scheduling on the first resource module based on the first current load; wherein the first current load data includes the current load of the first resource module in the j-1 load cycles before the current execution of the first transaction, and the first historical load data includes the historical load values of K load cycles, j, H and K are positive integers, and H is less than or equal to K.
[0006] In implementing the embodiments of the present application, the first electronic device can obtain historical load data for each transaction type of each resource module. When the first electronic device executes a transaction of a specified transaction type, the first electronic device calculates the current load of the first resource module of the first electronic device for that transaction. Based on the historical load data and current load of the first resource module for the specified transaction type, load prediction and resource scheduling are performed for the first resource module. In this way, when the first electronic device executes a transaction of the specified transaction type, it can accurately predict the load of the first resource module in the current load cycle, thereby improving the accuracy of resource scheduling, meeting the performance requirements of the first resource module, and effectively improving the response speed of the first electronic device.
[0007] In one implementation, the first instruction is a first input operation that acts on a first activity of a first application and is used to trigger a second activity of a second application.
[0008] In one implementation, the first instruction is an instruction sent by the second electronic device, and the first instruction is an instruction that acts on the first activity of the first application and is used to trigger the second activity of the second application; or, the first instruction is an instruction that is used to trigger the second activity of the second application.
[0009] In one implementation, the above-mentioned determination that the transaction type of the first transaction is the first transaction type includes: based on at least one of the first instruction, the first activity acted upon by the first instruction, and the second activity triggered by the first instruction, the first electronic device determines that the transaction type of the first transaction is the first transaction type.
[0010] In one implementation, the method further includes: at the starting moment of the jth load cycle of executing the first transaction, the first electronic device predicts, based on the current load of the second resource module in the j-1 load cycles before the current execution of the first transaction, and the second historical load data of the first transaction type of the second resource module, that the second current load of the second resource module in the jth load cycle is equal to the historical load value of the Pth load cycle in the second historical load data, and performs resource scheduling on the second resource module based on the second current load; wherein the second historical load data includes historical load values of D load cycles, P and D are positive integers, and P is less than or equal to D.
[0011] In one implementation, the resource module of the first electronic device includes at least two of a CPU, a GPU, a DDR, a disk, and a network card.
[0012] In one implementation, the first electronic device counts the current load of the first resource module in each load cycle; the above-mentioned prediction based on the first current load data and the first historical load data of the first transaction type of the first resource module, the first current load of the first resource module in the jth load cycle is equal to the historical load value of the Hth load cycle in the first historical load data, including: the first electronic device uses the dynamic time warping DTW algorithm to determine that the historical load value in the first historical load data that best matches the j-1th current load in the first current load data is the historical load value of the H-1th load cycle; the first electronic device predicts that the first current load of the first resource module in the above-mentioned jth load cycle is equal to the historical load value of the above-mentioned Hth load cycle in the first historical load data.
[0013] In one implementation, transactions corresponding to the same user operation acting on the same activity are of the same transaction type. Determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first input operation and the first activity acted upon by the first input operation.
[0014] In one implementation, transactions corresponding to the same user operation that triggers the same activity are of the same transaction type. The above-mentioned determination that the transaction type of the first transaction is the first transaction type includes: based on the first input operation and the second activity triggered by the first input operation, determining that the transaction type of the first transaction is the first transaction type.
[0015] In one implementation, transactions corresponding to instructions triggering the same activity are of the same transaction type, and determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the second activity triggered by the first instruction.
[0016] In one implementation, transactions corresponding to instructions that act on and trigger the same activity are of the same transaction type. The determining that the transaction type of the first transaction is the first transaction type includes: determining that the transaction type of the first transaction is the first transaction type based on the first activity acted on and the second activity triggered by the first instruction.
[0017] In one implementation, the activities of all applications of the first electronic device include P types of activities, and the classification of the activities is determined based on the resources required by the electronic device to run the activities. The resources required for the same type of activities are similar, where P is a positive integer greater than 1; the transaction type of the first transaction is determined to be the first transaction type.
[0018] In one implementation, the transaction types are divided into at least one of the following: transactions corresponding to the same user operation acting on the same type of activity are of the same transaction type; transactions corresponding to the same user operation triggering the same type of activity are of the same transaction type; transactions corresponding to instructions triggering the same type of activity are of the same transaction type; and transactions corresponding to instructions acting on and triggering the same type of activity are of the same transaction type.
[0019] In one implementation, the first resource module is a CPU, and the current load of the first resource module in each load cycle can be determined based on the time that each task in the task queue is in an executable state within the load cycle. The above-mentioned resource scheduling of the first resource module based on the first current load includes: adjusting the CPU frequency based on the first current load, performing CPU task preemption and / or performing CPU core selection among multiple CPUs.
[0020] In one implementation, the first resource module is a GPU, and the current load of the first resource module in each load cycle can be the number of Opengl instructions processed in the load cycle. The above-mentioned resource scheduling of the first resource module based on the first current load includes: adjusting the GPU frequency based on the first current load.
[0021] In one implementation, the first resource module is DDR, and the current load of the first resource module in each load cycle can be the DDR memory occupancy in the load cycle. The above-mentioned resource scheduling of the first resource module based on the first current load includes: adjusting the operating frequency of DDR based on the first current load.
[0022] In one implementation, the first resource module is a disk, and the current load of the first resource module in each load cycle can be the IO bandwidth within the load cycle. The above-mentioned resource scheduling of the first resource module based on the first current load includes: adjusting the reserved bandwidth size of the disk I / O based on the first current load.
[0023] In one implementation, the first resource module is a network card, and the current load of the first resource module in each load cycle can be the number of bytes of network I / O messages sent and received during the load cycle. The above-mentioned resource scheduling of the first resource module based on the first current load includes: adjusting the reserved bandwidth of the network I / O based on the first current load. In an embodiment of the present application, the first application and the second application can be the same application, and the first Activity and the second Activity can be the same Activity of the same application, or different Activities of the same application; or, the first application and the second application can also be different applications. The first Activity can also be called Activity1, and the second Activity can also be called Activity2.
[0024] In a second aspect, the present application provides an electronic device comprising one or more processors, one or more memories, and a touch screen. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, which includes computer instructions. When the one or more processors execute the computer instructions, the electronic device performs the load processing method of any possible implementation of the first aspect.
[0025] In a third aspect, an embodiment of the present application provides a computer storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the load processing method in any possible implementation of any of the above aspects.
[0026] In a fourth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the load processing method in any possible implementation of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0028] Figures 2A to 2F Related user interface of the news APP provided in the embodiment of this application;
[0029] Figure 3 This is a load statistic provided by an embodiment of the present application when a user uses a news APP;
[0030] Figure 4A A flow chart of a load processing method provided in an embodiment of the present application;
[0031] Figure 4B A schematic diagram of a process for predicting the current load of the current load cycle provided in an embodiment of the present application;
[0032] Figure 5 A schematic diagram of a curve of historical load data provided in an embodiment of the present application;
[0033] Figure 6 This is a load prediction for a user using a news app, as provided in an embodiment of the present application.
[0034] Figure 7 A system architecture diagram of a software system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following is a clear and detailed description of the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship between related objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0036] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0037] The electronic device 100 involved in the embodiments of the present application is introduced below.
[0038] See also Figure 1 , Figure 1 A schematic structural diagram of an exemplary electronic device 100 provided in an embodiment of the present application is shown.
[0039] The electronic device 100 can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device. The embodiments of the present application do not impose any special restrictions on the specific type of the electronic device 100.
[0040] The electronic device 100 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. 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.
[0041] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0042] The processor 110 may include one or more processing units. For example, the processor 110 may include one or more CPUs, or include a CPU and a graphics processing unit (GPU), or include an application processor (AP) and a coprocessor. For example, the coprocessor may include a GPU, an image signal processor (ISP), a neural-network processing unit (NPU), a modem processor, a controller, a digital signal processor (DSP), a baseband processor, and / or a video codec. The different processing units may be independent devices or integrated into one or more processors.
[0043] In some embodiments, the processor uses the rising edge of the clock pulse as the basis for executing instructions. Therefore, the higher the clock frequency of the processor, the more instructions the processor can execute per unit time, and the faster the processor operates.
[0044] In an embodiment of the present application, the electronic device 100 can perform processor resource scheduling based on the load of the processor (e.g., CPU, GPU), for example, by adjusting the frequency of the processor. For example, when the processor load of the electronic device 100 currently executing a task is large, the processor frequency can be increased, and when the processor load of the electronic device 100 currently executing a task is small, the processor frequency can be reduced.
[0045] The CPU is the final execution unit for information processing and program execution. The CPU primarily consists of an arithmetic logic unit (ALU), a cache memory, and a data, control, and status bus that connects them. In computer architecture, the CPU is the core hardware unit that controls and coordinates all hardware resources (such as memory and input / output units) and performs general-purpose operations. Operations at all software layers in a computer system are ultimately mapped to CPU operations through the instruction set. The CPU's operating frequency, as a key parameter of CPU performance, is crucial for improving CPU computing speed.
[0046] A GPU, also known as a display core, visual processor, or display chip, is a microprocessor specialized for image and graphics-related computations. Core technologies employed by a GPU include hardware T&L, cubic environment material mapping and vertex blending, texture compression and bump mapping, and a dual-texture quad-pixel rendering engine. GPU performance is determined by a variety of factors, including operating frequency, video memory, pixel pipeline, and pixel fill rate. The GPU's operating frequency can, to a certain extent, reflect the performance of the display core of electronic device 100.
[0047] 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.
[0048] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0049] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0050] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.
[0051] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.
[0052] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0053] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.
[0054] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0055] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0056] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.
[0057] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0058] The wireless communication functionality of electronic device 100 is implemented using antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
[0059] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. 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.
[0060] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0061] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0062] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0063] Electronic device 100 can implement a camera function using an ISP, camera 193, video codec, GPU, display 194, and application processor. The ISP processes data fed back by camera 193. Camera 193 is used to capture still images or video. In some embodiments, electronic device 100 may include one or N cameras 193, where N is a positive integer greater than one.
[0064] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0065] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0066] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0067] The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, in a location different from that of the display screen 194.
[0068] The external memory interface 120 can be used to connect to an external non-volatile memory to expand the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 via the external memory interface 120 to implement data storage. For example, files such as music and videos can be stored in the external non-volatile memory.
[0069] The internal memory 121 may include one or more random access memories (RAMs) and one or more non-volatile memories (NVMs). RAMs may include static random access memories (SRAMs), dynamic random access memories (DRAMs), synchronous dynamic random access memories (SDRAMs), and double data rate synchronous dynamic random access memories (DDR SDRAMs, such as the fifth generation DDR SDRAM, commonly referred to as DDR5 SDRAMs). NVMs may include disk storage devices and flash memories. Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle; single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc. according to the storage cell potential level; universal flash storage (UFS), embedded multi-media card (eMMC), etc. according to the storage specification. Random access memory can be directly read and written by processor 110, and can be used to store executable programs (such as machine instructions) of operating systems or other running programs, and can also be used to store user and application data. Non-volatile memory can also store executable programs and user and application data, etc., and can be loaded into random access memory in advance for direct reading and writing by processor 110.
[0070] The memory frequency of the internal memory is usually measured in MHz (megahertz). The operating frequency of the internal memory determines the actual performance of the internal memory to a certain extent. The higher the operating frequency of the internal memory, the faster the storage speed of the internal memory under normal operation, that is, the more bytes can be read and written per second.
[0071] In an embodiment of the present application, the electronic device 100 can perform resource scheduling of the internal memory based on the load of the internal memory, such as adjusting the operating frequency of the internal memory. For example, when the load of the internal memory is large, the operating frequency of the internal memory can be increased, and when the load of the internal memory is small, the operating frequency of the internal memory can be reduced.
[0072] Traditional SDRAM can only transmit data once during the rising phase of the clock pulse in a cycle. DDR SDRAM, however, has a double data rate and can transmit data once during both the rising and falling phases of the clock pulse in a cycle. Therefore, compared to traditional SDRAM, DDR SDRAM operates at twice the clock frequency.
[0073] In an embodiment of the present application, the electronic device 100 can adjust the operating frequency, equivalent frequency, and memory bandwidth of the DDR by adjusting the clock frequency of the DDR. In some embodiments, the electronic device 100 can also adjust the clock frequency and / or voltage of the DDR based on the load of the processor (e.g., CPU). For example, when the CPU load is large, the clock frequency of the DDR can be increased, while when the CPU load is small, the clock frequency of the DDR can be reduced.
[0074] Disk I / O, as the name suggests, refers to disk input and output. Input refers to writing data to the disk, and output refers to reading data from the disk. Disk performance metrics include input / output per second (IOPS), bandwidth, and response time. IOPS refers to the number of I / O requests a system can process per unit time. I / O requests are typically read or write operations. IOPS is a key metric for applications with frequent random reads and writes, such as online transaction processing (OLTP). Bandwidth refers to the amount of data a disk can successfully transfer per unit time, or the number of bytes it can read and write per second. It measures the data throughput of a storage system. For applications with large amounts of sequential reads and writes, such as online analytical processing (OLAP) and video on demand (VOD), throughput is a more important metric. Response time, also known as latency or service time, refers to the interval between the initiation of a disk I / O request and its completion, often measured in milliseconds (ms).
[0075] Disk bandwidth reservation technology reserves bandwidth for disk I / O operations of a specific service to ensure that the service's bandwidth requirements are met during operation. For example, if the maximum supported I / O speed of a disk is 30MB / s and the available bandwidth is 20MB / s, you can set the reserved bandwidth to 10MB / s to ensure the required bandwidth.
[0076] In an embodiment of the present application, disk resource scheduling can be performed based on disk load, such as adjusting the disk I / O reserved bandwidth. For example, when the disk load is heavy, the disk I / O reserved bandwidth can be increased, while when the disk load is light, the disk I / O reserved bandwidth can be decreased.
[0077] The hardware foundation for network I / O is the network interface card (NIC). After network data reaches the NIC, its destination is the application's memory. However, applications cannot directly access the NIC, so the operating system is required to act as an intermediary. The network I / O process consists of two phases. The first phase involves waiting for network data packets to arrive. The operating system caches the received NIC data packets in a kernel buffer. The second phase involves the application calling an operating system function, retrieving data from the corresponding kernel buffer, and copying it to the application process buffer. Network I / O bandwidth reservation technology ensures the network bandwidth requirements of specific services by reserving bandwidth on the network path where their traffic traverses. Network I / O models include synchronous I / O, blocking I / O, non-blocking I / O, multiplexing I / O, signal-driven I / O, and asynchronous I / O.
[0078] In the embodiment of the present application, the electronic device 100 can perform network resource scheduling based on the load of the network card (i.e., the load of the network I / O), such as adjusting the reserved bandwidth of the network I / O. For example, when the load of the network I / O is large, the reserved bandwidth of the network I / O can be increased, and when the load of the network I / O is small, the reserved bandwidth of the network I / O can be reduced.
[0079] In an embodiment of the present application, the electronic device 100 can count the load of the currently executed task on the system based on the load of the task in the time period before the current moment, and schedule resources for the task based on the counted load.
[0080] In some embodiments of the present application, the electronic device 100 can use the PELT algorithm or the WALT algorithm to calculate the CPU load of the currently executed task in the time period before the current moment. The PELT algorithm or the WALT algorithm is introduced below.
[0081] (1) PELT algorithm
[0082] In a multiprocessor system, each CPU maintains a run queue, which can contain one or more processes in a sleep state or a runnable state. A runnable state refers to a process that is currently running on the CPU or waiting in a run queue for the CPU to schedule it to run.
[0083] The PELT algorithm divides time into sequences with a period of 1024us. In each 1024us period, the contribution of a scheduling entity (i.e., a process or a group of processes in a control group) corresponding to a task in the run queue to the system load can be calculated based on the time the scheduling entity is in the runnable state. The load of a task within a 1024us period is the instantaneous load. If the time the task is in the runnable state within this period is t, then the instantaneous load of the task within this period is proportional to (t / 1024). In addition, tasks of different priorities also impose different loads on the system. The instantaneous load of the task within this period can be expressed as w*(t / 1024), where w is the load weight corresponding to the task priority. In the PELT algorithm, at the current point in time, the total contribution of a scheduling entity to the system load can be expressed as: L = L0 + L1*y + L2*y 2 +L3*y 3 +…+Ln*y n , where Li represents the contribution of the scheduling entity to the system load in period Pi, Pi is the next period after Pi+1, P0 is the most recent period, and y is the attenuation factor.
[0084] The above formula shows that a scheduling entity's load contribution to the system is a power series sum. Past load is also accumulated through a gradual decay, multiplied by the decay factor y. The current load contribution is equal to the total load contribution from the previous cycle multiplied by the decay factor y, plus the instantaneous load from the most recent cycle. In Linux, y^32 is set to 0.5. This means that after 32 1024µs cycles, a scheduling entity's load contribution to the current time is reduced by half.
[0085] It can be understood that the PELT algorithm tracks the load of the scheduling entity corresponding to each task, and the overall load of the run queue of each CPU is a statistical value (such as an average value) of the load corresponding to all tasks in the run queue.
[0086] (2) WALT algorithm
[0087] The WALT algorithm divides time into multiple time windows according to a certain time length. For example, a time window is 20ms. The electronic device 100 counts the CPU load of each time window, and at the starting moment of time window 1, takes the average load value, maximum load value or minimum load value of the load of the first N time windows as the CPU load value of the time window. The electronic device 100 can determine which specific value strategy to use (i.e., the above-mentioned average load value, maximum load value or minimum load value) based on different system performance and power consumption requirements. The electronic device 100 can configure the value strategy of the WALT algorithm through the user-mode configuration interface.
[0088] Similar to the PELT algorithm, the WALT algorithm also considers the load weight of each task and tracks the load of each task's corresponding scheduling entity. The overall load of each CPU's run queue is a statistical value (e.g., an average) of the loads of all tasks in that run queue. Unlike the PELT algorithm, the WALT algorithm uses a time window approach, which can more quickly reflect actual changes in CPU load.
[0089] Electronic device 100 cannot predict user behavior, and input operations are sudden and intermittent. After a user operates electronic device 100, electronic device 100 must immediately respond to the input operation and execute the corresponding transaction, which causes a surge in the load on electronic device 100. After the transaction is completed, the load on electronic device 100 decreases significantly.
[0090] For example, Figures 2A to 2F Shows the user interface of the news application (Appliccation, APP), correspondingly, Figure 3 The figure shows the CPU load changes during the user's use of the News APP.
[0091] Figure 2A The user interface 11 for displaying applications installed on the electronic device 100 is shown. The user interface 11 may include: a status bar 201, a navigation bar 202, a calendar indicator 203, a weather indicator 204, a tray 205 with common application icons, and a display area 206 for other application icons.
[0092] The navigation bar 202 may include system navigation keys such as a return key 202A, a home key 202B, and a multitasking key 202C. When the user is detected to have clicked the return key 202A, the electronic device 100 may display the previous page of the current page; when the user is detected to have clicked the home key 202B, the electronic device 100 may display the main interface; when the user is detected to have clicked the multitasking key 202C, the electronic device 100 may display preview images of the user's most recently opened applications in the multitasking management interface. Not limited to virtual keys, in embodiments of the present application, the navigation keys in the navigation bar 202 may also be implemented as physical keys. In some embodiments, the electronic device 100 may also implement the functions of the navigation keys in the navigation bar 202 through user gesture navigation.
[0093] The display area 206 for other application icons may display: a payment application icon, an album icon, a music icon, a browser icon, a mailbox icon, a news icon 206A, a memo icon, and a setting icon. The user interface 11 may further include a page indicator 207 .
[0094] The news icon 206A can receive an input operation (such as a click operation). In response to the input operation detected, the electronic device 100 starts the news APP and displays the news. Figure 2B The user interface 12 shown includes one or more news links 301. The user interface 12 may also include a URL input box 302, a search box 303, and a menu bar 304. The menu bar 304 may include a share button 304A, a settings button 304B, a home button 304C, and a more button 304D. Figure 2B and Figure 2C As shown, the electronic device 100 can receive a click operation on the news link 301A in the one or more news links 301. In response to the click operation, the electronic device 100 obtains the news content 305 corresponding to the news link and displays it in the user interface 13. The user browses the news content 305 displayed by the electronic device 100. Since the screen of the electronic device 100 can only display a limited amount of content, the user can slide the news content 305 displayed by the electronic device 100 to view more news content. Figure 2C and Figure 2D As shown, the electronic device 100 can receive a sliding operation on the news content 305. In response to the sliding operation, the electronic device 100 displays more news content 306 corresponding to the news link on the user interface 13. Figure 2E and Figure 2F As shown, the electronic device 100 can also receive a return operation applied to the return key 205A. In response to the return operation, the electronic device 100 displays the user interface 12 .
[0095] Figure 3Taking the electronic device 100 receiving the user's return operation as an example, the CPU load calculated by the PELT algorithm and the WALT algorithm are also shown. Figure 3 As shown in the figure, the PELT algorithm responds slowly to situations where the load increases or decreases rapidly. This is because the PELT algorithm uses a decay accumulation calculation method, and the load calculation has a certain lag. The actual load mutation requires a certain period of time to be fed back in the data. Compared with the PELT algorithm, the WALT algorithm that uses time window division reports data more promptly, and the statistical load can more directly reflect the current situation; however, the load statistically calculated by the WALT algorithm still depends on the load situation in the previous period of time at the current moment. Figure 3 It can be seen that the WALT algorithm is still slow to respond to sudden changes in load. This slow response speed can cause the electronic device 100 to be unable to timely schedule resources based on the actual load situation, and the electronic device 100 is slow to respond to input operations, affecting the user experience.
[0096] In an embodiment of the present application, the electronic device 100 can classify the related transactions of each application into types. For example, the transaction types of the above-mentioned news APP may include click transactions, sliding transactions, and return transactions. In view of the fact that the load conditions caused by the electronic device 100 processing the same type of transactions each time are similar, in an embodiment of the present application, the electronic device 100 can statistically process the historical load data in the process of executing the same type of transactions, and combine the historical load data and current load of the type of transactions to predict the current load of the electronic device 100 in the current load cycle to execute the type of transactions, and perform resource scheduling in advance based on the predicted current load. Among them, the current load refers to the load of each load cycle of the electronic device 100 executing the type of transactions this time. In this way, the predicted current load is closer to the actual load borne by the electronic device 100 in this load cycle, which effectively improves the resource scheduling efficiency and thereby improves the response speed of the electronic device 100.
[0097] In addition, it should be noted that when the electronic device 100 executes transactions, it requires not only CPU resources but also other resources, such as GPU resources, DDR resources, disk I / O resources, network I / O resources, etc.
[0098] In an embodiment of the present application, the resource modules of the electronic device 100 may include one or more of the following: CPU, GPU, DDR, disk, network card. When the electronic device 100 executes the same type of transaction, the historical load data of each resource module of the electronic device 100 is counted and stored respectively; when the electronic device 100 executes a specific type of transaction, the current load of each resource module of the electronic device 100 is counted respectively for the type of transaction; and based on the historical load data and current load situation of each resource module, the load prediction and resource scheduling of the resource module are performed. In this way, when the electronic device 100 executes the type of transaction, various resource scheduling can be performed for the type of transaction to meet the load requirements of each resource module and improve the execution speed of the type of transaction, that is, the response speed of the electronic device 100 is effectively improved.
[0099] It should be noted that the resource modules of the electronic device 100 in the embodiment of the present application are not limited to the above-mentioned types, and the resource modules of the electronic device 100 may also include other types, which are not specifically limited here. For example, NPU.
[0100] The following uses the CPU as an example to describe how to obtain historical CPU load data corresponding to various types of transactions.
[0101] In an embodiment of the present application, time is divided into continuous load cycles. Each time the electronic device 100 executes a transaction, it first determines the transaction type of the transaction (e.g., the first transaction type), and then obtains the completion time of the transaction of the first transaction type and the CPU load value of each load cycle within the completion time. The electronic device 100 determines the historical completion time and historical load data of the first transaction type based on the completion time and CPU load data corresponding to N transactions of the first transaction type. The historical completion time of the first transaction type includes K load cycles, and the historical load data of the first transaction type includes the CPU load corresponding to the above K load cycles. The electronic device 100 stores the historical completion time and historical load data of the first transaction type to predict the current CPU load when executing transactions of the first transaction type.
[0102] In some embodiments, the historical completion duration of a first transaction type is the maximum value, average value, or weighted average value of the completion durations of N transactions of the first transaction type, and the historical CPU load data of the first transaction type includes: the historical load of the i-th load cycle within the historical completion duration, that is, the maximum value, average value, or weighted average value of the load of the N i-th load cycles corresponding to the CPU load data of the N transactions of the first transaction type, where i is an integer less than or equal to K. It should be noted that if the CPU load data of a transaction of the first transaction type includes load data of L load cycles, and L is less than K, then when i is greater than L, the load value of the i-th load cycle of the CPU load data of the transaction of the first transaction type can be set to 0.
[0103] In some embodiments, because the CPU load data of the electronic device 100 executing the same type of transaction each time under the same network conditions and hardware conditions is relatively small, N can take a preset fixed value, for example, N is equal to 100. In one implementation, the N transactions of the first transaction type mentioned above can be the N transactions of the first transaction type executed most recently by the electronic device 100; in another implementation, the N transactions of the first transaction type mentioned above can be the N transactions of the first transaction type executed initially by the electronic device 100. In some embodiments, N is the total number of transactions of the first transaction type that the electronic device 100 has executed. After each execution of a transaction of the first transaction type by the electronic device 100, the value of N is increased by 1, and the electronic device 100 updates the historical completion time and historical load data of the first transaction type.
[0104] It should be noted that the acquisition of historical load data of other resource modules can refer to the above-mentioned CPU and will not be repeated here.
[0105] The following is an introduction to the method flow of the load processing method provided in the embodiment of the present application. Figure 4A A load processing method provided in an embodiment of the present application is shown. The load processing method includes but is not limited to steps S101 to S103, wherein:
[0106] S101. In response to a first instruction, the electronic device 100 executes a first transaction.
[0107] In some embodiments, the first instruction is input operation 1. The electronic device 100 receives the user's input operation 1 on the first application, and in response to the detected input operation, the electronic device 100 executes the first transaction of the second application.
[0108] In this embodiment of the present application, electronic device 100 receives input operation 1 acting on Activity 1 of a first application. In response to input operation 1, the electronic device executes a first transaction, which includes running Activity 2 of a second application. The first application and the second application can be the same application, and Activity 1 and Activity 2 can be the same activity of the same application or different activities of the same application; alternatively, the first application and the second application can be different applications.
[0109] It's important to note that in the Android system, an Activity is the interface between users and applications. Each Activity component is associated with a Window object, which describes a specific application window. Therefore, an Activity is a highly abstract user interface component. In Android, it represents the user interface and the corresponding business logic centered around it. Controls within the user interface can monitor and handle user-triggered events. As you can see, an Activity represents a user interface in an Android application, and an Android application can have multiple Activities.
[0110] For example, the first application is a desktop application, Activity 1 corresponds to the user interface 11, the second application is a news APP, Activity 2 corresponds to the user interface 12, and the input operation 1 can be Figure 2A The click operation on the icon 206A of the news APP is shown. The first transaction is to start the second application and display the user interface 12. For example, the first application and the second application are both news APPs. Activity1 corresponds to the user interface 12, Activity2 corresponds to the user interface 13, and the input operation 1 can also be Figure 2B The action shown is a click operation on the news link 301A. The first transaction is to obtain the news content corresponding to the news link 301A and display it on the user interface 13. Alternatively, both Activity1 and Activity2 correspond to the user interface 13. The input operation 1 can also be Figure 2C The upward sliding operation shown acts on the news content 305. The first transaction is to obtain more news content corresponding to the news link 301A and display it on the user interface 13. Alternatively, Activity1 corresponds to the user interface 13, and Activity2 corresponds to the user interface 12. The above input operation 1 can also be Figure 2E In the click operation shown on the return key 202A, the first transaction is to display the user interface 12.
[0111] In some embodiments, the first instruction is instruction 1 sent by electronic device 200. In response to receiving the instruction 1, electronic device 100 executes the first transaction of the second application. Instruction 1 may also be a user input operation received indirectly by electronic device 100 through electronic device 200.
[0112] In this embodiment of the present application, electronic device 100 receives instruction 1, sent by electronic device 200, that triggers electronic device 100 to run Activity 2 of a second application. In response to instruction 1, the electronic device executes a first transaction, which includes running Activity 2 of the second application. It should be noted that instruction 1 can also be an instruction that acts on Activity 1 and triggers electronic device 100 to run Activity 2.
[0113] Exemplarily, electronic device 100 is a smart phone, and electronic device 200 is a smart watch. After electronic device 200 and electronic device 100 are connected, the user can control electronic device 100 through electronic device 200. The above-mentioned second application is the music first application, Activity 2 corresponds to the music playback interface of the music first application, the above-mentioned instruction 1 is used to instruct the electronic device 100 to play song 1 through the music first application, and the first transaction is the electronic device 100 playing song 1 through the music first application. It can be understood that if the music first application of the electronic device 100 is not currently started, the first transaction also includes starting the music first application; if the electronic device 100 does not store song 1 locally, the first transaction also includes obtaining the audio information of song 1 through the network. The above-mentioned instruction 1 can also be to set an alarm, check the weather, play movie 1 through the video first application, etc., and the embodiment of the present application does not make specific limitations on this.
[0114] It can be understood that the above-mentioned first application and second application can be system applications (such as desktop applications, etc.) or non-system applications (such as news APP, video applications, etc.), and are not specifically limited here.
[0115] S102: The electronic device 100 determines that the transaction type of the first transaction is the first transaction type.
[0116] In an embodiment of the present application, the electronic device 100 may divide the transactions executed by the electronic device 100 into multiple transaction types, and execute two transactions of the same transaction type, with similar load conditions for each resource module of the electronic device 100.
[0117] In an embodiment of the present application, the electronic device 100 determines the transaction type of the first transaction based on at least one of input operation 1 (or instruction 1), Activity 1 acted upon by input operation 1 (or instruction 1), and Activity 2 triggered by input operation 1 (or instruction 1).
[0118] In some embodiments, the electronic device 100 determines the transaction type of the first transaction based on Activity 1 and the above-mentioned input operation 1, that is, transactions acting on the same Activity (for example, Activity 1) and having the same input operation are classified as transactions of the same type.
[0119] In some embodiments, the electronic device 100 determines the transaction type of the first transaction based on the input operation 1 and the Activity 2 triggered by the input operation 1, that is, transactions that trigger the same Activity (for example, Activity 1) and have the same input operation are classified as transactions of the same type.
[0120] In some embodiments, the electronic device 100 determines the transaction type of the first transaction based on Activity1 and Activity2 triggered by the above-mentioned input operation 1, that is, transactions acting on the same Activity (for example, Activity1) and triggering the same Activity (for example, Activity2) are classified as transactions of the same type.
[0121] In some embodiments, the electronic device 100 determines the transaction type of the first transaction based on the above-mentioned input operation 1 triggering Activity 2, that is, the transactions triggering the same Activity (for example, Activity 2) are classified as transactions of the same type.
[0122] In some embodiments, the electronic device 100 divides the transaction types corresponding to each application, and the transaction types included in two different applications are different.
[0123] For example, in response to Figure 2A In response to the click operation on the icon 206A of the news APP shown, the transaction type of the transaction performed by the electronic device 100 can be simply referred to as the startup transaction of the news APP. In response to the click operation on the news link displayed on the user interface 12, the transaction type of the transaction performed by the electronic device 100 can be simply referred to as the network click transaction of the news APP. In response to the sliding operation on the news content of the news APP, the transaction type of the transaction performed by the electronic device 100 can be simply referred to as the sliding transaction of the news APP. In response to the click operation on the return control 205A, the transaction type of the transaction performed by the electronic device 100 can be simply referred to as the return transaction of the news APP. In response to the click operation on the return control 205A, the transaction type of the transaction performed by the electronic device 100 can be simply referred to as the return transaction of the news APP. Figure 2B The click operation of the control displayed in the menu bar 3047 (e.g., the settings button 304B) and the transaction type executed by the electronic device 100 (e.g., displaying the settings interface of the news app) can be referred to as a local click transaction of the news app. It can be understood that compared with local click transactions, executing network click transactions usually causes a heavier load and requires more resources.
[0124] In some embodiments, the electronic device 100 divides transactions corresponding to all applications into transaction types, and two different applications may include the same transaction type.
[0125] In an embodiment of the present application, the electronic device 100 can classify the activities of each application based on the resources required to run each activity. If the electronic device 100 requires similar resources to run two different activities in the same application, the electronic device classifies the two different activities into the same type of activity.
[0126] In some embodiments, the electronic device 100 classifies transactions that act on the same type of Activity (e.g., Activity1) and have the same input operation as transactions of the same type. In some embodiments, the electronic device 100 classifies transactions that trigger the same type of Activity (e.g., Activity1) and have the same input operation as transactions of the same type. In some embodiments, the electronic device 100 classifies transactions that act on the same type of Activity (e.g., Activity1) and trigger the same type of Activity (e.g., Activity2) as transactions of the same type. In some embodiments, the electronic device 100 classifies transactions that trigger the same type of Activity (e.g., Activity2) as transactions of the same type.
[0127] For example, if the electronic device 100 also has a browser app installed, the electronic device 100 can classify transactions with similar loads in the two applications into one transaction type. For example, if web click transactions in the browser app and web click transactions in the news app cause similar loads, the electronic device 100 will classify the web click transactions in the news app and the browser app into the same transaction type.
[0128] It should be noted that in the embodiments of the present application, there is no specific limitation on the way of classifying transaction types.
[0129] In some embodiments, the electronic device 100 may classify transactions into more coarse-grained categories. For example, in one implementation, Figure 2B The transaction performed by searching the URL in the URL input box 302 shown in FIG. Figure 2B The keyword in the search box 303 is searched for and executed, and the keyword in the search box 303 is searched for and executed. Figure 2BThe transactions executed by clicking on any of the news links shown are all classified as the same transaction type, which can be simply referred to as online search transactions. For example, in one implementation, transactions corresponding to launching all applications are classified as launch transactions, transactions triggered by click operations within all applications are classified as click transactions, transactions triggered by swiping operations within all applications are classified as swiping transactions, transactions triggered by return operations within all applications are classified as return transactions, and transactions corresponding to closing all applications are classified as close transactions, etc.
[0130] In some embodiments, the electronic device 100 may classify transactions into more fine-grained categories. For example, Figure 2B The news links shown may include document news links and video news links. The electronic device 100 may classify transactions executed for document news links and video news links into two transaction types. It is understood that transactions executed for video news links by the electronic device 100 generally place a heavier load on each resource module, require more resources, and take longer to complete than transactions executed for document news links.
[0131] S103. When executing the first transaction, the electronic device 100 predicts the current load of each resource module in the current load cycle based on the current load and historical load data of the first transaction type of each resource module of the electronic device 100, and schedules resources for the resource module based on the predicted load of the resource module.
[0132] In some embodiments, the resource module of the electronic device 100 includes a CPU. The electronic device 100 can predict the current load of the CPU in the current load cycle based on the current load and historical load data of the first transaction type of the CPU, and perform resource scheduling of the CPU based on the predicted load. For example, the CPU frequency can be adjusted based on the predicted load of the CPU, CPU task preemption can be performed, CPU core selection between multiple CPUs, etc. In one implementation, the current load of the CPU in each load cycle can be determined based on the runnable time of each task in the CPU's run queue.
[0133] In some embodiments, the resource module of electronic device 100 includes a GPU. Electronic device 100 may predict the GPU's current load in a current load cycle based on the GPU's current load and historical load data for a first transaction type, and perform GPU resource scheduling based on the predicted load. For example, the GPU frequency may be adjusted based on the predicted GPU load. In one implementation, the GPU's current load in each load cycle may refer to the number of OpenGL instructions processed during that load cycle.
[0134] In some embodiments, the resource module of the electronic device 100 includes DDR. The electronic device 100 can predict the current load of the DDR in the current load cycle based on the current load and historical load data of the first transaction type of the DDR, and perform resource scheduling of the DDR based on the predicted load. For example, the operating frequency of the DDR is adjusted based on the predicted load of the DDR. In one implementation, the current load of the DDR in each load cycle can refer to the memory usage of the DDR in the load cycle, and the memory usage of the DDR determines the size of the memory reclaimed by the DDR.
[0135] In some embodiments, the resource module of the electronic device 100 includes a disk. The electronic device 100 can predict the current load of the disk in the current load cycle based on the current load and historical load data of the first transaction type of the disk, and perform resource scheduling for the disk based on the predicted load. For example, the reserved bandwidth size of the disk I / O can be adjusted based on the predicted load of the disk. In one implementation, the current load of the disk in each load cycle can refer to the IO bandwidth within the load cycle.
[0136] In some embodiments, the resource module of the electronic device 100 includes a network interface card (NIC). The electronic device 100 can predict the current load of the NIC in the current load cycle based on the current load and historical load data of the first transaction type of the NIC, and perform network I / O resource scheduling based on the predicted load. For example, the reserved bandwidth of the network I / O can be adjusted based on the predicted load of the NIC. In one implementation, the current load of the NIC in each load cycle can refer to the number of bytes of network I / O messages sent and received during the load cycle.
[0137] The resource modules of the electronic device 100 are not limited to the above-mentioned types, and may include other types of resource modules, for example, other types of processors of the electronic device 100, other types of internal memories of the electronic device 100, etc. No specific limitation is given here.
[0138] The following takes the CPU as an example to further illustrate how to predict the current load of this load cycle in step S103.
[0139] For example, Figure 4B As shown, in some embodiments, step S103 may include S103A and S103B.
[0140] S103A. At the starting moment of the i-th load cycle of executing the first transaction, the electronic device 100 counts the current CPU load of the electronic device 100 in the load cycle based on the current CPU load of the first i-1 load cycles before executing the first transaction, and performs CPU resource scheduling based on the counted current load of the load cycle, where i is less than M and M is a positive integer.
[0141] Specifically, during the M load cycles before the first transaction begins, the electronic device 100 may use the PELT algorithm or the WALT algorithm to predict the current CPU load of the electronic device 100 during the current load cycle, and perform CPU resource scheduling based on the predicted current CPU load. In addition to the PELT algorithm or the WALT algorithm, the electronic device 100 may also use other algorithms to predict the current CPU load of the electronic device 100 during each load cycle, which are not specifically limited herein.
[0142] In one implementation, the duration of the duty cycle is n times 1024 us, where n is a positive integer. During each 1024 us period within the i-th duty cycle, the electronic device 100 uses the PELT algorithm to predict the current CPU load within the 1024 us period and schedules CPU resources based on the predicted current CPU load.
[0143] In one implementation, the duration of a load cycle is n times 1024us, where n is a positive integer. During each 1024us period within the (i-1)th load cycle, the electronic device 100 uses the PELT algorithm to calculate the CPU load within that 1024us period. During the i-th load cycle, the electronic device 100 predicts the current CPU load for that load cycle as the maximum value, average value, or weighted average value of the CPU loads of the n 1024us periods within the (i-1)th load cycle, and performs resource scheduling based on the predicted current CPU load.
[0144] In one implementation, the load cycle has a duration of 1024 μs. In the i-th load cycle, the electronic device 100 uses the PELT algorithm to predict the current CPU load in the load cycle and schedules CPU resources based on the predicted current CPU load.
[0145] In one implementation, the duration of the load cycle is n times T, where T is the time window length of the WALT algorithm and n is a positive integer. In each time window within the i-th load cycle, the electronic device 100 uses the WALT algorithm to predict the current CPU load within the time window and schedules CPU resources based on the predicted current CPU load.
[0146] In one implementation, the duration of a load cycle is n times T, where T is the time window length of the WALT algorithm and n is a positive integer. In each time window within the (i-1)th load cycle, the electronic device 100 uses the WALT algorithm to calculate the CPU load within that time window. In the (i-1)th load cycle, the electronic device 100 predicts the current CPU load for that load cycle as the maximum value, average value, or weighted average value of the CPU loads in the n time windows within the (i-1)th load cycle, and performs resource scheduling based on the predicted current CPU load.
[0147] In one implementation, the duration of the load cycle is equal to the duration of the time window of the WALT algorithm. During the i-th cycle, the electronic device 100 uses the WALT algorithm to predict the current CPU load of the load cycle and schedules CPU resources based on the predicted current CPU load.
[0148] In one implementation, M is a preset value, for example, 2, 3, 5, or 8.
[0149] S103B. During the j-th load cycle of executing the first transaction, based on the current CPU load of the electronic device 100 in the previous j-1 load cycles and the historical load data 1 within the historical completion duration 1 corresponding to the first transaction type of the CPU, the electronic device 100 uses a dynamic time warping (DTW) algorithm to predict that the current CPU load of the j-th load cycle is the historical load of the H-th load cycle in the above historical load data 1, and performs CPU resource scheduling based on the predicted current load of the j-th load cycle. The above historical completion duration 1 includes K load cycles, where j is greater than or equal to M and H is less than K.
[0150] The DTW algorithm is a time series similarity measurement method. The DTW distance defines the matching relationship between time series. It supports the similarity measurement of time series of different lengths and the expansion and curvature of the time axis, and has better robustness.
[0151] In some embodiments, the electronic device 100 uses the DTW algorithm to predict the CPU load of the j-th load cycle, which may specifically include steps A1 to A2.
[0152] It should be noted that the historical load data 1 of the first type of transaction of the CPU includes K historical load values corresponding to K load cycles. When the electronic device 100 executes the first transaction this time, it obtains j-1 CPU current load values corresponding to the previous j-1 load cycles. The above j-1 CPU current load values constitute the current load data 1.
[0153] A1. The electronic device 100 uses the DTW algorithm to determine the historical load value in the historical load data 1 that best matches the j-1th current load value in the current load data 1, that is, the H-1th historical load value in the historical load data 1.
[0154] H(x) represents the historical load value of the xth load cycle in the historical load data, and C(y) represents the current load value calculated during the yth load cycle of the first transaction executed this time. M(x,y) represents the distance between H(x) and C(y). M(x,y) can be expressed as follows:
[0155] M(x,y)=|H(x)–C(y)|, 0<=y<=x<=total number of load cycles of the transaction.
[0156] Lmin(x,y) represents the DTW distance between sequence 1 corresponding to the first y load cycles of the first transaction and sequence 2 corresponding to the first x load cycles in history. The smaller the value, the closer the match between sequence 1 and sequence 2. Lmin(x,y) can be expressed as follows:
[0157] Lmin(x,y)=min{Lmin(x,y-1),Lmin(x-1,y),Lmin(x-1,y-1)}+M(x,y)
[0158] When y equals j-1, electronic device 100 determines that the DTW distance with the smallest value is Lmin(H-1, j-1). That is, the DTW distance between sequence 1 corresponding to the first j-1 load cycles of the current first transaction and sequence 2 corresponding to the first H-1 load cycles of the history is the smallest. Furthermore, electronic device 100 determines the historical load value in historical load data 1 that best matches the current load value of the j-1th load cycle in current load data 1, namely, the historical load value of the H-1th load cycle in historical load data 1.
[0159] A2. The electronic device 100 predicts the current CPU load value of the jth load cycle, that is, the Hth historical load value in the historical load data 1.
[0160] Specifically, after the electronic device 100 determines that the current load value of the above-mentioned j-1th load cycle is most matched with the historical load value of the above-mentioned H-1th load cycle, it predicts that the next load cycle (i.e., the above-mentioned jth load cycle) is the historical load value of the next load cycle of the above-mentioned H-1th load cycle (i.e., the above-mentioned Hth load cycle).
[0161] It is understandable that due to various factors of software and hardware, the completion time and load changes when the electronic device 100 executes the same type of transaction twice may deviate and are not completely consistent.
[0162] For example, Figure 5 The graph shows a curve composed of historical load data of a first type of transaction of a CPU and a curve composed of current load data of the current execution of the first transaction. Figure 5The historical load data shown includes load data for 24 load cycles, and the current load data includes load data for 26 load cycles. For example, at the start of the 11th load cycle of the current execution of the first transaction, the electronic device 100 determines the historical load that best matches the current load of the 10th load cycle in the current load data, namely, the historical load of the 9th load cycle in the historical load data. The electronic device 100 predicts that the current load of the 11th load cycle is equal to the historical load of the 10th load cycle in the historical load data. During the 11th load cycle of the current execution of the first transaction, the electronic device 100 performs resource scheduling based on the historical load of the 10th load cycle.
[0163] In some embodiments, step S103 includes but is not limited to steps S103A, S103C, and S103D, wherein:
[0164] S103C. During the Mth load cycle of executing the first transaction, based on the current CPU load of the electronic device 100 in the previous M-1 load cycles and the historical load data 1 within the historical completion duration 1 corresponding to the first transaction type of the CPU, the electronic device 100 uses the DTW algorithm to predict that the current CPU load of the Mth load cycle is the historical load of the Hth load cycle in the above historical load data 1, and performs CPU resource scheduling based on the predicted current load of the above Mth load cycle, where the above historical completion duration 1 includes K load cycles, and H is less than K.
[0165] S104D. During the j-th load cycle of executing the first transaction, if j is greater than M and less than or equal to K+MH, the electronic device 100 predicts that the current load of the j-th load cycle is the historical load of the j-M+H-th load cycle in the historical load data; if j is greater than K+MH, the electronic device 100 predicts that the current load of the j-th load cycle is the historical load of the K+MH-th load cycle in the historical load data; the electronic device 100 performs resource scheduling based on the predicted load of the j-th load cycle.
[0166] How to predict the load of other resource modules (such as GPU, DDR, disk I / O, network I / O) in the current load cycle in step S103 can be referred to the relevant embodiments of the CPU resource module provided in S103A to S103F, which will not be repeated here.
[0167] In addition, for non-load mutation transaction types, load prediction can be performed in a traditional manner without the need for historical load data. In the embodiment of the present application, transaction types can be divided into load mutation and non-load mutation based on the load change of each of the three transaction types.
[0168] In some embodiments of the present application, before step S103, the electronic device 100 further includes: determining whether the first transaction type is a sudden load change; if so, executing S103; if not, performing load prediction and resource scheduling using a traditional algorithm, for example, performing resource scheduling based on the current load of the previous load cycle.
[0169] In some embodiments of the present application, the electronic device 100 stores an identifier 1 corresponding to each transaction type, and the identifier 1 is used to indicate whether the transaction type is a transaction type with a sudden load change.
[0170] In one implementation, the identifier 1 may be stored when the electronic device 100 leaves the factory.
[0171] In one implementation, the identifier 1 may be obtained by the electronic device 100 from other devices. For example, the first transaction is a transaction for a news APP, and the identifier corresponding to the first transaction type may be obtained by the electronic device 100 from a server corresponding to the news APP.
[0172] In one implementation, the identifier 1 may be determined by the electronic device 100 according to historical load data of the first transaction type.
[0173] In some embodiments of the present application, if the historical load data of transactions of the first transaction type executed F times by the electronic device 100 meets a first condition, the electronic device 100 determines that the transaction type is a transaction type with a sudden load change, and the electronic device 100 continues to collect historical load data of the first transaction type. Otherwise, the transaction type is determined not to be a transaction type with a sudden load change. For example, F is equal to 3. In one implementation, the first condition is that the variance of the historical load values of each load cycle in the historical load data is less than a preset threshold.
[0174] In some embodiments, the electronic device 100 does not execute transactions corresponding to each transaction type, that is, the electronic device 100 is in an idle state. At this time, the electronic device 100 can use traditional algorithms to perform load prediction and resource scheduling.
[0175] For example, Figure 6 The figure shows the current load of electronic device 100 during each load cycle using the load processing method provided in an embodiment of the present application. As shown in the figure, the current load predicted by the load processing method provided in an embodiment of the present application is closer to the actual load borne by electronic device 100 than that predicted by the PELT algorithm and the WALT algorithm, effectively improving resource scheduling efficiency and, in turn, the response speed of electronic device 100.
[0176] In the embodiment of the present application, the first electronic device may be the aforementioned electronic device 100, and the second electronic device may be the aforementioned electronic device 200. The first instruction may be the aforementioned input operation 1 or instruction 1, the first user playground may be the aforementioned input operation 1, the first current load data may be the aforementioned current load data 1, the first historical load data may be the aforementioned historical load data 1, the first resource module and the second resource module may be a CPU, GPU, DDR, disk, or network card, and the first resource module and the second resource module are different resource modules. Not limited to the CPU, GPU, DDR, disk, or network card, the first resource module and the second resource module may also be other resource modules in the electronic device 100.
[0177] In the embodiment of the present application, the software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device 100.
[0178] See also Figure 7 , Figure 7 The software structure block diagram of the electronic device 100 provided by the embodiment of the present application is shown in FIG. Figure 7 As shown in the software structure diagram, the electronic device 100 categorizes executed transactions and compiles historical load data for each type of transaction. When executing a specific type of transaction, the electronic device 100 performs a load prediction based on the historical load data and current load, and then schedules resources based on the predicted current load. This improves the execution speed of each type of transaction and effectively increases the response speed of the electronic device 100.
[0179] like Figure 7 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 software interfaces. In some embodiments, the Android system can be divided from top to bottom into the application layer, application framework layer, hardware abstraction layer (HAL) layer, and kernel layer. Among them:
[0180] The application layer includes a series of application packages, such as camera, gallery, etc. It can also include other applications that can enable the front camera of the electronic device 100, such as WeChat, Douyin, etc.
[0181] The application framework layer provides an application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0182] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
[0183] 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.
[0184] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.
[0185] like Figure 7 As shown, in an embodiment of the present application, the application framework layer may include an Activity Manager Service (AMS) and a transaction type identification module. Among them, AMS is a system service of the Android system, which is used to control the reasonable scheduling and operation between different applications in the system. The main responsibilities of AMS include unified scheduling of the Activities of various applications, management of the processes of applications, management of memory, scheduling services, scheduling tasks, querying the current operating status of the system, etc. The transaction type identification module is used to identify and manage the transaction types of transactions executed by the electronic device 100. The transaction type identification module is used to identify the transaction type of the transaction currently executed by the electronic device 100. In some embodiments, the transaction type identification module can obtain the Activity corresponding to the application running in the foreground through AMS, and then identify the type of transaction executed by the electronic device 100.
[0186] In some embodiments, the application framework layer may also add a gesture recognition (Gesture Recognizer) module to perform logical judgment on the input events obtained and identify the gestures corresponding to the input events. For example, the input event is judged to be a knuckle touch event or a fingertip touch event, etc., through the touch coordinates, timestamp of the touch operation and other information included in the input event. At the same time, based on the touch trajectory corresponding to the input event and determining the gesture rules of the input event, different operations are responded to according to different gestures. In some embodiments, the transaction type identification module can identify the transaction type of the transaction performed by the electronic device 100 based on the gesture recognized by the gesture recognition module and the Activity of the application running in the foreground obtained by the AMS.
[0187] The kernel layer is the layer between hardware and software. The HAL layer and the kernel layer can respond to the functions called by the application framework layer and perform corresponding operations.
[0188] In the embodiment of this application, Figure 7 As shown, the kernel layer may include a load statistics module, a historical load acquisition module, a load prediction module, and a resource scheduling module. Among them, the load statistics module is used to count the current load of the electronic device 100 in each load cycle when the electronic device 100 executes the transaction this time. The historical load acquisition module is used to calculate and store the historical completion time and historical load data of each type of transaction. The load prediction module is used to predict the load of the electronic device 100 in this cycle based on the current load and historical load data of each type of transaction. In some embodiments, the kernel layer may also include a touch chip driver, a display driver, a sensor driver, a camera driver, an audio driver, and the like.
[0189] based on Figure 7 The software structure block diagram shown below exemplifies the load processing method provided in the embodiment of the present application.
[0190] In some embodiments of the present application, the touch sensor 180K receives a touch operation, and the corresponding hardware interrupt is sent to the touch chip. The touch chip sends the touch information of the touch operation to the touch chip driver of the kernel layer. The touch chip driver sends the above touch information to the input system. The input system processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the input system of the kernel layer, identifies the gesture corresponding to the raw input event through the gesture recognition module, and obtains the Activity 1 corresponding to the application running in the foreground through the AMS, and then determines the user's input operation based on the above gesture, Activity 1, and touch coordinates. The transaction type recognition module identifies the transaction type of the first transaction corresponding to the above input operation as the first transaction type.
[0191] For example, the user interface corresponding to Activity 1 is Figure 2B In the user interface 12 of the news APP shown, the user's input operation is a single click operation on the area where the news link 301A is located. The first transaction is to obtain Figure 2C The news content shown is displayed.
[0192] The kernel layer obtains the transaction type corresponding to the first transaction from the transaction type identification module as the first transaction type. During the execution of the first transaction, the load statistics module calculates the current load of each resource module in each load cycle. The load prediction module obtains the historical load data of the first transaction type of each resource module from the historical load acquisition module, obtains the current load of each resource module in each currently executed load cycle from the load statistics module, and predicts the current load of each resource module in the current load cycle based on the historical load data of the first transaction type of each resource module and the current load of the resource module. The resource scheduling module then performs resource scheduling on the resource module based on the predicted load of the resource module.
[0193] Exemplarily, the resource module includes: Figure 7 The CPU, GPU, DDR, disk, network card, etc. shown in the figure are as follows. Correspondingly, the resource scheduling module includes the following: Figure 7 The CPU resource scheduling module, GPU resource scheduling module, DDR resource scheduling module, disk resource scheduling module, network card resource scheduling module, etc. are shown. For example, the CPU resource scheduling module can adjust the CPU frequency, implement CPU core selection, and / or implement CPU task preemption based on the current CPU load of the current load cycle predicted by the load prediction module.
[0194] It should be noted that Figure 7 This is only an exemplary description of the software structure diagram in the embodiment of the present application. Figure 7 Each layer of the software structure diagram shown may also include other modules, which are not specifically limited here.
[0195] The present application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be completed by a computer program to instruct the relevant hardware. The program can be stored in the above computer storage medium. When the program is executed, it can include the processes of the above method embodiments. The computer-readable storage medium includes: read-only memory (ROM) or random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program code.
[0196] 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 the embodiment of the present 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 via the computer-readable storage medium. 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 a data center that includes one or more available media integrations. 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 drive (SSD)).
[0197] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.
[0198] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.
[0199] 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 above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above 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 load processing method, characterized in that: include: In response to the first instruction, the first electronic device executes a first transaction and determines that a transaction type of the first transaction is a first transaction type; At the start time of the jth load cycle of executing the first transaction, the first electronic device predicts, based on first current load data and first historical load data of the first transaction type of the first resource module, that a first current load of the first resource module in the jth load cycle is equal to a historical load value of the Hth load cycle in the first historical load data, and performs resource scheduling on the first resource module based on the first current load; Among them, the historical load value in the first historical load data that best matches the j-1th current load in the first current load data is the historical load value of the H-1th load cycle; the first current load data includes the current load of the first resource module in the first j-1 load cycles before executing the first transaction this time, and the first historical load data includes the historical load values of K load cycles, j, H and K are positive integers, and H is less than or equal to K.
2. The method according to claim 1, characterized in that The first instruction is a first input operation that acts on a first activity of a first application and is used to trigger a second activity of a second application.
3. The method according to claim 1, characterized in that The first instruction is an instruction sent by the second electronic device, and the first instruction is an instruction that acts on the first activity of the first application and is used to trigger the second activity of the second application; Alternatively, the first instruction is an instruction for triggering the second activity of the second application.
4. The method according to claim 2 or 3, wherein determining the transaction type of the first transaction is the first transaction type comprises: Based on at least one of the first instruction, the first activity activated by the first instruction, and the second activity triggered by the first instruction, the first electronic device determines that the transaction type of the first transaction is the first transaction type.
5. The method according to claim 1, wherein The method further comprises: At the starting moment of the j-th load cycle of executing the first transaction, the first electronic device predicts, based on the current load of the second resource module in the previous j-1 load cycles of executing the first transaction and the second historical load data of the first transaction type of the second resource module, that the second current load of the second resource module in the j-th load cycle is equal to the historical load value of the P-th load cycle in the second historical load data, and schedules resources for the second resource module based on the second current load; wherein the second historical load data includes historical load values of D load cycles, P and D are positive integers, and P is less than or equal to D.
6. The method according to claim 5, characterized in that The resource module of the first electronic device includes at least two of a CPU, a GPU, a DDR, a disk, and a network card.
7. The method according to claim 1, characterized in that The first electronic device counts a current load of the first resource module in each load cycle; and predicting, based on the first current load data and first historical load data of the first transaction type of the first resource module, that a first current load of the first resource module in the jth load cycle is equal to a historical load value in the Hth load cycle in the first historical load data, comprises: The first electronic device determines, using a dynamic time warping (DTW) algorithm, that a historical load value in the first historical load data that best matches the j-1th current load in the first current load data is a historical load value of an H-1th load cycle; The first electronic device predicts that the first current load of the first resource module in the jth load cycle is equal to the historical load value of the Hth load cycle in the first historical load data.
8. The method according to claim 2, characterized in that Transactions corresponding to the same user operation acting on the same activity are of the same transaction type. Determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first input operation and the first activity on which the first input operation acts.
9. The method according to claim 4, characterized in that Transactions corresponding to the same user operation acting on the same activity are of the same transaction type. Determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first input operation and the first activity on which the first input operation acts.
10. The method according to claim 2, characterized in that Transactions corresponding to the same user operation that triggers the same activity are of the same transaction type. Determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first input operation and the second activity triggered by the first input operation.
11. The method according to claim 4, characterized in that Transactions corresponding to the same user operation that triggers the same activity are of the same transaction type. Determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first input operation and the second activity triggered by the first input operation.
12. The method according to claim 2 or 3, characterized in that Transactions corresponding to instructions triggering the same activity are of the same transaction type, and determining the transaction type of the first transaction is the first transaction type includes: determining the transaction type of the first transaction is the first transaction type based on the second activity triggered by the first instruction.
13. The method according to claim 4, characterized in that Transactions corresponding to instructions triggering the same activity are of the same transaction type, and determining the transaction type of the first transaction is the first transaction type includes: determining the transaction type of the first transaction is the first transaction type based on the second activity triggered by the first instruction.
14. The method according to claim 2 or 3, characterized in that Transactions corresponding to instructions that act on and trigger the same activity are of the same transaction type, and determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first activity acted on and the second activity triggered by the first instruction.
15. The method according to claim 4, characterized in that Transactions corresponding to instructions that act on and trigger the same activity are of the same transaction type, and determining the transaction type of the first transaction as the first transaction type includes: determining the transaction type of the first transaction as the first transaction type based on the first activity acted on and the second activity triggered by the first instruction.
16. The method according to claim 4, wherein the activities of all applications of the first electronic device include P-type activities, and the classification of activities is determined based on the resources required by the electronic device to run the activities. The resources required for activities of the same type are similar, wherein: P is a positive integer greater than 1; the transaction type of the first transaction is determined to be the first transaction type.
17. The method according to claim 16, characterized in that The transaction types are classified in at least one of the following ways: transactions corresponding to the same user operation acting on the same type of activity are of the same transaction type; transactions corresponding to the same user operation triggering the same type of activity are of the same transaction type; transactions corresponding to instructions triggering the same type of activity are of the same transaction type; Transactions corresponding to instructions that act on and trigger the same type of activity are of the same transaction type.
18. The method according to claim 2 or 3, characterized in that The first application and the second application are the same application, and the first activity and the second activity are the same activity; Alternatively, the first application and the second application are the same application, and the first activity and the second activity are different activities; Alternatively, the first application and the second application are different applications.
19. An electronic device comprising a memory, one or more processors, a plurality of applications, and one or more programs; wherein, The one or more programs are stored in the memory; and it is characterized in that when the one or more processors execute the one or more programs, the electronic device implements the method according to any one of claims 1 to 18.
20. A computer storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 18.
21. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
Load prediction method and apparatus, and network element
CN107608781A
Resource scheduling method and electronic equipment
CN110489228A