A data collection method, terminal, storage medium and program product
By collecting frame rate and CPU load information on the terminal, building sample data to train frequency prediction models, solving the problem of too low or too high CPU frequency, achieving smooth operation of the application and optimization of CPU power consumption.
Patent Information
- Application Number
- CN202411764992.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The prior art is difficult to effectively solve the problems of insufficient computing processing capabilities caused by too low frequency of terminal CPUs and excessive power consumption caused by too high frequency, making it difficult to find the optimal frequency for CPUs to run.
Through a data collection method, the terminal displays the frame rate and CPU load information of the application interface, and constructs sample data to train frequency prediction models. The method includes determining the initial frequency information, adjusting the frequency by the offset value, and updating the offset value to improve the accuracy and rationality of the frequency prediction.
Improve the accuracy and rationality of the frequency prediction model, ensure smooth operation of the application, and reduce the power consumption of the CPU, and find the best frequency for the CPU to run.
Smart Images

Figure CN119248619B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data collection method, a terminal, a storage medium and a program product. Background Art
[0002] When the terminal CPU frequency is too low, the computing and processing capabilities are weak, and it may be difficult to meet the performance requirements of smooth operation of certain applications (such as game applications). However, when the CPU frequency is too high, it will lead to excessive power consumption and the CPU temperature will rise. In view of this, it is necessary to find the best frequency for the CPU to run, so that when the CPU runs at the best frequency, it can not only ensure that the application can run smoothly, but also make the CPU power consumption relatively low.
[0003] In the related technology, information such as the frame rate of the picture displayed when the terminal runs an application and the load of the CPU in the terminal can be input into a frequency prediction model deployed in the terminal. The above frequency prediction model predicts and outputs the optimal frequency of the CPU operation, and then through the frequency setting operation, the CPU in the terminal runs at the above optimal frequency.
[0004] Among them, the above frequency prediction model is trained based on pre-collected sample data. The diversity of sample data values directly affects the accuracy and rationality of the optimal frequency predicted by the trained model, which also affects the model performance.
[0005] In view of the above situation, an embodiment of the present application provides a data collection method to collect sample data with diverse values for model training. Summary of the invention
[0006] In view of this, the present application provides a data collection method, a terminal, a storage medium and a program product to collect sample data with diverse values for model training.
[0007] In a first aspect, an embodiment of the present application provides a data collection method, which is applied to a terminal, wherein the terminal is installed with a first application program, and the method includes:
[0008] Obtaining a first frame rate of a first program interface displayed on the terminal and first load information of a CPU cluster in the terminal, wherein the first program interface is: a running interface of the first application program;
[0009] Based on the first load information and the first frame rate, determine the initial frequency information of the CPU cluster, and determine a first offset value of the initial frequency information from a first corresponding relationship, wherein the first corresponding relationship is: a corresponding relationship between the load information of the CPU cluster, the frame rate of the terminal display program interface, and the offset value;
[0010] Using the first offset value to offset the initial frequency information to obtain offset frequency information;
[0011] Setting the operating frequency of the CPU cluster based on the offset frequency information, and obtaining a second frame rate at which the terminal displays the first program interface after the set frequency;
[0012] Based on the set target frame rate and the second frame rate, updating the first offset value recorded in the first corresponding relationship;
[0013] Construct sample data including the first load information, a first frame rate, a second frame rate and an offset frequency information.
[0014] As can be seen from the above, when the scheme provided by the embodiment of the present application is applied to collect data, the first offset value is determined from the first corresponding relationship according to the frame rate and frequency information before the frequency is set, and after the offset frequency information is obtained according to the first offset value, the first offset value recorded in the first corresponding relationship is updated according to the difference between the frame rate after the frequency is set and the target frame rate. In this way, different offset values can be determined for the same frame rate and frequency information according to the updated first corresponding relationship, and then different offset frequency information can be obtained, which improves the value diversity of the determined offset frequency information, that is, the value diversity of the sample data including the offset frequency information is improved. In addition, in the scheme provided by the embodiment of the present application, after each determination of the offset frequency information, the offset value in the first corresponding relationship is updated according to the target frame rate, that is, the offset value in the first corresponding relationship is explored, and through this cumulative update, it is conducive to making the frame rate after the CPU frequency is set based on the offset frequency information determined by the offset value recorded in the first corresponding relationship closer and closer to the target frame rate, that is, the determined offset frequency information is more and more in line with expectations, which improves the rationality of the obtained offset frequency information, makes the obtained sample data more in line with the needs of the actual scene, and improves the quality of the obtained sample data. Moreover, the subsequent use of high-quality, diverse-value sample data training models collected based on the solution provided in the embodiments of the present application can improve the accuracy and rationality of the optimal frequency predicted by the trained frequency prediction model, that is, improve the model performance.
[0015] In one embodiment of the present application, updating the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes:
[0016] Calculating a frame rate difference between a set target frame rate and the second frame rate;
[0017] Based on the frame rate difference, determining an adjustment direction;
[0018] Based on the frame rate difference, determining an adjustment amount along the adjustment direction;
[0019] The first offset value recorded in the first corresponding relationship is updated according to the determined adjustment direction and adjustment amount.
[0020] The target frame rate is the expected frame rate at which the terminal is expected to display the first program interface. The frame rate difference between the target frame rate and the second frame rate can accurately reflect the difference between the frame rate at which the terminal actually displays the first program interface and the expected frame rate. Thus, the adjustment value and adjustment direction are determined based on the above difference, and the offset value is updated according to the obtained adjustment value and adjustment direction, which improves the accuracy and rationality of the updated offset value, and also enables the updated offset value to determine the offset frequency information and set the operating frequency of the CPU cluster based on the offset frequency information. The difference between the frame rate at which the terminal actually displays the first program interface and the expected frame rate is reduced, which is conducive to collecting high-quality sample data.
[0021] In one embodiment of the present application, determining the adjustment direction based on the frame rate difference includes:
[0022] If the frame rate difference is greater than the first frame loss threshold, determining the adjustment direction is: increasing the direction of the frequency information of the CPU cluster; and / or,
[0023] If the frame rate difference is less than a first superframe threshold, the adjustment direction is determined to be: a direction of reducing the frequency information of the CPU cluster, wherein the first superframe threshold is less than the first frame loss threshold.
[0024] In this embodiment, according to the relationship between the frame rate difference and the threshold, when the offset frequency information cannot meet the requirement of the smooth operation of the first application, the adjustment direction is determined to be the direction of increasing the frequency information of the CPU cluster, and when the offset frequency information is higher than the requirement of the smooth operation of the first application, the adjustment direction is determined to be the direction of reducing the frequency information of the CPU cluster. In this way, after the offset frequency information is subsequently determined based on the updated offset value and the operating frequency of the CPU cluster is set based on the offset frequency information, the probability of insufficient performance or excessive power consumption of the CPU cluster is reduced, and the accuracy and rationality of adjusting the offset value are improved.
[0025] In one embodiment of the present application, if the number of the CPU clusters is greater than 1, determining the adjustment direction based on the frame rate difference includes:
[0026] If the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, the adjustment direction is determined to be: increasing the frequency information of at least one CPU cluster and decreasing the frequency information of the remaining CPU clusters.
[0027] In this way, the adjustment direction is determined as: increasing the initial frequency information of at least one CPU cluster and reducing the initial frequency information of the remaining CPU clusters, that is, increasing the offset value in the first correspondence of at least one CPU cluster and reducing the offset value in the first correspondence of the remaining CPU clusters. This is equivalent to randomly exploring the offset values of CPU clusters in multiple dimensions, thereby improving the diversity of values of the offset frequency information subsequently determined based on the offset value.
[0028] In one embodiment of the present application, determining the adjustment amount along the adjustment direction based on the frame rate difference includes:
[0029] If the frame rate difference is greater than the second frame loss threshold, determining an adjustment amount along the adjustment direction from within the first adjustment interval; and / or,
[0030] If the frame rate difference is less than or equal to the second frame loss threshold and greater than the first frame loss threshold, determining the adjustment amount from a second adjustment interval, wherein the value included in the second adjustment interval is less than the value included in the first adjustment interval; and / or,
[0031] If the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, determining the adjustment amount from a third adjustment interval; and / or,
[0032] If the frame rate difference is less than the first superframe threshold and greater than or equal to the second superframe threshold, determining the adjustment amount from a fourth adjustment interval; and / or,
[0033] If the frame rate difference is less than the second superframe threshold, the adjustment amount is determined from a fifth adjustment interval, wherein the value included in the fourth adjustment interval is less than the value included in the fifth adjustment interval.
[0034] It can be seen that according to the above scheme, the offset can be determined efficiently and conveniently from a value range with different numerical values according to the size of the frame rate difference, so that the offset value can be adjusted with different amplitudes according to the determined offset. Subsequently, the offset frequency information is determined based on the updated offset value and the operating frequency of the CPU cluster is set based on the offset frequency information. This reduces the probability of insufficient performance or excessive power consumption of the CPU cluster, thereby improving the flexibility and rationality of the scheme.
[0035] In one embodiment of the present application, the numerical value included in the third adjustment interval is smaller than the numerical value included in the first adjustment interval; and / or the numerical value included in the third adjustment interval is smaller than the numerical value included in the fifth adjustment interval.
[0036] In this case, the frame rate of the terminal displaying the first program interface is basically in line with expectations. Therefore, the adjustment amount can be determined from the third adjustment interval with a smaller value to slightly adjust the offset value, thereby improving the rationality of adjusting the offset value.
[0037] In one embodiment of the present application, the first corresponding relationship is a corresponding relationship between the load information of the CPU cluster, the load information of the application program, the frame rate of the terminal display program interface, and the offset value, and the initial frequency information of the CPU cluster is determined based on the first load information and the first frame rate, and the first offset value of the initial frequency information is determined from the first corresponding relationship, including:
[0038] Obtaining second load information of the first application, wherein the second load information is obtained based on a proportion of resources consumed by the threads of the first application running on the CPU cores included in the CPU cluster to the total resources of the CPU cores;
[0039] Based on the first load information, the second load information, and the first frame rate, initial frequency information of the CPU cluster is determined, and a first offset value of the initial frequency information is determined from a first corresponding relationship.
[0040] In this way, when determining the initial frequency information and the offset value, the load information of the first application is also considered, and the considered information is richer and more comprehensive, thereby improving the accuracy of the obtained initial frequency information and the offset value, and improving the quality of the sample data finally collected.
[0041] In one embodiment of the present application, determining the initial frequency information of the CPU cluster based on the first load information, the second load information, and the first frame rate includes:
[0042] Determine a first information interval to which the first load information belongs from a plurality of pre-divided CPU load information intervals, determine a second information interval to which the second load information belongs from a plurality of pre-divided application load information intervals, and determine a first frame rate interval to which the first frame rate belongs from a plurality of pre-divided frame rate intervals;
[0043] From a three-dimensional frequency matrix, determine the values located at the first number of rows, the second number of columns, and the third number of layers as the initial frequency information of the CPU cluster, wherein the first number is: the interval number of the first information interval in all CPU load information intervals, the second number is: the interval number of the second information interval in all application load information intervals, and the third number is: the interval number of the first frame rate interval in all frame rate intervals.
[0044] It can be seen that each dimension in the matrix corresponds to one type of information, and the value of the numerical value in the matrix corresponds to another type of information. In this way, the three-dimensional frequency matrix can intuitively and conveniently store the correspondence between various types of information. Therefore, according to the information interval to which each type of information belongs, the access position can be quickly and uniquely determined in the three-dimensional matrix, and the value at the determined access position can be used as the initial frequency information.
[0045] In one embodiment of the present application, determining the first offset value of the initial frequency information from the first corresponding relationship includes:
[0046] Determine, from a three-dimensional offset value matrix, values located at the first number of rows, the second number of columns, and the third number of layers as first offset values of the initial frequency information, wherein the offset value matrix has the same size as the frequency matrix;
[0047] The updating the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes:
[0048] Based on the set target frame rate and the second frame rate, the values of a first number of rows, a second number of columns, and a third number of layers in the offset value matrix are updated.
[0049] It can be seen that when the storage form of the first correspondence is a three-dimensional matrix, each dimension of the three-dimensional matrix corresponds to a type of information. Therefore, the access position can be uniquely determined in the three-dimensional matrix intuitively and quickly according to the information interval to which each type of information belongs, and the value at the determined access position is used as the first offset value. In addition, the first offset value recorded in the first correspondence can be efficiently updated later by directly updating the value at the access position.
[0050] In one embodiment of the present application, if the number of the CPU clusters is greater than 1,
[0051] The determining, based on the first load information and the first frame rate, the initial frequency information of the CPU cluster, and determining a first offset value of the initial frequency information from a first corresponding relationship, includes:
[0052] For each CPU cluster, determining initial frequency information of the CPU cluster according to first load information of the CPU cluster and the first frame rate, and determining a first offset value of the initial frequency information of the CPU cluster from a first corresponding relationship set for the CPU cluster;
[0053] The updating the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes:
[0054] For each CPU cluster, based on the set target frame rate and the second frame rate, the first load information of the CPU cluster and the first offset value corresponding to the first frame rate recorded in the first corresponding relationship set for the CPU cluster are updated.
[0055] It can be seen that in this embodiment, when there are multiple CPU clusters in the terminal, the first load information of multiple CPU clusters is taken into consideration when collecting sample data. For each CPU cluster, the offset frequency information of the CPU cluster is determined specifically, and finally the sample data including the offset frequency information of multiple CPU clusters is constructed, so that the collected sample data is more comprehensive. In addition, when updating the first offset value, for each CPU cluster, the first load information of the CPU cluster and the first offset value corresponding to the first frame rate in the first correspondence relationship set for the CPU can be updated respectively, that is, the offset value recorded in the first correspondence relationship is jointly explored in the dimension of multiple CPU clusters, which is conducive to making the frame rate after the CPU frequency is set based on the offset frequency information determined by the offset value recorded in the first correspondence relationship closer and closer to the target frame rate, so that the final sample data is more in line with the needs of the actual scene, and the quality of the obtained sample data is improved.
[0056] In one embodiment of the present application, the constructing of sample data including the first load information, the first frame rate, the second frame rate, and the offset frequency information includes:
[0057] Determine whether a frame rate difference between a set target frame rate and the second frame rate is greater than a set threshold;
[0058] If yes, then based on the frame rate difference, reward information is calculated, the reward information reflecting: the excellence of the effect produced after the operating frequency of the CPU cluster is set based on the second frame rate information;
[0059] otherwise, calculating the reward information based on the offset frequency information;
[0060] Construct sample data including the first load information, the first frame rate, the second frame rate, the offset frequency information and the reward information.
[0061] In this way, the constructed sample data also includes reward information calculated according to the frame rate difference, so that the information included in the sample data is richer. There is no need to additionally calculate the reward information during subsequent model training, thereby improving the model training efficiency.
[0062] In a second aspect, an embodiment of the present application provides a terminal, including:
[0063] one or more processors and memory;
[0064] The memory is coupled to the one or more processors, and the memory is used to store computer program codes, where the computer program codes include computer instructions. The one or more processors call the computer instructions to enable the terminal to execute the method described in the first aspect.
[0065] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, including a computer program, which, when executed on a terminal, enables the terminal to execute the method described in the first aspect.
[0066] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes executable instructions. When the executable instructions are executed on a terminal, the terminal executes the method described in the first aspect.
[0067] In the fifth aspect, an embodiment of the present application provides a chip system, which is applied to a terminal, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the terminal inputs data into the chip system and executes the method described in the first aspect to collect data.
[0068] The beneficial effects of the solutions provided by the embodiments in the second to fifth aspects can refer to the beneficial effects of the solutions provided by the embodiments in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0070] Figure 1 A schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0071] Figure 2 A software structure diagram of a terminal provided in an embodiment of the present application;
[0072] Figure 3 A flowchart of an intensive training method is shown;
[0073] Figure 4 It is a flowchart of an online reinforcement training method;
[0074] Figure 5 A signaling diagram of an interaction process provided in an embodiment of the present application;
[0075] Figure 6A schematic diagram of a first data collection method provided in an embodiment of the present application;
[0076] Figure 7 A schematic diagram of a frequency matrix provided in an embodiment of the present application;
[0077] Figure 8 A schematic diagram of a second data collection method provided in an embodiment of the present application;
[0078] Fig. 9 A schematic diagram of a data collection process provided in an embodiment of the present application;
[0079] Fig.10 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0081] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first instruction and the second instruction are to distinguish different user instructions, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.
[0082] It should be noted that, in this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0083] The solution provided in the embodiment of the present application can be applied to any terminal with data processing, storage and other functions. A possible hardware structure and software structure of the above terminal are described below.
[0084] For example, Figure 1The schematic diagram of the structure of the terminal 100 is shown. The terminal 100 may include a processor 110, a display screen 120, a camera 130, an internal memory 140, a subscriber identification module (Subscriber Identification Module, SIM) card interface 150, a universal serial bus (Universal Serial Bus, USB) interface 160, a charging management module 170, a battery management module 171, a battery 172, a sensor module 180, a mobile communication module 190, a wireless communication module 200, an antenna 1 and an antenna 2, etc. The sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, etc.
[0085] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal 100. In other embodiments of the present application, the terminal 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0086] The processor 110 may include one or more processing units, for example, the processor 110 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.
[0087] The CPU included in the processor 110 may include at least one CPU cluster, and each CPU cluster includes at least one CPU core (referred to as core for short). Figure 1 As shown, the processor 110 includes a CPU cluster 1101 and a CPU cluster 1102 . The CPU cluster 1101 includes cores a1 - an, and the CPU cluster 1102 includes cores b1 - bn.
[0088] The above-mentioned different processing units can be independent components or integrated into one or more processors. In some embodiments, the terminal 100 can also include one or more processors 110. Among them, the controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions. In some other embodiments, a memory can also be set in the processor 110 for storing instructions and data. Exemplarily, the memory in the processor 110 can be a high-speed cache memory. The memory can save instructions or data that the processor 110 has just used or circulated.
[0089] In some embodiments, the processor 110 may include one or more interfaces. The interface 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 SIM card interface and / or a USB interface, etc. Among them, the USB interface 160 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 160 can be used to connect a charger to charge the terminal 100, and can also be used to transmit data between the terminal 100 and peripheral devices. The USB interface 160 can also be used to connect headphones to play audio through the headphones.
[0090] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is for illustrative purposes only and does not constitute a structural limitation on the terminal 100. In other embodiments of the present application, the terminal 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0091] The wireless communication function of the terminal 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 190, the wireless communication module 200, the modem processor and the baseband processor.
[0092] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
[0093] The terminal 100 implements the display function through a GPU, a display screen 120, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 120 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0094] The display screen 120 is used to display pictures, videos, etc. The display screen 120 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal 100 may include one or more display screens 120.
[0095] In some embodiments of the present application, when the display panel is made of materials such as OLED, AMOLED, FLED, etc., the above Figure 1 The display screen 120 in the embodiment can be bent. Here, the display screen 120 can be bent means that the display screen can be bent to any angle at any position and can be kept at the angle, for example, the display screen 120 can be folded in half from the middle to the left or right. It can also be folded in half from the middle to the top or bottom.
[0096] The display screen 120 of the terminal 100 may be a flexible screen. Compared with a traditional screen, the flexible screen has the characteristics of strong flexibility and bendability, and can provide users with a new interaction method based on the bendable characteristics. For a terminal equipped with a foldable display screen, the foldable display screen on the terminal can be switched between a small screen in a folded state and a large screen in an unfolded state at any time. Therefore, the user can also use the split screen function on the terminal equipped with a foldable display screen.
[0097] The display screen 120 displays the desktop of the operating system deployed on the terminal, and the desktop displays application icons of various application programs installed on the terminal.
[0098] The terminal 100 can realize the shooting function through the ISP, the camera 130, the video codec, the GPU, the display screen 120 and the application processor, etc., wherein the camera 130 includes a front camera and a rear camera.
[0099] The ISP is used to process the data fed back by the camera 130. For example, when shooting, the shutter is opened, and light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithm optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be set in the camera 130.
[0100] The camera 130 is used to take photos or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard red green blue (RGB), YUV or other format. In some embodiments, the terminal 100 may include 1 or N cameras 130, where N is a positive integer greater than 1.
[0101] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the terminal 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0102] Video codecs are used to compress or decompress digital videos. Terminal 100 may support one or more video codecs. Thus, terminal 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0103] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the terminal 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0104] The internal memory 140 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the above instructions stored in the internal memory 140, so that the terminal 100 performs the data collection method provided in some embodiments of the present application, as well as various applications and data processing. The internal memory 140 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system; the program storage area can also store one or more applications (such as a gallery, contacts, etc.). The data storage area can store data (such as photos, contacts, etc.) created during the use of the terminal 100. In addition, the internal memory 140 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (Universal Flash Storage, UFS), etc. In some embodiments, the processor 110 can execute the data collection method provided in the embodiment of the present application, as well as other applications and data processing by running the instructions stored in the internal memory 140 and / or the instructions stored in the memory provided in the processor 110.
[0105] The internal memory 140 can be used to store the relevant programs of the data collection method provided in the embodiment of the present application, and the processor 110 can be used to call the relevant programs of the data collection method stored in the internal memory 140 when displaying information to execute the data collection method of the embodiment of the present application.
[0106] The sensor module 180 may include a pressure sensor 180A, a touch sensor 180B, and the like.
[0107] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 120. There are many types of pressure sensors 180A, for example, they can be resistive pressure sensors, inductive pressure sensors or capacitive pressure sensors. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When the force acts on the pressure sensor 180A, the capacitance between the electrodes changes, and the terminal 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 120, the terminal 100 detects the touch operation based on the pressure sensor 180A. The terminal 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A, and determine the application or control within the application to which the touch operation is applied based on the position of the touch. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed; when a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
[0108] The touch sensor 180B is also referred to as a touch control device. The touch sensor 180B may be provided on the display screen 120, and the touch sensor 180B and the display screen 120 form a touch screen, which is also referred to as a touch control screen. The touch sensor 180B is used to detect touch operations acting on or near it. The touch sensor 180B may pass the detected touch operation to the application processor to determine the touch event type, and the touch event type may include a click type, a long press type, a sliding type, and the like. Visual output related to the touch operation may be provided through the display screen 120. In some embodiments, different touch event types may correspond to different operation instructions. In other embodiments, the touch sensor 180B may also be provided on the surface of the terminal 100, and may be provided at a different position from the display screen 120.
[0109] Figure 2 The software structure diagram of the terminal applicable to the embodiment of the present application is shown in FIG. The software system of the terminal can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture.
[0110] The layered architecture divides the terminal's software system into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into five layers, namely, application layer (applications), application framework layer (application framework), system library, hardware abstraction layer (HAL) and kernel layer (kernel).
[0111] The application layer can include a series of application packages. The application layer runs applications by calling the application programming interface (API) provided by the application framework layer. Figure 2 As shown, the application package may include applications such as camera, video, gallery, browser, etc. It can be understood that the port of each of the above applications can be used to receive data.
[0112] The application framework layer provides API and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a resource manager, a notification manager, and a Dynamic Host Configuration Protocol (DHCP) module.
[0113] Among them, the window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0114] Content providers are used to store and retrieve data and make it accessible to applications. The above data can include video, images, audio, etc.
[0115] The view system includes visual controls, such as controls for displaying application icons, controls for displaying text, controls for displaying buttons, etc.
[0116] The resource manager provides various resources for applications, such as localized strings, application icons, images, layout files, video files, and so on.
[0117] The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and disappear automatically after a short stay without user interaction.
[0118] The system library can include multiple functional modules, such as surface manager, 3D graphics processing library, 2D graphics engine and file library. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing. The 2D graphics engine is a drawing engine for 2D drawing.
[0119] The hardware abstraction layer may include multiple library modules, such as hard disk library modules and display library modules. The terminal system may load the corresponding library modules for the device hardware, thereby realizing the purpose of the process accessing the device hardware. For example, the terminal system may load the corresponding library modules for the hard disk, thereby realizing the process accessing the system configuration files stored in the hard disk.
[0120] The kernel layer is a layer between hardware and software. The kernel layer is deployed with an operating system for driving the hardware to make the hardware work. The kernel layer at least includes a hard disk drive, a display drive, a camera drive, a sensor drive, and a motor drive, etc., which are not limited in the embodiments of the present application. It can be understood that the hard disk drive, the display drive, the camera drive, the sensor drive, and the motor drive, etc. can all be regarded as a driver node. Each of the above-mentioned driver nodes includes an interface that can be used to receive data.
[0121] The operating system deployed in the kernel layer of the terminal can execute the data collection solution provided in the embodiment of the present application in response to the user starting the data collection function.
[0122] The following is an introduction to the application scenarios of the solutions provided in the embodiments of the present application.
[0123] The application scenario of the solution provided in the embodiment of the present application is: collecting sample data for training a set model and obtaining a frequency prediction model by training with the sample data.
[0124] The above-mentioned setting model can be a model based on a reinforcement learning algorithm, and can also be called a reinforcement learning model.
[0125] Reinforcement learning, also known as reinforcement learning, evaluation learning or enhanced learning, is used to describe and solve the problem of how an agent learns strategies to maximize rewards or achieve specific goals during its interaction with the environment.
[0126] In the application scenario of the solution provided in the embodiment of the present application, the intelligent agent can be: a device for performing reinforcement learning, such as a personal computer (PC); the environment can be: a terminal that needs to determine the optimal frequency of the CPU, such as a mobile phone, a tablet computer, etc.; the specific goal to be achieved can be: the intelligent agent predicts the optimal frequency of the CPU based on the state of the environment.
[0127] Reinforcement learning mainly includes three elements: state, action and reward. Among them, the state is a description of the environment, and the action is the result of the agent's output according to the processing strategy after the state of the environment is input into the agent. After the agent feeds back the action to the environment, the environment can generate a new state and feed it back to the agent. The reward (positive or negative) is calculated by the agent based on the new state fed back, which is used to reflect the excellence of the effect of the action output by the agent. In other words, the reward is used to measure the quality of the action output by the agent.
[0128] See also Figure 3 After the state information of the environment is input into the agent, the agent can decide the action corresponding to the state according to the processing strategy and perform the action on the environment. The environment can feed back the new state generated after the action is performed to the agent, so that the agent can determine the reward of the action output by itself according to the above new state and adjust the processing strategy according to the reward. Then, the agent continues to determine the action corresponding to the new state according to the updated processing strategy, and continues to update the processing strategy according to the feedback of the environment on the new action, and so on, until the set conditions are met.
[0129] Reinforcement learning models are generally trained using online training, see Figure 4 ,The following example takes the intelligent agent as a PC and the environment as a mobile phone.
[0130] The reinforcement learning model deployed in the PC can be a deep Q-learning (Q-learning) network model, a temporal difference online control (State-Action-Reward-State-Action, SARSA) network model, a deep reinforcement learning (Deep QNetwork, DQN) network, etc., which is not limited to the embodiments of the present application.
[0131] Specifically, when the mobile phone is running an application, it can collect the frame rate of the application's running interface, the load of the CPU cluster and other information frame by frame as state information, and send the state information to the PC. In this way, after the PC obtains the state information, it can use the state information as the input of the reinforcement learning model to obtain the action output by the model, that is, the frequency of the CPU. Furthermore, the PC can feedback and execute the action, that is, send the action to the mobile phone, so that the mobile phone adjusts the frequency of the CPU cluster according to the received action, and then the mobile phone continues to collect new state information and sends the new state information to the PC. The PC can calculate the reward based on the new state information and update the parameters based on the reward, that is, calculate the loss function based on the reward, and adjust the model parameters of the reinforcement learning model according to the loss function. Then, the PC uses the new state information as the input of the reinforcement learning model after updating the parameters, continues to output the action corresponding to the new state, and continues to update the model parameters according to the feedback of the environment on the new action, and so on, until the iteration end condition is met.
[0132] However, online training has the following disadvantages:
[0133] 1. The training process is relatively complicated
[0134] In the online training scenario, the Android Debug Bridge (adeb) environment needs to be built in the mobile phone, and a communication relationship needs to be established between the mobile phone and the PC. In this way, during the training process, the mobile phone can interact with the PC in real time, and the network parameters of the reinforcement learning model in the PC are continuously optimized based on the data interaction results to obtain the frequency prediction model. The above environment construction and communication establishment process are relatively cumbersome.
[0135] 2. Low efficiency of network parameter adjustment
[0136] In many cases, the result of an online training is often not in line with expectations. For example, the CPU frequency predicted by the model obtained from the expected training needs to be more inclined to ensure the smooth operation of the application, but the CPU frequency predicted by the model obtained from the actual training is more inclined to reduce CPU power consumption. At this time, it is necessary to re-enter the online training process. The online training process often takes several hours, which takes a lot of time and is inefficient.
[0137] 3. Low training accuracy
[0138] During the training of the reinforcement learning model, due to network fluctuations, there will be a certain delay in the data interaction between the mobile phone and the PC. It may be difficult for the mobile phone to send the collected status information to the PC in real time, and it may be difficult for the PC to transmit the CPU frequency corresponding to each state to the mobile phone in a timely manner.
[0139] This will cause the action (CPU frequency) output by the PC to not match the frame in which the above action is expected to act. Based on this, the reward calculated by the PC is inaccurate, affecting the accuracy of model training.
[0140] See also Figure 5 , it can be seen that the mobile phone collects the status information of the first frame at time t, sends the status information of the first frame to the PC, and collects the status information of the second frame at time t+1, and sends the status information of the second frame to the PC. Due to network fluctuations, the time when the PC receives the status information of the first frame is delayed. The CPU frequency determined by the PC for the first frame is the CPU frequency expected to act on the second frame, that is, the mobile phone should adjust the frequency according to the received CPU frequency at time t+1. However, when the PC actually feeds back the CPU frequency determined for the first frame to the mobile phone, time t+1 has passed. The mobile phone can only adjust the frequency based on the received CPU frequency at time t+2, and then collect the status information of the third frame and send the status information of the third frame to the PC.
[0141] That is, the mobile phone did not adjust the frequency based on the CPU frequency at time t+1, so the PC could not accurately calculate the reward based on the state information of the first frame at time t and the state information of the second frame after the frequency adjustment at time t+1, and it was difficult to adjust the network parameters of the reinforcement learning model in a timely and reasonable manner according to the reward.
[0142] In view of the above situation, an offline training method has emerged. The sample data required for training the model is collected in advance, and then the model is trained based on the collected sample data. In this way, when the training results do not meet expectations, offline training can be re-performed based on the original sample data, or more sample data can be collected and the model can be trained based on the collected sample data, which reduces the time required for environment construction and communication establishment process, and has higher training efficiency.
[0143] In the offline training scenario, the diversity of values of the collected sample data directly affects the accuracy and rationality of the optimal frequency predicted by the trained frequency prediction model. Therefore, an embodiment of the present application provides a data collection method to collect sample data with diverse values for model training.
[0144] The solution provided in the embodiment of the present application is described in detail below in conjunction with the flow chart.
[0145] See also Figure 6 , is a flow chart of a first data collection method provided in an embodiment of the present application, the method comprises the following steps S601-S606:
[0146] Step S601: obtaining a first frame rate of a terminal displaying a first program interface and first load information of a CPU cluster in the terminal.
[0147] The first program interface is: the running interface of the first application program. The first application program may be any application program such as a game, a video, a map, etc., and this embodiment of the present application does not limit this.
[0148] The first frame rate at which the terminal displays the first program interface is the frame rate of the picture displayed when the terminal runs the first program.
[0149] Specifically, the terminal can directly obtain the first frame rate determined by the resident frame rate detection process, or calculate the ratio of the playback time to the set number of frames rendered most recently, and use the calculation result as the first frame rate.
[0150] Load information can also be called CPU utilization, which can be understood as the ratio between the CPU's workload and its available processing power, or as the percentage of the total time that the CPU spends executing computing tasks over a period of time. For example, if the CPU utilization is 50%, it means that half of the CPU time is spent executing computing tasks and the other half is idle.
[0151] The first load information of the CPU cluster is specifically the overall load information of each core included in the CPU cluster, and can be obtained based on the load information of each core.
[0152] Specifically, the operating system can collect statistics on the load information of each core in the CPU, and then calculate a representative value of the load information as the first load information of the CPU cluster. The representative value can be an average value, a weighted average value, etc.
[0153] Step S602: determining initial frequency information of the CPU cluster based on the first load information and the first frame rate, and determining a first offset value of the initial frequency information from a first corresponding relationship.
[0154] The above-mentioned first load information and first frame rate can be called the status information of the terminal. After obtaining the above-mentioned status information, a frequency information that can ensure that the application can run smoothly and make the CPU power consumption relatively low can be determined based on the above-mentioned status information. Since the accuracy of the frequency information determined at this time is limited, it can be called the initial frequency information.
[0155] The initial frequency information may be a specific CPU frequency or a CPU frequency point number, and each frequency point number corresponds to a set CPU frequency.
[0156] First, the method of determining the initial frequency information is introduced.
[0157] In one implementation, the initial frequency information of the CPU cluster of the initial frequency information may be determined from a preset second corresponding relationship based on the first load information and the first frame rate.
[0158] The second corresponding relationship is: the corresponding relationship between the load information of the CPU cluster, the frame rate of the terminal display program interface, and the frequency information of the CPU cluster.
[0159] That is, from the second corresponding relationship, the frequency information corresponding to the first load information and the first frame rate is determined as the initial frequency information.
[0160] In one case, the second corresponding relationship may be stored in a matrix, and the values in the matrix represent CPU frequencies or frequency points. When the values in the matrix represent frequency points, the matrix may be called a frequency point matrix or a frequency point map.
[0161] See also Figure 7 , is a schematic diagram of a frequency matrix provided in an embodiment of the present application, wherein each rectangle represents a value in the matrix, and x represents a specific value of the value, corresponding to a frequency number. For example, the value of x can be any integer value in [0,16], and these 17 integer values represent the 17 frequency numbers of the CPU.
[0162] In this case, the rows and columns of the matrix correspond to the CPU load information and the frame rate of the application, respectively. Therefore, the first information interval to which the first load information belongs can be determined from the multiple pre-divided CPU load information intervals, and the first frame rate interval to which the first frame rate belongs can be determined from the multiple frame rate intervals. Then, from the frequency matrix, the numerical value located at the first number of rows and the second number of columns can be determined as the initial frequency information of the CPU cluster.
[0163] The first number is: the interval sequence number of the first information interval in all CPU load information intervals, and the second number is: the interval sequence number of the first frame rate interval in all frame rate intervals.
[0164] For example, the first load information L1 is 60%, the first frame rate F1 is 58 frames / second, the first information interval to which L1 belongs is C20, and the interval number of C20 in all CPU load information intervals is 20. The frame rate interval to which F1 belongs is E15, and the interval number of E15 in all frame rate intervals is 15. The first quantity is 20, and the second quantity is 15. Therefore, the value located at row 20 and column 15 can be determined from the frequency matrix as the initial frequency information of the CPU cluster.
[0165] In another implementation, the first load information and the first frame rate may be input into a pre-trained initial frequency model to obtain initial frequency information output by the model. The above-mentioned initial frequency model is different from the set model to be trained, and may be a model pre-trained based on sample data. In this implementation, the model may be used to obtain sample data of the set model to be trained.
[0166] The following is an introduction to the method of determining the first offset value.
[0167] The first corresponding relationship is the corresponding relationship between the load information of the CPU cluster, the frame rate of the terminal display program interface, and the offset value.
[0168] Therefore, the offset value corresponding to the first load information and the first frame rate can be directly determined from the first corresponding relationship as the first offset value.
[0169] In one case, the storage form of the above-mentioned first corresponding relationship can also be a matrix, which can be called an offset matrix or an offset table.
[0170] The above offset matrix is similar to the aforementioned frequency matrix, the only difference being that the values in the frequency matrix represent the CPU frequency or frequency point number, while the values in the offset matrix represent the offset value.
[0171] In this case, a value located at a first number of rows and a second number of columns may be determined from the offset matrix as a first offset value of the initial frequency information.
[0172] Step S603: using the first offset value to offset the initial frequency information to obtain offset frequency information.
[0173] Specifically, the sum of the first offset value and the initial frequency information may be directly calculated, and the calculation result may be used as the offset frequency information.
[0174] For example, the initial frequency information is 10, and the first offset value is -1, then the offset frequency information is 10+(-1)=9, indicating the frequency point number of sequence number 9.
[0175] Step S604: setting the operating frequency of the CPU cluster based on the offset frequency information, and obtaining a second frame rate at which the terminal displays the first program interface after the frequency is set.
[0176] In this step, the operating frequency of the CPU cluster is set, that is, the operating frequency of each core in the CPU cluster is set.
[0177] Specifically, the operating frequency of each core in the CPU cluster may be directly set to the frequency represented by the offset frequency information.
[0178] The method for obtaining the second frame rate is the same as the method for obtaining the first frame rate, which will not be repeated here.
[0179] Step S605: Based on the set target frame rate and the second frame rate, the first offset value recorded in the first corresponding relationship is updated.
[0180] The target frame rate is a preset expected frame rate, that is, a frame rate at which the terminal is expected to display the first program interface.
[0181] After obtaining the second frame rate after the set frequency, the first offset value recorded in the first corresponding relationship can be updated according to the difference between the second frame rate and the target frequency.
[0182] In one implementation, the adjustment direction and the adjustment amount along the adjustment direction may be determined according to the frame rate difference between the target frame rate and the second frame rate, and then the first offset value recorded in the first corresponding relationship may be updated according to the determined adjustment direction and adjustment amount. Figure 8 The illustrated embodiment will not be described in detail here.
[0183] In another implementation, the ratio between the target frame rate and the second frame rate may be calculated, and then the product of the first offset value recorded in the first corresponding relationship and the obtained ratio may be calculated to obtain an updated first offset value.
[0184] Step S606: constructing sample data including first load information, first frame rate, second frame rate and offset frequency information.
[0185] After obtaining the first load information, the first frame rate, the second frame rate and the offset frequency information, sample data may be constructed according to the obtained information, that is, the obtained data as a whole may be regarded as a sample data.
[0186] In one implementation, the second load information of the CPU after the frequency is set may also be obtained, and then when constructing the sample data, the second load information is also included in the sample data.
[0187] In one embodiment of the present application, the constructed sample data may also include reward information. The following describes how to obtain the reward information:
[0188] First, it is determined whether the frame rate difference between the set target frame rate and the second frame rate is greater than the set threshold. If so, reward information is calculated based on the frame rate difference; otherwise, reward information is calculated based on the offset frequency information. The above reward information reflects the excellence of the effect produced after the operating frequency of the CPU cluster is set based on the second frame rate information.
[0189] The frame rate difference can also be called the frame loss value. When the frame rate difference is greater than the set threshold, it means that the frame rate of the terminal displaying the first program interface is low and does not meet expectations. At this time, the frame rate difference can dominate the reward. In this case, the reward information can be called a performance reward; otherwise, it means that the terminal displays the first program interface at a high frame rate, which meets expectations or exceeds expectations. At this time, the offset frequency information can dominate the reward. In this case, the reward information can be called a power consumption reward.
[0190] Specifically, the reward information at time t can be calculated using the following expression: :
[0191] ;
[0192] in, Represents the frame rate difference at time t, that is, the difference between the target frame rate and the second frame rate; represents the CPU frequency information determined at time t, that is, the above-mentioned offset frequency information; Indicates the above-mentioned set threshold; The above performance reward is Function of Represents the above power consumption bonus, which is the offset frequency information at time t function.
[0193] In this way, the constructed sample data also includes reward information calculated according to the frame rate difference, so that the information included in the sample data is richer. There is no need to additionally calculate the reward information during subsequent model training, thereby improving the model training efficiency.
[0194] As can be seen from the above, when the scheme provided in the embodiment of the present application is used to collect data, the first frame rate of the first program interface displayed on the terminal and the first load information of the CPU cluster in the terminal are obtained, and then, based on the first load information and the first frame rate, the initial frequency information of the CPU cluster is determined. In addition, the first offset value of the initial frequency information is determined from the first corresponding relationship, and the initial frequency information is offset by the first offset value to obtain the offset frequency information. Then, the operating frequency of the CPU cluster is set based on the offset frequency information, and the second frame rate of the first program interface displayed on the terminal after the frequency is set is obtained, and the first offset value recorded in the first corresponding relationship is updated based on the set target frame rate and the second frame rate. Finally, sample data including the first load information, the first frame rate, the second frame rate and the offset frequency information can be successfully constructed.
[0195] Among them, the first offset value is determined from the first correspondence according to the frame rate and frequency information before the frequency is set, and after the offset frequency information is obtained according to the first offset value, the first offset value recorded in the first correspondence is updated according to the difference between the frame rate after the frequency is set and the target frame rate. In this way, different offset values can be determined for the same frame rate and frequency information according to the updated first correspondence, and different offset frequency information can be obtained, thereby improving the value diversity of the determined offset frequency information, that is, improving the value diversity of the sample data including the offset frequency information.
[0196] In addition, in the solution provided in the embodiment of the present application, each time the offset frequency information is determined, the offset value in the first corresponding relationship is updated according to the target frame rate, that is, the offset value in the first corresponding relationship is explored. Through this cumulative update, it is beneficial to make the frame rate after the CPU frequency is set based on the offset frequency information determined by the offset value recorded in the first corresponding relationship closer and closer to the target frame rate, that is, the determined offset frequency information is increasingly in line with expectations, thereby improving the rationality of the obtained offset frequency information, making the obtained sample data more in line with the needs of the actual scene, and improving the quality of the obtained sample data.
[0197] Moreover, the subsequent use of high-quality, diverse-value sample data training models collected based on the solution provided in the embodiments of the present application can improve the accuracy and rationality of the optimal frequency predicted by the trained frequency prediction model, that is, improve the model performance.
[0198] In one embodiment of the present application, when determining the initial frequency information and the offset value, in addition to considering the first load information and the first frame rate of the CPU cluster, the second load information of the first application program may also be considered. In view of this, the above step S502 may also be implemented by the following steps:
[0199] Second load information of the first application is obtained, initial frequency information of the CPU cluster is determined based on the first load information, the second load information and the first frame rate, and a first offset value of the initial frequency information is determined from the first corresponding relationship.
[0200] The second load information is obtained based on the proportion of resources consumed by the threads of the first application program running on the CPU cores included in the CPU cluster in the total resources of the CPU cores.
[0201] The threads of the first application may run on different CPU cores. In this embodiment, it is possible to first determine which CPU cores of the CPU cluster the threads are running on, and then calculate the above proportion for each CPU core, and use the representative value of the obtained proportion as the second load information.
[0202] Among them, for a CPU core, the execution time of the CPU core executing the thread of the first application within the set time can be determined, and the ratio of the above execution time to the set time can be calculated as the proportion of resources consumed by the CPU core running the thread of the first application in the total resources of the CPU core.
[0203] For example, within 1 second, the above thread is executed in the CPU core for 700 milliseconds, so the ratio of the above execution time to the set time is 700 / 1000=70%.
[0204] In this embodiment, the method for determining the initial frequency information of the CPU cluster is similar to the method for determining the initial frequency information introduced in the aforementioned step S602, with the only difference being that the second corresponding relationship is: the correspondence between the load information of the CPU cluster, the load information of the application, and the frame rate and frequency information of the terminal display program interface. In this way, the first load information, the second load information, and the frequency information corresponding to the first frame rate can be determined from the second corresponding relationship as the initial frequency information.
[0205] In this way, when determining the initial frequency information and the offset value, the load information of the first application is also considered, and the considered information is richer and more comprehensive, thereby improving the accuracy of the obtained initial frequency information and the offset value, and improving the quality of the sample data finally collected.
[0206] When the storage form of the above-mentioned second correspondence is a three-dimensional matrix, in addition to determining the first information interval to which the first load information belongs and the first frame rate interval to which the first frame rate belongs, the second information interval to which the second load information belongs can also be determined from the pre-divided multiple application load information intervals, and then, from the three-dimensional frequency matrix, the values located at the first number of rows, the second number of columns, and the third number of layers are determined as the initial frequency information of the CPU cluster.
[0207] The third number is: the interval sequence number of the second information interval in all application load information intervals.
[0208] It can be seen that each dimension in the matrix corresponds to one type of information, and the value of the numerical value in the matrix corresponds to another type of information. In this way, the three-dimensional frequency matrix can intuitively and conveniently store the correspondence between various types of information. Therefore, according to the information interval to which each type of information belongs, the access position can be quickly and uniquely determined in the three-dimensional matrix, and the value at the determined access position can be used as the initial frequency information.
[0209] Similarly, in this embodiment, the method for determining the first offset value of the initial frequency information is similar to the method for determining the offset value introduced in the aforementioned step S602, with the only difference being that the first corresponding relationship is: the correspondence between the load information of the CPU cluster, the load information of the application, the frame rate of the terminal display program interface and the offset value. In this way, the offset value corresponding to the first load information, the second load information and the first frame rate can be determined from the first corresponding relationship as the first offset value.
[0210] When the storage form of the first corresponding relationship is a three-dimensional matrix, the values located at the first number of rows, the second number of columns, and the third number of layers can be directly determined from the three-dimensional frequency matrix as the first offset values.
[0211] Moreover, in this case, when the first offset value recorded in the first correspondence is updated based on the target frame rate and the second frame rate, the values of the first number of rows, the second number of columns, and the third number of layers in the offset value matrix can be directly updated.
[0212] It can be seen that when the storage form of the first correspondence is a three-dimensional matrix, each dimension of the three-dimensional matrix corresponds to a type of information. Therefore, the access position can be uniquely determined in the three-dimensional matrix intuitively and quickly according to the information interval to which each type of information belongs, and the value at the determined access position is used as the first offset value. In addition, the first offset value recorded in the first correspondence can be efficiently updated later by directly updating the value at the access position.
[0213] In one embodiment of the present application, if the number of CPU clusters is greater than 1, the above step S602 can be implemented by following step A, and the above step S605 can be implemented by following step B:
[0214] Step A: for each CPU cluster, determine the initial frequency information of the CPU cluster according to the first load information and the first frame rate of the CPU cluster, and determine the first offset value of the initial frequency information of the CPU cluster from the first corresponding relationship set for the CPU cluster.
[0215] In this step, the method of determining the initial frequency information and the first offset value is similar to that of step S602, except that:
[0216] In the case where the terminal includes multiple CPU clusters, the first load information of each CPU cluster can be obtained. Then, for each CPU cluster, the initial frequency information of the CPU cluster is determined according to the first load information and the first frame rate of the CPU cluster. In this case, each CPU cluster determines the first offset value of the initial frequency information according to the first corresponding relationship set for itself.
[0217] Of course, in this step, the second load information of the first application program may also be additionally obtained for each CPU cluster, so that the second load information is also considered when determining the initial frequency information and the first offset value, which will not be described in detail here.
[0218] Step B: For each CPU cluster, based on the set target frame rate and the second frame rate, the first offset value corresponding to the first load information and the first frame rate of the CPU cluster recorded in the first corresponding relationship set for the CPU cluster is updated.
[0219] In this step, the method of updating the first offset value is similar to that of step S605, with the only difference being:
[0220] For each CPU cluster, the first load information of the CPU cluster and the first offset value corresponding to the first frame rate in the first corresponding relationship set for the CPU are updated respectively.
[0221] Of course, in this step, the second load information of the first application program may also be additionally obtained for each CPU cluster, so that the second load information is also considered when updating the first offset value, which will not be described in detail here.
[0222] It can be seen that in this embodiment, when there are multiple CPU clusters in the terminal, the first load information of multiple CPU clusters is taken into consideration when collecting sample data. For each CPU cluster, the offset frequency information of the CPU cluster is determined specifically, and finally the sample data including the offset frequency information of multiple CPU clusters is constructed, so that the collected sample data is more comprehensive. In addition, when updating the first offset value, for each CPU cluster, the first load information of the CPU cluster and the first offset value corresponding to the first frame rate in the first correspondence relationship set for the CPU can be updated respectively, that is, the offset value recorded in the first correspondence relationship is jointly explored in the dimension of multiple CPU clusters, which is conducive to making the frame rate after the CPU frequency is set based on the offset frequency information determined by the offset value recorded in the first correspondence relationship closer and closer to the target frame rate, so that the final sample data is more in line with the needs of the actual scene, and the quality of the obtained sample data is improved.
[0223] exist Figure 1 On the basis of the embodiment shown, when updating the first offset value recorded in the first correspondence, the adjustment direction and the adjustment amount along the adjustment direction can be determined according to the size of the frame rate difference between the target frame rate and the second frame rate, and then the first offset value recorded in the first correspondence is updated according to the determined adjustment direction and adjustment amount. In view of the above situation, the embodiment of the present application provides a second data collection method.
[0224] See also Figure 8, is a flow chart of a second data collection method provided in an embodiment of the present application, the method comprising the following steps S801-S809:
[0225] Step S801: obtaining a first frame rate of a terminal displaying a first program interface and first load information of a CPU cluster in the terminal.
[0226] Step S802: determining initial frequency information of the CPU cluster based on the first load information and the first frame rate, and determining a first offset value of the initial frequency information from a first corresponding relationship.
[0227] Step S803: using the first offset value to offset the initial frequency information to obtain offset frequency information.
[0228] Step S804: setting the operating frequency of the CPU cluster based on the offset frequency information, and obtaining a second frame rate at which the terminal displays the first program interface after the frequency is set.
[0229] The above steps S801 to S804 are the same as the above Figure 6 In the illustrated embodiment, steps S601 to S604 are the same and will not be described in detail here.
[0230] Step S805: Calculate the frame rate difference between the set target frame rate and the second frame rate.
[0231] Step S806: Determine the adjustment direction based on the frame rate difference.
[0232] Specifically, the adjustment direction can be determined in the following ways:
[0233] In one case, if the frame rate difference is greater than the first frame loss threshold, the adjustment direction is determined to be: increasing the direction of the frequency information of the CPU cluster.
[0234] When the frame rate difference is greater than the first frame loss threshold, it means that the frame rate of the terminal displaying the first program interface is low, that is, the offset frequency information currently used cannot meet the requirement of smooth operation of the first application program. Therefore, the adjustment direction can be determined as: increasing the frequency information of the CPU cluster, that is, increasing the offset value, so that a larger offset frequency information can be determined based on the initial frequency information and the offset value, thereby avoiding insufficient performance of the CPU cluster.
[0235] In another case, if the frame rate difference is less than the first superframe threshold, the adjustment direction is determined to be: a direction of reducing the frequency information of the CPU cluster, wherein the first superframe threshold is less than the first frame loss threshold.
[0236] When the frame rate difference is greater than the first frame loss threshold, it means that the frame rate of the terminal displaying the first program interface is high, that is, the offset frequency information currently used is higher than the requirement for smooth operation of the first application. Therefore, the adjustment direction can be determined as: reducing the frequency information of the CPU cluster, that is, reducing the offset value, so that smaller offset frequency information can be determined based on the initial frequency information and the offset value, thereby avoiding excessive power consumption of the CPU cluster.
[0237] In this embodiment, according to the relationship between the frame rate difference and the threshold, when the offset frequency information cannot meet the requirement of the smooth operation of the first application, the adjustment direction is determined to be the direction of increasing the frequency information of the CPU cluster, and when the offset frequency information is higher than the requirement of the smooth operation of the first application, the adjustment direction is determined to be the direction of reducing the frequency information of the CPU cluster. In this way, after the offset frequency information is subsequently determined based on the updated offset value and the operating frequency of the CPU cluster is set based on the offset frequency information, the probability of insufficient performance or excessive power consumption of the CPU cluster is reduced, and the accuracy and rationality of adjusting the offset value are improved.
[0238] In another case, if the number of CPU clusters is greater than 1, when the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, the adjustment direction can be determined as: increasing the frequency information of at least one CPU cluster and reducing the frequency information of the remaining CPU clusters.
[0239] When the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, it indicates that the frame rate of the first program interface displayed by the terminal is moderate and basically in line with expectations. In this way, the adjustment direction is determined as: increasing the initial frequency information of at least one CPU cluster and reducing the initial frequency information of the remaining CPU clusters, that is, increasing the offset value in the first corresponding relationship of at least one CPU cluster and reducing the offset value in the first corresponding relationship of the remaining CPU clusters, which is equivalent to randomly exploring the offset values of CPU clusters in multiple dimensions, thereby improving the diversity of the values of the offset frequency information subsequently determined based on the offset value.
[0240] Step S807: determining an adjustment amount along the adjustment direction based on the frame rate difference.
[0241] Specifically, the adjustment amount can be determined according to the following five situations:
[0242] Case 1: If the frame rate difference is greater than the second frame loss threshold, the adjustment amount along the adjustment direction is determined from within the first adjustment interval.
[0243] Case 2: If the frame rate difference is less than or equal to the second frame loss threshold and greater than the first frame loss threshold, the adjustment amount is determined from the second adjustment interval.
[0244] The values included in the second adjustment interval are smaller than the values included in the first adjustment interval.
[0245] The frame rates of the first program interface displayed by the terminals in Case 1 and Case 2 are both low, that is, frame loss occurs in both cases. However, the frame rate difference in Case 2 is smaller than the frame rate difference in Case 1, that is, the frame loss of the terminal in Case 1 is more serious than that of the terminal in Case 2. Therefore, for Case 1, the adjustment amount along the adjustment direction can be determined from the first adjustment interval with a larger value to greatly adjust the offset value; for Case 2, the adjustment amount along the adjustment direction can be determined from the second adjustment interval with a smaller value to slightly adjust the offset value.
[0246] Case 3:
[0247] If the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, an adjustment amount is determined from a third adjustment interval.
[0248] In one embodiment of the present application, the numerical value included in the third adjustment interval may be smaller than the numerical value included in the first adjustment interval, and may also be smaller than the numerical value included in the fifth adjustment interval.
[0249] In this case, the frame rate of the terminal displaying the first program interface is basically in line with expectations. Therefore, the adjustment amount can be determined from the third adjustment interval with a smaller value to slightly adjust the offset value, thereby improving the rationality of adjusting the offset value.
[0250] Case 4:
[0251] If the frame rate difference is less than the first superframe threshold and greater than or equal to the second superframe threshold, an adjustment amount is determined from a fourth adjustment interval.
[0252] Case 5:
[0253] If the frame rate difference is less than the second superframe threshold, an adjustment amount is determined from within a fifth adjustment interval.
[0254] The values included in the fourth adjustment interval are smaller than the values included in the fifth adjustment interval.
[0255] The frame rates of the terminals displaying the first program interface in Case 4 and Case 5 are both high, that is, superframes occur in both cases. However, the frame rate difference in Case 5 is smaller than the frame rate difference in Case 4, that is, the superframes in the terminal in Case 5 are more serious than those in Case 4. Therefore, for Case 5, the adjustment amount along the adjustment direction can be determined from the fifth adjustment interval with a larger value included to greatly adjust the offset value; for Case 4, the adjustment amount along the adjustment direction can be determined from the fourth adjustment interval with a smaller value included to slightly adjust the offset value.
[0256] It can be seen that according to the above scheme, the offset can be determined efficiently and conveniently from a value range with different numerical values according to the size of the frame rate difference, so that the offset value can be adjusted with different amplitudes according to the determined offset. Subsequently, the offset frequency information is determined based on the updated offset value and the operating frequency of the CPU cluster is set based on the offset frequency information. This reduces the probability of insufficient performance or excessive power consumption of the CPU cluster, thereby improving the flexibility and rationality of the scheme.
[0257] Step S808: updating the first offset value recorded in the first corresponding relationship according to the determined adjustment direction and adjustment amount.
[0258] Step S809: constructing sample data including first load information, first frame rate, second frame rate and offset frequency information.
[0259] The above steps S808-S809 are the same as the above steps Figure 6 In the illustrated embodiment, steps S605 to S606 are the same and will not be described in detail here.
[0260] The target frame rate is the expected frame rate at which the terminal is expected to display the first program interface. The frame rate difference between the target frame rate and the second frame rate can accurately reflect the difference between the frame rate at which the terminal actually displays the first program interface and the expected frame rate. Thus, the adjustment value and adjustment direction are determined based on the above difference, and the offset value is updated according to the obtained adjustment value and adjustment direction, which improves the accuracy and rationality of the updated offset value, and also enables the updated offset value to determine the offset frequency information and set the operating frequency of the CPU cluster based on the offset frequency information. The difference between the frame rate at which the terminal actually displays the first program interface and the expected frame rate is reduced, which is conducive to collecting high-quality sample data.
[0261] According to the introduction of the above embodiment, Fig. 9 , taking a terminal including two CPU clusters as an example, a specific data collection process provided in an embodiment of the present application is introduced.
[0262] Fig. 9 The data collection process shown can be divided into the following stages:
[0263] Phase 1: Import the basic action table and initialize the offset table.
[0264] The imported base action table (Base Map) includes two action tables for two CPU clusters, and the initialized offset table also includes two offset tables (Offset map) for two CPU clusters.
[0265] The basic action table can also be called a basic frequency point diagram. The three dimensions correspond to the first load information of the CPU cluster, the frame rate of the program interface of the terminal displaying the application (referred to as application frame rate), and the second load information of the application running on the CPU cores of the two CPU clusters.
[0266] The dimension and size of the offset table are the same as those of the basic action table, and each value in the offset table can be a random value between [-1, 0, 1].
[0267] Phase 2: Determine the action after the offset based on the current state.
[0268] When the rendering thread of the application completes a rendering action (at time t), for each CPU cluster, the action is determined in the basic action table according to the current state. , and according to the current state, determine the offset value from the offset table , then calculate , the calculation result As the action value taken for the CPU cluster, set the operating frequency of the CPU cluster to .
[0269] Among them, the current state can be called , including first load information of two CPU clusters, a frame rate of a program interface of an application displayed on a terminal (referred to as application frame rate), and second load information of the application running on the CPU cores of the two CPU clusters.
[0270] Stage 3: Determine the exploration area based on the frame loss value, and determine the exploration value in the exploration area.
[0271] When the rendering thread completes the rendering action next time (at time t+1), the new status information after setting the frequency can be obtained, and the frame loss value can be calculated based on the new status information.
[0272] The frame loss value corresponds to the aforementioned frame rate difference, that is, the difference between the target frame rate and the second frame rate after the action is performed.
[0273] Explore the area Fig. 9 As shown in the coordinate system on the right, the coordinate system can be called the action space. The horizontal axis and vertical axis represent the frequency information of CPU cluster 1 and CPU cluster 1 respectively. The horizontal and vertical coordinate values of the point (a0, a1) represent the action values taken for the two CPU clusters respectively. The B1 area and the B2 area are located in the first quadrant, the D1 area and the D2 area are located in the third quadrant, and the random area is located in the second and fourth quadrants.
[0274] It can be seen that the horizontal and vertical coordinates of the points included in the D2 area and the D1 area are both smaller than the point (a0, a1), which represents the direction of the action of reducing the CPU cluster; the horizontal and vertical coordinates of the points included in the B1 area and the B2 area are both larger than the point (a0, a1), which represents the direction of the action of increasing the CPU cluster; one of the horizontal and vertical coordinates of the points included in the random area is larger than the point (a0, a1), and the other is smaller than the point (a0, a1), which represents the direction of random exploration.
[0275] Different exploration areas can be determined according to the specific range of the frame loss value. The following takes the frame loss threshold 1 as -2, the frame loss threshold 2 as -1, the super frame threshold 1 as 1, and the super frame threshold 2 as 3 as an example for detailed description:
[0276] If the frame loss value is between [-1, 1], that is, between 1 frame in the superframe and 1 frame loss, it means that action is taken Afterwards, the application has a good frame rate and can determine exploration values in random areas of the action space to perform small random explorations of the offset values.
[0277] If the frame loss value is between (1, 3], it means that the action is taken After that, if the application frame rate is low, that is, the action effect is poor, the exploration value can be determined in the B1 area of the action space to increase the offset value so that the next action taken Will reduce the frame loss value; if the frame loss value is greater than 3, it means that action is taken Afterwards, the application frame rate is very low, that is, the motion effect is very poor, and the exploration value can be determined in the B2 area where the motion increases more.
[0278] Similarly, if the frame loss value is between [-2, -1), it means that the action is taken. After that, the application frame rate is too high, that is, the action effect is poor, and the exploration value can be determined in the D1 area of the action space to reduce the offset value; if the frame loss value is less than -2, it means that the action is adopted Afterwards, the application frame rate is very high, that is, the motion effect is very poor, and the exploration value can be determined in the D2 area where the motion is reduced more.
[0279] Phase 4: Update the offset table based on the exploration value.
[0280] Specifically, the following expression can be used to obtain the exploration value Add to offset table Corresponding position
[0281] ;
[0282] in, and Represent the maximum action and minimum action in the action space respectively, Represents the projection function, which is used to The results are limited to [ , ], that is, to ensure that the offset action also falls within the action space.
[0283] Phase 5: Collect and store relevant data.
[0284] You can repeat phase 2 to phase 4 multiple times, and convert the 4-tuple data ( , , , ) is stored in the offline data set until a sufficient amount of sample data is collected, for example, 500,000 frames of sample data are collected.
[0285] in, Indicates the status information after the CPU cluster is acted upon (after the frequency is set). Represents reward information. The calculation method has been introduced in the previous embodiment and will not be repeated here.
[0286] In this embodiment, when collecting sample data, the load information of multiple CPU clusters is taken into consideration, and multi-dimensional exploration is performed on the offset values in the offset table corresponding to the multiple CPU clusters based on the frame loss value, thereby realizing multi-dimensional action cooperative exploration. In addition, the process of exploring and collecting sample data is standardized, and an offset graph is used to record the exploration direction of the action in a certain state, so that the action taken this time can be explored efficiently and conveniently. In addition, this embodiment has a strong adaptability to the basic model. Through the cumulative exploration of the offset value, as long as the data collection time is long enough, the action can be explored to any reachable action space in theory, reducing the dependence on the quality of the frequency point graph obtained from the basic model.
[0287] It should be noted that the CPU load information involved in the embodiments of the present application can come from a public data set, and the user information involved is information authorized by the user. The acquisition, storage, use, processing, transmission, provision and disclosure of user information are in compliance with relevant laws and regulations and do not violate public order and good morals.
[0288] In a specific implementation, the present application further provides a computer storage medium, wherein the computer storage medium may store a program, wherein when the program is executed, the device where the computer readable storage medium is located is controlled to execute some or all of the steps in the above embodiment. The above storage medium may be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0289] In a specific implementation, an embodiment of the present application further provides a computer program product, which includes executable instructions. When the executable instructions are executed on a terminal, the terminal executes some or all of the steps in the above method embodiment.
[0290] In a specific implementation, an embodiment of the present application further provides a terminal, including: one or more processors and a memory;
[0291] The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the terminal to execute the data collection method provided in the embodiment of the present application.
[0292] like Fig.10 As shown, the present application also provides a chip system, which is applied to a terminal. The chip system includes one or more processors 1001. The processor 1001 is used to call computer instructions so that the terminal inputs the data to be processed into the chip system. The chip system collects data based on the data collection method provided in an embodiment of the present application.
[0293] In a possible implementation, the chip system also includes input and output interfaces for inputting and outputting data.
[0294] The various embodiments of the mechanism disclosed in the present application can be implemented in hardware, software, firmware or a combination of these implementation methods. The embodiments of the present application can be implemented as a computer program or program code executed on a programmable system, which includes at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device and at least one output device.
[0295] Program code may be applied to input instructions to perform the functions described herein and to generate output information. The output information may be applied to one or more output devices in a known manner. For purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0296] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0297] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed over a network or through other computer-readable media. Therefore, a machine-readable medium may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including but not limited to floppy disks, optical disks, optical disks, compact disc read-only memories (Compact Disc Read Only Memory, CD-ROMs), magneto-optical disks, read-only memories, random access memories, erasable programmable read-only memories (Erasable Programmable Read Only Memory, EPROM), electrically erasable programmable read-only memories (Electrically Erasable Programmable Read Only Memory, EEPROM), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Accordingly, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a form readable by a machine (eg, a computer).
[0298] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings of the specification. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0299] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0300] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0301] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.
Claims
1. A data collection method, characterized in that: Applied to a terminal, the terminal having a first application installed therein, the method comprising: Obtaining a first frame rate of a first program interface displayed on the terminal and first load information of a CPU cluster in the terminal, wherein the first program interface is: a running interface of the first application program; Based on the first load information and the first frame rate, determine the initial frequency information of the CPU cluster, and determine a first offset value of the initial frequency information from a first corresponding relationship, wherein the first corresponding relationship is: a corresponding relationship between the load information of the CPU cluster, the frame rate of the terminal display program interface, and the offset value; Using the first offset value to offset the initial frequency information to obtain offset frequency information; Setting the operating frequency of the CPU cluster based on the offset frequency information, and obtaining a second frame rate at which the terminal displays the first program interface after the set frequency; Based on the set target frame rate and the second frame rate, updating the first offset value recorded in the first corresponding relationship; Constructing sample data including the first load information, the first frame rate, the second frame rate and the offset frequency information; The updating of the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes: Calculating a frame rate difference between a set target frame rate and the second frame rate; Based on the frame rate difference, determining an adjustment direction; Based on the frame rate difference, determining an adjustment amount along the adjustment direction; The first offset value recorded in the first corresponding relationship is updated according to the determined adjustment direction and adjustment amount.
2. The method according to claim 1, characterized in that The determining the adjustment direction based on the frame rate difference includes: If the frame rate difference is greater than the first frame loss threshold, determining the adjustment direction is: increasing the direction of the frequency information of the CPU cluster; and / or, If the frame rate difference is less than a first superframe threshold, the adjustment direction is determined to be: a direction of reducing the frequency information of the CPU cluster, wherein the first superframe threshold is less than the first frame loss threshold.
3. The method according to claim 1, characterized in that If the number of the CPU clusters is greater than 1, determining the adjustment direction based on the frame rate difference includes: If the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, the adjustment direction is determined to be: increasing the frequency information of at least one CPU cluster and decreasing the frequency information of the remaining CPU clusters.
4. The method according to claim 1, characterized in that The determining, based on the frame rate difference, an adjustment amount along the adjustment direction includes: If the frame rate difference is greater than the second frame loss threshold, determining an adjustment amount along the adjustment direction from within the first adjustment interval; and / or, If the frame rate difference is less than or equal to the second frame loss threshold and greater than the first frame loss threshold, determining the adjustment amount from a second adjustment interval, wherein the value included in the second adjustment interval is less than the value included in the first adjustment interval; and / or, If the frame rate difference is less than or equal to the first frame loss threshold and greater than or equal to the first superframe threshold, determining the adjustment amount from a third adjustment interval; and / or, If the frame rate difference is less than the first superframe threshold and greater than or equal to the second superframe threshold, determining the adjustment amount from a fourth adjustment interval; and / or, If the frame rate difference is less than the second superframe threshold, the adjustment amount is determined from a fifth adjustment interval, wherein the value included in the fourth adjustment interval is less than the value included in the fifth adjustment interval.
5. The method according to claim 4, characterized in that The value included in the third adjustment interval is smaller than the value included in the first adjustment interval; and / or, The numerical value included in the third adjustment interval is smaller than the numerical value included in the fifth adjustment interval.
6. The method according to claim 1, characterized in that The first corresponding relationship is a corresponding relationship between the load information of the CPU cluster, the load information of the application program, the frame rate of the terminal display program interface, and the offset value. The initial frequency information of the CPU cluster is determined based on the first load information and the first frame rate, and the first offset value of the initial frequency information is determined from the first corresponding relationship, including: Obtaining second load information of the first application, wherein the second load information is obtained based on a proportion of resources consumed by the threads of the first application running on the CPU cores included in the CPU cluster in the total resources of the CPU cores; Based on the first load information, the second load information, and the first frame rate, initial frequency information of the CPU cluster is determined, and a first offset value of the initial frequency information is determined from a first corresponding relationship.
7. The method according to claim 6, characterized in that The determining the initial frequency information of the CPU cluster based on the first load information, the second load information, and the first frame rate includes: Determine a first information interval to which the first load information belongs from a plurality of pre-divided CPU load information intervals, determine a second information interval to which the second load information belongs from a plurality of pre-divided application load information intervals, and determine a first frame rate interval to which the first frame rate belongs from a plurality of pre-divided frame rate intervals; From a three-dimensional frequency matrix, determine the values located at the first number of rows, the second number of columns, and the third number of layers as the initial frequency information of the CPU cluster, wherein the first number is: the interval number of the first information interval in all CPU load information intervals, the second number is: the interval number of the first frame rate interval in all frame rate intervals, and the third number is: the interval number of the second information interval in all application load information intervals.
8. The method according to claim 7, characterized in that The determining a first offset value of the initial frequency information from the first corresponding relationship includes: Determine, from a three-dimensional offset value matrix, values located at the first number of rows, the second number of columns, and the third number of layers as first offset values of the initial frequency information, wherein the offset value matrix has the same size as the frequency matrix; The updating of the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes: Based on the set target frame rate and the second frame rate, the values of a first number of rows, a second number of columns, and a third number of layers in the offset value matrix are updated.
9. The method according to any one of claims 1 to 8, characterized in that If the number of CPU clusters is greater than 1, The determining, based on the first load information and the first frame rate, the initial frequency information of the CPU cluster, and determining a first offset value of the initial frequency information from a first corresponding relationship, includes: For each CPU cluster, determining initial frequency information of the CPU cluster according to first load information of the CPU cluster and the first frame rate, and determining a first offset value of the initial frequency information of the CPU cluster from a first corresponding relationship set for the CPU cluster; The updating of the first offset value recorded in the first corresponding relationship based on the set target frame rate and the second frame rate includes: For each CPU cluster, based on the set target frame rate and the second frame rate, the first load information of the CPU cluster and the first offset value corresponding to the first frame rate recorded in the first corresponding relationship set for the CPU cluster are updated.
10. The method according to any one of claims 1 to 8, characterized in that The constructing of sample data including the first load information, the first frame rate, the second frame rate and the offset frequency information includes: Determine whether a frame rate difference between a set target frame rate and the second frame rate is greater than a set threshold; If yes, then based on the frame rate difference, reward information is calculated, the reward information reflecting: the excellence of the effect produced after the operating frequency of the CPU cluster is set based on the second frame rate information; otherwise, calculating the reward information based on the offset frequency information; Construct sample data including the first load information, the first frame rate, the second frame rate, the offset frequency information and the reward information.
11. A terminal, characterized in that: include: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, where the computer program codes include computer instructions. The one or more processors call the computer instructions to enable the terminal to execute the method according to any one of claims 1 to 10.
12. A computer-readable storage medium, characterized in that: The method comprises a computer program, and when the computer program is run on a terminal, the terminal is caused to execute the method according to any one of claims 1 to 10.
13. A computer program product, characterized in that The computer program product comprises executable instructions, and when the executable instructions are executed on a terminal, the terminal is caused to execute the method according to any one of claims 1 to 10.
14. A chip system, characterized in that: The chip system is applied to a terminal, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the terminal inputs data into the chip system and executes the method described in any one of claims 1 to 10 to collect data.
Citation Information
Patent Citations
Frequency modulation method, training method of frequency modulation neural network and electronic equipment
CN117130769A
Data acquisition method, training method and electronic equipment
CN117687495A