Frequency modulation method and device, electronic equipment and computer storage medium

By obtaining the arrival timestamp when the thread of the processing unit receives the task, and determining the load data at the time after the target time offset to adjust the frequency, the problem of low frequency regulation efficiency in the prior art is solved, and more efficient frequency is achieved adjust.

CN119473573APending Publication Date: 2025-02-18GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411444394.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The frequency modulation method of the existing processing units is based on fixed event points, resulting in untimely sampling, lack of flexibility, and low frequency modulation efficiency.

Method used

By obtaining the arrival timestamp when the thread of the processing unit receives the task, the load data is determined at the time after the target time offset, and the frequency of the processing unit is adjusted according to the load data.

Benefits of technology

It realizes that the frequency regulation of the processing unit is more timely and flexible, and the frequency regulation efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473573A_ABST
    Figure CN119473573A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a frequency modulation method, which comprises the steps of determining an arrival timestamp of a first task under the condition that a thread executed by a processing unit receives the first task, and determining load data of the processing unit under the condition that the first task is being executed at a moment corresponding to a target time offset after the arrival timestamp, and adjusting the frequency of the processing unit according to the load data. The embodiment of the invention also provides a frequency modulation device, electronic equipment and a computer storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a frequency modulation technology of a processing unit, and in particular to a frequency modulation method, device, electronic device and computer storage medium. Background Art

[0002] The frequency modulation method for the processing unit is usually based on fixed event points. However, this method has factors such as untimely sampling and lack of sampling flexibility, which leads to low frequency modulation efficiency. Summary of the invention

[0003] The embodiments of the present application provide a frequency modulation method, device, electronic device and computer storage medium, which can improve the frequency modulation efficiency of a processing unit.

[0004] The technical solution of this application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a frequency modulation method, comprising:

[0006] When the thread executed by the processing unit receives the first task, obtaining an arrival timestamp of the first task;

[0007] determining load data of the processing unit in the case where the first task is being executed at a time corresponding to the target time offset after the arrival timestamp;

[0008] Based on the load data, the frequency of the processing unit is adjusted.

[0009] In a second aspect, an embodiment of the present application provides a frequency modulation device, including:

[0010] an acquisition module, configured to acquire an arrival timestamp of the first task when the thread executed by the processing unit receives the first task;

[0011] A determination module, for determining the load data of the processing unit when the first task is being executed at a time corresponding to the target time offset after the arrival timestamp;

[0012] The frequency modulation module is used to adjust the frequency of the processing unit according to the load data.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a storage medium storing instructions executable by the processor; the storage medium relies on the processor to perform operations through a communication bus, and when the instructions are executed by the processor, the frequency modulation method described in one or more of the above embodiments is executed.

[0014] In a fourth aspect, an embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the frequency modulation method described in one or more of the above embodiments.

[0015] The embodiments of the present application provide a frequency modulation method, device, electronic device and computer storage medium. When a thread executed by a processing unit receives a first task, the arrival timestamp of the first task is determined. When the first task is being executed at a time corresponding to a target time offset after the arrival timestamp, the load data of the processing unit is determined, and the frequency of the processing unit is adjusted according to the load data. That is, in the embodiments of the present application, when the first task received by the thread of the processing unit is being executed at a time corresponding to a target time offset after the arrival timestamp, the frequency of the processing unit is adjusted according to the load data of the processing unit. In this way, by judging whether the received first task is executed within the target time offset, the frequency modulation of the processing unit is more timely and flexible, thereby improving the frequency modulation efficiency of the processing unit. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A flowchart of an optional frequency modulation method provided in an embodiment of the present application;

[0017] Figure 2 A flowchart of an example of an optional frequency modulation method provided in an embodiment of the present application;

[0018] Figure 3 A schematic diagram of a queue of tasks received in an optional frequency modulation method provided in an embodiment of the present application;

[0019] Figure 4 A schematic diagram of the structure of an optional frequency modulation device provided in an embodiment of the present application;

[0020] Figure 5 A schematic diagram of the structure of an optional electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0021] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0022] At present, the frequency modulation method for processing units is usually based on fixed event points, where these event points can be fixed time interval sampling, mainly sampling the frequency of the processing unit within a preset time interval, and adjusting the frequency of the processing unit according to the sampling results. These event points can also be load prediction frequency modulation, mainly predicting future load conditions based on historical load data and adjusting the frequency of the processing unit in advance. These event points can also be fixed template frequency modulation, mainly based on the predefined relationship between load and frequency to perform frequency modulation on the processing unit.

[0023] Among them, the above-mentioned fixed time interval sampling has the problem of untimely sampling, which may miss the critical load change opportunity, resulting in a delayed response. The above-mentioned load prediction frequency modulation relies on historical data, which may have prediction errors and cannot cope with sudden load changes, resulting in inaccurate predictions. The above-mentioned fixed template frequency modulation method is difficult to adapt to dynamically changing task requirements, resulting in low frequency modulation efficiency. It can be seen that event-driven sampling relies on fixed event points, has limited coverage, and cannot cope with all task situations, resulting in insufficient flexibility, which in turn affects the frequency modulation efficiency of the processing unit.

[0024] In view of the technical problem of low frequency modulation efficiency of the processing unit, the embodiment of the present application provides a frequency modulation method. Figure 1 A flow chart of an optional frequency modulation method provided in an embodiment of the present application is shown as follows: Figure 1 As shown, the frequency modulation method may include:

[0025] S101: When a thread executed by a processing unit receives a first task, obtaining an arrival timestamp of the first task;

[0026] The frequency modulation method of the embodiment of the present application may be executed by the processing unit itself, or may be executed by a device or equipment other than the processing unit. Here, the embodiment of the present application does not make any specific limitation on this.

[0027] For a processing unit, the threads being executed by the processing unit may include one, two, or more than two threads. Here, the threads executed by the processing unit may be any one or more threads or specific one or more threads among the threads being executed by the processing unit. Here, the embodiments of the present application do not make specific limitations on this.

[0028] In S101, when the thread executed by the processing unit receives the first task, the arrival timestamp of the received first task is obtained, wherein when the thread executed by the processing unit receives the first task, the receiving time of the received first task is determined, that is, the arrival timestamp of the received first task.

[0029] Among them, the first task received above can be a task of data processing type, such as reading and writing files, querying or updating data from a database, calculating or analyzing a large amount of data, converting or formatting data, etc. The task received above can also be a task of network operation type, such as listening to network ports, receiving client connections, sending and receiving network data packets, processing client requests and implementing network communication protocols, etc. The task received above can also be a user interface update, such as updating components in a graphical interface, responding to user input and drawing graphics or animations, etc. The task received above can also be a background type task, such as executing scheduled tasks, monitoring application or system performance, asynchronous processing tasks, etc. The task received above can also be a task of concurrency control type, such as managing synchronization and mutual exclusion between multiple threads or processes, and implementing concurrent algorithms. The task received above can also be a task of system call and hardware interaction type, such as executing system calls, interacting with hardware devices, etc. The task received above can also be a task of service request processing type, such as processing client requests in server applications and executing service calls in microservice architectures, etc. The received tasks may also be simulation and emulation tasks, for example, simulation of physical, chemical, biological processes, and the like, and implementation of scenes and interactions in virtual reality or augmented reality, etc. Here, the embodiments of the present application do not specifically limit this.

[0030] In this way, the arrival timestamp of the first task received in the thread executed by the processing unit can be obtained.

[0031] S102: determining load data of a processing unit when the first task is being executed at a time corresponding to a target time offset after the arrival timestamp;

[0032] Through the above S101, the arrival timestamp of the first task received in the thread executed by the processing unit can be known. In S102, it is necessary to judge whether the first task is being executed at the moment corresponding to the target time offset after the arrival timestamp. Here, when the first task is received in the thread executed by the processing unit, in addition to determining the arrival timestamp of the first task, a timer is also created, and the timing duration of the created timer is the target time offset.

[0033] It should be noted that the above-mentioned target time offset can be a pre-set value, or a value determined according to specific data. For example, the target time offset can be determined according to the execution status of the above-mentioned frequency modulation method, or the target time offset can be determined according to the execution time of the task in the historical data. Here, the embodiment of the present application does not make any specific limitations on this.

[0034] After judgment, if it is determined that the first task is still being executed at the time corresponding to the target time offset after the arrival timestamp, it means that the processing unit has not completed the first task within the target time offset at this time, then the load data of the processing unit is started to be determined. If it is determined that the first task is completed within the target time offset after the arrival timestamp, the load data of the processing unit is not started to be determined.

[0035] That is to say, whether to start determining the load data of the processing unit is determined by whether the processing unit completes the first task within the target time offset, thereby triggering the frequency modulation of the processing unit.

[0036] S103: Adjust the frequency of the processing unit according to the load data.

[0037] By determining the load data of the processing unit in S102 when the first task is being executed at the time corresponding to the target time offset after the arrival timestamp, the load data of the processing unit is obtained. In S103, the frequency of the processing unit can be adjusted according to the load data.

[0038] Among them, the load data of the above-mentioned processing unit can be the real-time load data of the processing unit, or it can be the normalized data of the real-time load data of the processing unit and the task execution time of the processing unit. Here, the embodiment of the present application does not make specific limitations on this.

[0039] In order to adjust the frequency of the processing unit according to the load data, in an embodiment of the present application, the frequency corresponding to the load data can be determined based on a preset mapping relationship, thereby realizing the frequency modulation of the processing unit. The load data can also be judged to determine whether the load data reaches a threshold that requires frequency modulation. Only when the threshold of frequency modulation is reached, the frequency of the processing unit is modulated. Otherwise, the frequency of the processing unit is maintained unchanged.

[0040] In this way, the frequency modulation of the processing unit can be triggered by determining whether the first task is being executed at the time corresponding to the target time offset after the arrival timestamp.

[0041] For the above-mentioned processing unit, in an optional embodiment, the processing unit includes one or more of the following: a central processing unit (CPU), a graphics processing unit (GPU) and a neural processing unit (NPU).

[0042] It is understandable that the processing unit may be one or more of a CPU, a GPU and an NPU. Thus, the frequency of the CPU may be adjusted by the frequency modulation method, or the frequency of the GPU may be adjusted by the frequency modulation method, or the frequency of the NPU may be adjusted by the frequency modulation method.

[0043] In this way, the frequency of one or more of the CPU, GPU and NPU is adjusted, thereby improving the frequency modulation efficiency of the CPU, GPU and NPU.

[0044] In addition, in order to timely implement frequency modulation of the processing unit, in an optional embodiment, the above method may further include:

[0045] When the first task is completed within the target time offset after the arrival timestamp and the thread executed by the processing unit receives the second task, the arrival timestamp of the second task is obtained.

[0046] It can be understood that, in addition to the above-mentioned situation S102, there is also a situation where the first task is executed within the target time offset after the arrival timestamp, that is, the first task is executed within the target time offset after the arrival timestamp, which means that the frequency of the processing unit is suitable for the task currently executed by the processing unit. Therefore, the load data of the processing unit is not started, but the new task in the thread executed by the processing unit is continuously monitored to see whether the thread executed by the processing unit receives the second task. If so, it is similar to the frequency modulation method for the first task and will not be repeated here.

[0047] In this way, by monitoring the task processing status on the thread executed by the processing unit in real time, and determining whether to trigger the adjustment of the frequency of the processing unit based on the processing status, that is, triggering the adjustment of the frequency of the processing unit according to the actual processing of the received tasks by the processing unit, the frequency modulation efficiency can be improved.

[0048] Furthermore, in order to improve frequency modulation efficiency and reduce power consumption, in an optional embodiment, the method may further include:

[0049] When the first task is completed beyond the target time offset after the arrival timestamp and the thread executed by the processing unit receives the second task, the arrival timestamp of the second task is obtained.

[0050] It can be understood that the above-mentioned first task is being executed at the moment corresponding to the target time offset after the arrival timestamp, but the first task is completed when the target time offset is exceeded. At this time, in order to prevent the load data of the processing unit from being continuously determined, here, when the first task is completed beyond the target time offset after the arrival timestamp, the new task in the thread executed by the processing unit is monitored to see whether the thread executed by the processing unit receives the second task. If so, it is similar to the frequency modulation method for the first task and will not be repeated here.

[0051] In this way, the first task is completed beyond the target time offset, and the new task in the thread executed by the processing unit is monitored in time to prevent the high power consumption caused by constantly determining the load data of the processing unit, thereby achieving the goal of reducing power consumption while improving the frequency modulation efficiency of the processing unit.

[0052] In addition, in order to further improve the frequency modulation efficiency of the processing unit, in an optional embodiment, S101 may include:

[0053] When a main thread in a main process executed by a processing unit receives a first task, an arrival timestamp of the first task is obtained.

[0054] It can be understood that in response to the situation in which the thread executed by the processing unit in the above S101 receives the first task, the main thread in the main process executed by the processing unit can be determined as the thread executed by the processing unit. Here, the main process can be one, two or more, and the main thread can also be one, two or more. Then, one or more processes can be selected from the main process in advance, and one or more threads can be selected from the main thread of the selected process. When the selected thread executed by the processing unit receives the first task, the arrival timestamp of the first task is obtained.

[0055] In this way, by monitoring the main thread in the main process executed by the processing unit, the arrival timestamp of the first task is determined only when it receives the first task, so that the frequency modulation trigger of the processing unit is more accurate, thereby improving the frequency modulation efficiency of the processing unit.

[0056] In order to further reduce power consumption while achieving frequency modulation of the processing unit, in an optional embodiment, S102 may include:

[0057] When the first task is being executed at a time corresponding to a target time offset after the arrival timestamp, the load data of the processing unit is collected and determined according to a preset sampling frequency until the first task is completed beyond the target time offset after the arrival timestamp.

[0058] It can be understood that in order to determine the load data of the processing unit, in the case where the first task is being executed at the moment corresponding to the target time offset after the arrival timestamp, the load data of the processing unit can be collected and determined according to the preset sampling frequency until the first task is completed beyond the target time offset after the arrival timestamp.

[0059] That is, when the received first task is being executed at the time corresponding to the target time offset after the arrival timestamp, the preset sampling frequency is used, wherein the preset sampling frequency is greater than or equal to the preset threshold, for example, the preset threshold may be 500 times per second. The higher the preset sampling frequency is set, the higher the frequency modulation efficiency of the processing unit is.

[0060] For example, the preset sampling frequency is set to 500 times per second or 1000 times per second. Taking the preset sampling frequency as 500 times per second as an example, the data of the processing unit is collected every 2ms, so as to determine a load data of the processing unit. Here, each time a load data of the processing unit is determined, the frequency of the processing unit is adjusted according to the load data. In this way, the data of the processing unit is collected every 2ms until the first task is executed and completed beyond the target time offset after the arrival timestamp.

[0061] It can be seen that when the first task is not completed within the target time offset after arriving at the timestamp, the data of the processing unit is collected once according to the preset sampling frequency. After the load data of the processing unit is determined, before the next sampling, it is necessary to determine whether the first task is completed. If so, no more collection is performed. Otherwise, collection continues according to the preset sampling frequency.

[0062] Among them, the above-mentioned preset sampling frequency can be set according to the execution status of the above-mentioned frequency modulation method, and can also be dynamically adjusted according to the operation data of the processing unit. Here, the embodiment of the present application does not make specific limitations on this.

[0063] In this way, by setting a preset sampling frequency, high-frequency sampling of the data of the processing unit can be achieved, and the load condition of the processing unit can be known as much as possible. Then, based on the load condition, the frequency of the processing unit can be modulated in accordance with the load condition, and the collection is stopped after the first task is completed. In this way, the frequency modulation efficiency of the processing unit is improved while the power consumption of invalid collection of the processing unit is prevented.

[0064] In order to determine the load data of the processing unit, in an optional embodiment, collecting and determining the load data of the processing unit according to a preset sampling frequency may include:

[0065] Collect real-time load data, task execution time and resource usage information of processing units according to the preset sampling frequency;

[0066] According to the real-time load data, task execution time and resource usage information collected each time, a load data of the processing unit is determined.

[0067] It can be understood that the real-time load data, task execution time, resource usage and other operation data of the processing unit are collected according to the preset sampling frequency, and the load data of the processing unit is determined according to the operation data collected each time.

[0068] In order to determine a load data of the processing unit according to the operation data collected each time, the operation data collected each time can be normalized, and then weighted summed, so as to obtain the load data of the processing unit corresponding to the operation data collected each time. The load data of the processing unit is adjusted based on the load data of the processing unit corresponding to the operation data collected each time.

[0069] In this way, a load data of the processing unit is determined by the operating data of the processing unit collected each time, so that the frequency of the processing unit can be adjusted based on the load data of the processing unit. The actual operating status of the processing unit is obtained by integrating the operating data, which provides a reliable data basis for adjusting the frequency of the processing unit and is beneficial to improving the frequency modulation efficiency of the processing unit.

[0070] In order to adjust the frequency of the processing unit according to the load data, in an optional embodiment, S103 may include:

[0071] When the load data is greater than the preset load data, the frequency of the processing unit is adjusted according to the load data.

[0072] It can be understood that after determining the load data of the processing unit, the frequency of the processing unit can be adjusted according to the load data. Here, in order to further improve the frequency modulation efficiency of the processing unit, it is necessary to compare the load data with the preset load data. If it is greater than, it means that the load of the processing unit is large at this time, so it is necessary to adjust the frequency of the processing unit to adapt to the load at this time, that is, adjust the frequency of the processing unit according to the load data.

[0073] In this way, by comparing the load data with the preset load data, it is determined whether to adjust the frequency of the processing unit based on the comparison result, so that the processing unit can adjust the frequency of the processing unit according to its own load condition to adapt to the current load requirements.

[0074] In addition to the case where the load data is greater than the preset load data, in an optional embodiment, the method may further include:

[0075] When the load data is less than the preset load data and the thread executed by the processing unit receives the second task, an arrival timestamp of the second task is obtained.

[0076] It can be understood that after comparing the load data with the preset load data, when the load data is less than the preset load data, the new task in the thread executed by the processing unit continues to be monitored to see whether the thread executed by the processing unit receives the second task. If so, it is similar to the frequency modulation method for the first task and will not be repeated here.

[0077] That is to say, when the load data is less than the preset load data, it means that the load of the processing unit is small at this time, so the frequency of the current processing unit can adapt to the current load situation, and there is no need to adjust the frequency of the processing unit, that is, continue to monitor whether there is a situation where the thread executed by the processing unit receives the second task.

[0078] In this way, by comparing the load data with the preset load data and determining whether to adjust the frequency of the processing unit based on the comparison result, the processing unit can determine to maintain the frequency of the processing unit according to its own load conditions, thereby preventing power consumption caused by unnecessary frequency adjustment.

[0079] It should be noted that when the load data is equal to the preset load data, the frequency of the processing unit can be adjusted according to the load data, or it can continue to monitor whether the thread executed by the processing unit receives the second task. Here, the embodiment of the present application does not make specific limitations on this.

[0080] In order to adjust the frequency of the processing unit according to the load data, in an optional embodiment, S103 may include:

[0081] Determine the frequency corresponding to the load data;

[0082] The frequency of the processing unit is adjusted to the frequency corresponding to the load data.

[0083] It can be understood that after the load data of the processing unit is determined, since a preset mapping relationship is stored in the processing unit, the frequency corresponding to the load data can be determined based on the mapping relationship, and then the frequency of the processing unit can be adjusted to the frequency corresponding to the load data.

[0084] Among them, after determining the frequency corresponding to the load data, the frequency corresponding to the load data can also be compared with the current frequency of the processing unit. If they are the same, the frequency of the processing unit is maintained unchanged. If they are different, the frequency of the processing unit is adjusted to the frequency corresponding to the load data.

[0085] In this way, the frequency of the processing unit is adjusted to the corresponding frequency by determining the frequency corresponding to the load data, thereby achieving adjustment of the frequency of the processing unit and improving the frequency modulation efficiency of the processing unit.

[0086] The frequency modulation method described in one or more of the above embodiments is described below with examples.

[0087] Taking the processing unit as CPU as an example, Figure 2 A flow chart of an example of an optional frequency modulation method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the frequency modulation method may include:

[0088] S201: Task achievement detection;

[0089] When a key thread (eg, main thread) in the main process receives a new task, the arrival timestamp of the new task is first detected. For each new task, its arrival timestamp is recorded.

[0090] Specifically, when a new task is received, a timer is created, that is, a timer is created when a new task is inserted, wherein the duration of the timer is an offset offset (equivalent to the above-mentioned target time offset).

[0091] S202: Determine whether the task is completed within the offset. If yes, execute S201; if no, execute S203;

[0092] Figure 3 A schematic diagram of a queue of tasks received in an optional frequency modulation method provided in an embodiment of the present application, such as Figure 3 As shown, there are Task 1, Task 2 and Task 3 in the user interface thread in sequence, and the circle filled with slashes above each task from the first circle on the left to the right to the time when the task is received represents the offset.

[0093] In S202, it is necessary to further determine whether the new task is executed within the offset after the arrival timestamp. If yes, execute S201 and cancel the timer created for the new task. If no, execute S203.

[0094] The above offset is an adjustable parameter.

[0095] S203: high frequency sampling;

[0096] Here, in order to achieve high-frequency sampling, it is necessary to start the high-frequency sampler. After starting the high-frequency sampler, sampling is performed according to the sampling interval (equivalent to the above-mentioned preset sampling frequency). The high-frequency sampler will collect key information such as the real-time load data of the CPU, task execution time, resource usage, etc. These key information are normalized to obtain the CPU load data.

[0097] The sampling interval can be adjusted dynamically according to the system load to ensure the timeliness and accuracy of the data. The sampling interval can be adjusted, but it is generally high frequency, such as sampling once every 2ms.

[0098] S204: analyzing sampling data;

[0099] Here, the collected high-frequency sampling data is input into the CPU frequency scheduler. The scheduler analyzes the current system load based on the real-time sampling data and determines whether the CPU frequency needs to be adjusted. If adjustment is required, a frequency adjustment instruction is issued. In practice, it can be input into other devices, such as GPU, NPU, etc., which need to obtain system information before making frequency adjustment decisions.

[0100] The frequency adjustment here is based on a mapping relationship, and the mapping relationship may be a linear mapping relationship or a nonlinear mapping relationship.

[0101] S205: frequency scheduling;

[0102] After receiving the frequency adjustment instruction, the CPU frequency scheduler dynamically adjusts the CPU frequency according to the task load. The adjusted frequency information is fed back to the system to ensure that the task is executed at the optimal frequency, improving the system response speed and energy efficiency.

[0103] S206: Sampling stops;

[0104] When the task is completed or the task execution is completed outside the offset, the high-frequency sampler is stopped. At this time, the system returns to normal state and waits for the arrival of the next task.

[0105] S207: parameter adjustment;

[0106] In implementation, parameters such as offset and sampling interval can be dynamically adjusted according to task execution results and system feedback to optimize the overall system performance.

[0107] This example is not limited to the main thread and can be extended to task frequency scheduling in a multi-threaded environment.

[0108] In this example, a high-frequency sampling mechanism is used: high-frequency sampling is started after the task exceeds the preset offset, accurately capturing load changes and improving the frequency modulation response speed. Real-time data analysis is used: CPU frequency scheduling is performed using real-time sampling data to avoid traditional prediction errors and improve frequency modulation accuracy. Task-triggered frequency modulation is used: frequency modulation is performed based on task arrival time and offset, with a wider coverage, solving the limitations of frequency modulation at fixed event points.

[0109] In summary, this example can capture task load changes more quickly through high-frequency sampling, achieve fast frequency modulation, and improve system response speed. When the task is completed quickly, unnecessary high-frequency sampling is avoided to reduce system power consumption. Frequency modulation based on real-time sampling data avoids prediction errors and improves the accuracy of frequency modulation. Dynamically adjust the offset and sampling interval to optimize system performance and enhance system stability.

[0110] An embodiment of the present application provides a frequency modulation method, which determines the arrival timestamp of the first task when a thread executed by a processing unit receives the first task, determines the load data of the processing unit when the first task is being executed at a moment corresponding to a target time offset after the arrival timestamp, and adjusts the frequency of the processing unit according to the load data; that is, in an embodiment of the present application, the frequency of the processing unit is adjusted by the load data of the processing unit when the first task received by the thread of the processing unit is being executed at a moment corresponding to the target time offset after the arrival timestamp through the target time offset, and thus, by judging whether the received first task is executed within the target time offset, the frequency modulation of the processing unit is made more timely and flexible, thereby improving the frequency modulation efficiency of the processing unit.

[0111] Based on the same inventive concept as the above-mentioned embodiments, the present application embodiment provides a frequency modulation device, Figure 4 A schematic diagram of the structure of an optional frequency modulation device provided in an embodiment of the present application, such as Figure 4 As shown, the frequency modulation device includes: an acquisition module 41, a determination module 42 and a frequency modulation module 43; wherein,

[0112] An acquisition module 41, configured to acquire an arrival timestamp of the first task when the thread executed by the processing unit receives the first task;

[0113] A determination module 42, configured to determine the load data of the processing unit when the first task is being executed at a time corresponding to the target time offset after the arrival timestamp;

[0114] The frequency modulation module 43 is used to adjust the frequency of the processing unit according to the load data.

[0115] In an optional embodiment, the above device is further used for:

[0116] When the first task is completed within the target time offset after the arrival timestamp and the thread executed by the processing unit receives the second task, the arrival timestamp of the second task is obtained.

[0117] In an optional embodiment, the above-mentioned device is also used to: when the second task is completed beyond the target time offset after the arrival timestamp and the thread executed by the processing unit receives the second task, obtain the arrival timestamp of the second task.

[0118] In an optional embodiment, the acquisition module 41 is specifically used to: when the main thread in the main process executed by the processing unit receives the first task, acquire the arrival timestamp of the first task.

[0119] In an optional embodiment, the acquisition module 41 is specifically used to: when the first task is being executed at a moment corresponding to the target time offset after the arrival timestamp, collect and determine the load data of the processing unit according to a preset sampling frequency until the first task is completed beyond the target time offset after the arrival timestamp.

[0120] In an optional embodiment, the acquisition module 41 collects and determines the load data of the processing unit according to a preset sampling frequency, including: collecting real-time load data, task execution time and resource usage information of the processing unit according to the preset sampling frequency; determining a load data of the processing unit based on the real-time load data, task execution time and resource usage information collected each time.

[0121] In an optional embodiment, the frequency modulation module 43 is specifically used to adjust the frequency of the processing unit according to the load data when the load data is greater than the preset load data.

[0122] In an optional embodiment, the above-mentioned device is also used to: when the load data is less than the preset load data and the thread executed by the processing unit receives the second task, obtain the arrival timestamp of the second task.

[0123] In an optional embodiment, the frequency modulation module 43 is specifically used to: determine the frequency corresponding to the load data; and adjust the frequency of the processing unit to the frequency corresponding to the load data.

[0124] In an optional embodiment, the processing unit includes one or more of the following: a CPU, a GPU, and an NPU.

[0125] In practical applications, the acquisition module 41, determination module 42 and frequency modulation module 43 can be implemented by a processor located on the frequency modulation device, specifically a CPU, a microprocessor (Microprocessor Unit, MPU), a digital signal processor (Digital Signal Processing, DSP) or a field programmable gate array (Field Programmable Gate Array, FPGA) and the like.

[0126] Figure 5 A schematic diagram of the structure of an optional electronic device provided in an embodiment of the present application, such as Figure 5 As shown, an embodiment of the present application provides an electronic device 500, including:

[0127] A processor 51 and a storage medium 52 storing instructions executable by the processor; the storage medium 52 relies on the processor 51 to perform operations through a communication bus 53, and when the instructions are executed by the processor, the frequency modulation method executed by the processor side in one or more of the above embodiments is executed.

[0128] It should be noted that, in actual application, the various components in the computer device are coupled together via the communication bus 53. It is understandable that the communication bus 53 is used to realize the connection and communication between these components. In addition to the data bus, the communication bus 53 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as communication buses 53.

[0129] An embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the frequency modulation method described in one or more of the above embodiments.

[0130] Among them, the computer-readable storage medium can be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0131] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0132] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0133] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0134] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0135] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A frequency modulation method, characterized in that: include: When a thread executed by a processing unit receives a first task, obtaining an arrival timestamp of the first task; determining load data of the processing unit in the case where the first task is being executed at a time corresponding to a target time offset after the arrival timestamp; The frequency of the processing unit is adjusted according to the load data.

2. The method according to claim 1, characterized in that The method further comprises: When the first task is completed within the target time offset after the arrival timestamp and the thread executed by the processing unit receives the second task, the arrival timestamp of the second task is obtained.

3. The method according to claim 1, characterized in that The method further comprises: When the first task is completed beyond the target time offset after the arrival timestamp and the thread executed by the processing unit receives a second task, the arrival timestamp of the second task is obtained.

4. The method according to claim 1, characterized in that: When the thread executed by the processing unit receives the first task, obtaining the arrival timestamp of the first task includes: When a main thread in a main process executed by the processing unit receives a first task, an arrival timestamp of the first task is obtained.

5. The method according to claim 1, characterized in that The determining the load data of the processing unit when the first task is being executed at a time corresponding to a target time offset after the arrival timestamp includes: When the first task is being executed at a time corresponding to a target time offset after the arrival timestamp, the load data of the processing unit is collected and determined according to a preset sampling frequency until the first task is completed beyond the target time offset after the arrival timestamp.

6. The method according to claim 5, characterized in that The collecting and determining the load data of the processing unit according to the preset sampling frequency includes: Collecting the real-time load data, task execution time and resource usage information of the processing unit according to a preset sampling frequency; wherein the preset sampling frequency is greater than or equal to a preset threshold; According to the real-time load data, task execution time and resource usage information collected each time, load data of the processing unit is determined.

7. The method according to any one of claims 1 to 6, characterized in that: The adjusting the frequency of the processing unit according to the load data includes: When the load data is greater than preset load data, the frequency of the processing unit is adjusted according to the load data.

8. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: When the load data is less than the preset load data and the thread executed by the processing unit receives the second task, an arrival timestamp of the second task is obtained.

9. The method according to any one of claims 1 to 6, characterized in that: The adjusting the frequency of the processing unit according to the load data includes: Determining a frequency corresponding to the load data; The frequency of the processing unit is adjusted to a frequency corresponding to the load data.

10. The method according to any one of claims 1 to 6, characterized in that: The processing unit includes one or more of the following: CPU, GPU and NPU.

11. A frequency modulation device, characterized in that: include: an acquisition module, configured to acquire an arrival timestamp of a first task when a thread executed by a processing unit receives the first task; a determination module, configured to determine the load data of the processing unit when the first task is being executed at a time corresponding to a target time offset after the arrival timestamp; A frequency modulation module is used to adjust the frequency of the processing unit according to the load data.

12. An electronic device, characterized in that: include: A processor and a storage medium storing instructions executable by the processor; The storage medium relies on the processor to perform operations through a communication bus, and when the instructions are executed by the processor, the frequency modulation method described in any one of claims 1 to 10 is executed.

13. A computer storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed by one or more processors, the processors execute the frequency modulation method according to any one of claims 1 to 10.