Frequency adjustment method, electronic equipment and storage medium
By periodically obtaining processor performance data and equipment operation information, and triggering frequency regulation according to equipment operation, solving the problem of lag in the frequency adjustment process in the existing technology, realizing dynamic frequency supply, and improving system performance and power consumption performance.
Patent Information
- Application Number
- CN202311292241.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2043-09-28
AI Technical Summary
In the prior art, when processor performance changes, there is a lag in the frequency adjustment process, resulting in over-supply or insufficient frequency supply, affecting system performance and power consumption.
By periodically obtaining processor performance data and device operation information, triggering frequency regulation according to device operation, adjusting the frequency of processor cache, system cache and main memory to avoid adjustment lag.
Dynamic frequency supply is realized, avoiding waste of power consumption caused by frequency oversupply or poor performance caused by insufficient frequency supply, and making system performance and power consumption better.
Smart Images

Figure CN119759710A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a frequency adjustment method, an electronic device and a storage medium. Background Art
[0002] When the processor accesses data, it will first search for the data in the processor cache. If the data is not found, it will continue to search for the data in the system cache. If the data is still not found, it will access the data in the main memory. Therefore, the frequency of the processor cache, system cache, and main memory has a great impact on the performance and power consumption of the system.
[0003] At present, in order to ensure the balance between system performance and power consumption, processor performance data is periodically obtained, and the processor frequency is determined based on the processor performance data. Then, the frequencies of the processor cache, system cache, and main memory are adjusted in combination with the preset mapping table between the processor frequency and the processor cache frequency, the mapping table between the processor frequency and the system cache frequency, and the mapping table between the processor frequency and the main memory frequency.
[0004] However, the frequency adjustment process only performs periodic frequency adjustment according to processor performance data. When the processor performance has changed, it still needs to wait until the next cycle arrives before frequency adjustment can be performed. This will cause adjustment lag problems, which may easily lead to over-supply or under-supply of frequency. Summary of the invention
[0005] The present application provides a frequency adjustment method, an electronic device and a storage medium, which can avoid the problem of adjustment lag. The technical solution is as follows:
[0006] In a first aspect, a frequency adjustment method is provided, which is applied to an electronic device, wherein the electronic device includes a processor and a memory. By way of example, the processor may be a central processing unit (CPU). The memory may be a processor cache, a system cache, or a main memory. By way of example, the processor cache may be a level 3 cache (L3Cache). By way of example, the main memory may be a double data rate synchronous dynamic random access memory (DDR SDRAM).
[0007] In the method, processor performance data is periodically obtained; device operation information is obtained; if it is determined according to the device operation information that a first preset condition is met, the frequency of the memory is adjusted according to the processor performance data.
[0008] The processor performance data is data used to reflect the performance of the processor. The processor may include one or more processor cores. The processor performance data may include performance data of each processor core in the one or more processor cores of the processor.
[0009] The device operation information is information used to reflect the operation status of the electronic device. For example, the device operation information may include user scenarios and / or system loads. Further, the device operation information may also include one or more of frame loss information, device temperature, processor core status, etc.
[0010] The first preset condition is used to indicate that the performance requirement of the electronic device is relatively low under the current operation condition.
[0011] In the present application, when it is determined that the first preset condition is met according to the device operation information, frequency modulation can be triggered, that is, the operation of adjusting the frequency of the memory according to the processor performance data can be triggered. In this way, frequency modulation can be triggered in time according to the device operation status to avoid the problem of adjustment lag, thereby ensuring dynamic frequency supply, and further avoiding the problem of power consumption waste caused by excessive frequency supply or poor performance caused by insufficient frequency supply, so that the system has better performance and power consumption.
[0012] In a possible implementation, each time processor performance data is obtained, the frequency of the memory is adjusted according to the processor performance data.
[0013] In this way, the frequency of the memory can be adjusted periodically according to the processor performance data, so that the frequency of the memory can meet the performance requirements of the processor as much as possible.
[0014] In a possible implementation, if the amount of data accessed by the processor to the memory is greater than a first data amount threshold, or if the amount of data accessed by the processor to the memory is less than a second data amount threshold, the frequency of the memory is adjusted according to the access data amount.
[0015] If the amount of data accessed by the processor to the memory is greater than the first data amount threshold, it indicates that the processor currently has a large access bandwidth requirement. Therefore, the frequency of the memory can be adjusted according to the access data amount to ensure dynamic frequency supply to match the current access bandwidth requirement and avoid insufficient frequency supply.
[0016] If the amount of data accessed by the processor to the memory is less than the second data amount threshold, it means that the processor's current access bandwidth requirement is relatively small. Therefore, the frequency of the memory can be adjusted according to the access data amount to ensure dynamic frequency supply to match the current access bandwidth requirement and avoid frequency oversupply.
[0017] In a possible implementation, the device operation information includes a user scenario, and the first preset condition is that the user scenario is a non-user operation scenario.
[0018] Since there is relatively little concern about latency in non-user operation scenarios, the performance requirements are relatively small at this time. Therefore, the frequency of the memory can be adjusted according to the processor performance data in this case to avoid power consumption caused by oversupply of frequency.
[0019] In a possible implementation, the device operation information includes a system load, and the first preset condition is: the system load is less than a first load threshold.
[0020] In this case, the system load is less than the first load threshold, indicating that the system load is low and the performance requirement is small. Therefore, the frequency of the memory can be adjusted according to the processor performance data to avoid power consumption caused by oversupply of frequency.
[0021] In a possible implementation, the device operation information includes a user scenario and a system load, and the first preset condition is that the user scenario is a non-user operation scenario and the system load is less than a first load threshold. Since the concern for latency in a non-user operation scenario is relatively small and the system load is also relatively small, the performance requirement is relatively small at this time, so the frequency of the memory can be adjusted according to the processor performance data in this case to avoid power consumption waste caused by oversupply of frequency.
[0022] Alternatively, the user scenario is a user operation scenario and the system load is less than the first load threshold. In this case, although the user operation scenario pays relatively more attention to latency, since the system load is less than the first load threshold, it can still be said that the performance requirement is relatively small at this time, so the frequency of the memory can be adjusted according to the processor performance data in this case to avoid power consumption waste caused by frequency oversupply.
[0023] Alternatively, the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor has not deteriorated. In this case, the user scenario is a non-user operation scenario, but the system load is greater than the second load threshold, indicating that the system load is high and the performance requirement is relatively large. Although the performance requirement is large, the performance of the processor has not deteriorated, indicating that the current performance of the processor can meet the requirement, so the frequency of the memory can be adjusted according to the processor performance data in this case to avoid power consumption waste caused by oversupply of frequency.
[0024] In one possible implementation, the operation of adjusting the frequency of the memory according to the processor performance data may be: if the processor performance data meets the frequency adjustment condition, calculating the frequency of the processor according to the processor performance data; determining a first target frequency through a preset algorithm according to the frequency of the processor; and adjusting the frequency of the memory according to the first target frequency.
[0025] If the processor performance data does not meet the frequency adjustment condition, it means that the current performance of the processor is relatively suitable, so there is no need to adjust the frequency of the memory, and the operation is directly terminated.
[0026] If the processor performance data meets the frequency adjustment condition, it means that the current performance of the processor is too high or too low, and the memory frequency needs to be adjusted. In this case, the processor frequency can be calculated based on the processor performance data, and then the memory frequency can be adjusted based on the processor frequency.
[0027] The preset algorithm may be pre-set. For example, the preset algorithm may be: first mapping the frequency of the processor to a first initial frequency, and then amplifying the first initial frequency to obtain a first target frequency greater than the first initial frequency.
[0028] In a possible implementation, if it is determined according to the device operation information that the second preset condition is met, the frequency of the processor is obtained; based on the frequency of the processor, a first target frequency is determined by a preset algorithm; and the frequency of the memory is adjusted according to the first target frequency.
[0029] The second preset condition is used to indicate that the performance requirement of the electronic device is relatively high under the current operation condition.
[0030] If the second preset condition is determined to be met based on the device operation information, it means that the current performance requirements are relatively high. In this case, if the frequency of the processor is calculated based on the processor performance data, it will cause more delays and loads, which is not conducive to performance improvement. Therefore, the frequency of the processor is not calculated based on the processor performance data, but the frequency of the processor is directly obtained through the kernel general interface. The frequency of the memory is subsequently adjusted according to the frequency of the processor, which can achieve on-demand frequency improvement.
[0031] In a possible implementation, the device operation information includes a user scenario, and the second preset condition is: the user scenario is a user operation scenario.
[0032] Since users pay relatively more attention to latency in operation scenarios and have higher performance requirements, the frequency of the memory can be adjusted according to the processor performance data to avoid poor performance due to insufficient frequency supply.
[0033] In a possible implementation, the device operation information includes a system load, and the second preset condition is: the system load is greater than a second load threshold.
[0034] In this case, the system load is greater than the second load threshold, indicating that the system load is high. For example, the system load is relatively high when the application is cold started, and the performance requirement is relatively large at this time. Therefore, in this case, the frequency of the memory can be adjusted according to the processor performance data to avoid poor performance due to insufficient frequency supply.
[0035] In a possible implementation, the device operation information includes a user scenario and a system load, and the second preset condition is: the user scenario is a user operation scenario and the system load is greater than a second load threshold. In this case, since the user operation scenario pays relatively more attention to latency and the system load is also relatively large, the performance requirement is relatively large at this time, so the frequency of the memory can be adjusted according to the processor performance data in this case to avoid poor performance due to insufficient frequency supply.
[0036] Alternatively, the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor deteriorates. In this case, although the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, indicating that the system load is high, and the performance requirement is large at this time, and the performance of the processor deteriorates, indicating that the current performance of the processor cannot meet the requirement, so in this case, the frequency of the memory can be adjusted according to the processor performance data to avoid poor performance caused by insufficient frequency supply.
[0037] In a possible implementation, the device operation information also includes frame loss information, and whether there is a risk of jamming can be detected based on the frame loss information. In this case, before adjusting the frequency of the memory according to the first target frequency, if the risk of jamming is detected within a preset time before the current moment, the first target frequency is increased.
[0038] If a jam risk is detected, it means that the system performance is poor. Then, within a preset time after the jam risk is detected, if the frequency of the memory needs to be adjusted, a frequency increase operation can be performed, that is, the first target frequency is increased and then the frequency of the memory is adjusted accordingly. In this way, after the jam risk is detected, the frequency increase operation can be performed in a short time to meet the system performance requirements and avoid jams.
[0039] In a possible implementation, the device operation information also includes device temperature, and the operation of adjusting the frequency of the memory according to the first target frequency may be: when the device temperature is greater than or equal to the first temperature threshold and less than or equal to the second temperature threshold, if the first target frequency is less than the first preset frequency, the frequency of the memory is adjusted to the first preset frequency; if the first target frequency is greater than the second preset frequency, the frequency of the memory is adjusted to the second preset frequency; if the first target frequency is greater than or equal to the first preset frequency and less than or equal to the second preset frequency, the frequency of the memory is adjusted to the first target frequency. When the device temperature is greater than the second temperature threshold, the frequency of the memory is adjusted to the first target frequency.
[0040] If the device temperature is greater than or equal to the first temperature threshold and less than or equal to the second temperature threshold, it means that the current temperature of the electronic device is relatively normal. Therefore, the frequency of the memory can be adjusted with reference to the pre-set first preset frequency and second preset frequency. That is, when adjusting the frequency of the memory, it is necessary to ensure that the frequency of the memory is greater than or equal to the first preset frequency and less than or equal to the second preset frequency.
[0041] If the device temperature is greater than the second temperature threshold, it means that the current temperature of the electronic device is too high. In this case, if the first preset frequency is set relatively large, such as greater than the first target frequency, then if the frequency of the memory is adjusted according to the first preset frequency, it will not only cause frequency oversupply and waste power consumption, but also cause the device to heat up more seriously due to high power consumption. For this reason, when the device temperature is greater than the second temperature threshold, the first preset frequency and the second preset frequency are not referenced, but the frequency of the memory is directly adjusted to the first target frequency to match the current system performance requirements and avoid power consumption loss caused by frequency oversupply.
[0042] In one possible implementation, the processor includes one or more processor cores, and the device operation information also includes a processor core status. Before adjusting the frequency of the memory according to the processor performance data, the performance data of the processor cores whose processor core status is a sleep state in the processor performance data can also be filtered out.
[0043] Since a processor core in a dormant state has no performance and power consumption requirements, the performance data of the processor core in a dormant state can be screened out from the processor performance data. In this way, the frequency adjustment is subsequently performed based on the performance data of the processor core in a running state, thereby improving the accuracy of the frequency adjustment.
[0044] In a second aspect, a frequency adjustment device is provided, wherein the frequency adjustment device has the function of implementing the frequency adjustment method in the first aspect. The frequency adjustment device includes at least one module, and the at least one module is used to implement the frequency adjustment method provided in the first aspect.
[0045] In a third aspect, an electronic device is provided, wherein the structure of the electronic device includes a processor and a memory, wherein the memory is used to store a program that supports the electronic device to execute the frequency adjustment method provided in the first aspect, and to store data involved in implementing the frequency adjustment method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may also include a communication bus, wherein the communication bus is used to establish a connection between the processor and the memory.
[0046] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the frequency adjustment method described in the first aspect.
[0047] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the frequency adjustment method described in the first aspect.
[0048] The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic diagram of the architecture of a system on chip (SOC) provided in an embodiment of the present application;
[0050] Figure 2 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0051] Figure 3 is a block diagram of a software system of an electronic device provided in an embodiment of the present application;
[0052] Figure 4 is a flow chart of a frequency adjustment method provided in an embodiment of the present application;
[0053] Figure 5 is a schematic diagram of a frequency adjustment process provided in an embodiment of the present application;
[0054] Figure 6 It is a structural schematic diagram of a frequency adjustment device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0056] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. 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 limit them to be different.
[0057] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" that appear in the differences in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. In addition, the terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0058] The application scenarios of the embodiments of the present application are described below.
[0059] The embodiments of the present application are applied to the scenario of adjusting the frequency of the memory in the chip. For example, the embodiments of the present application can be applied to the scenario of adjusting the frequency of the processor cache, the frequency of the system cache, and the frequency of the main memory in the chip.
[0060] For example, Figure 1 Schematic diagram of a SOC architecture provided by an embodiment of the present application. Figure 1 The SOC may include a CPU, a graphics processing unit (GPU), a neural-network processing unit (NPU), and other processors. The SOC may also include a system cache and a main memory.
[0061] Optionally, the CPU may include multiple processor cores, such as a performance core and a low power core, so as to achieve a balance between performance and power consumption. For example, the performance core may include a high performance prime core and a high performance big core, and the low power core may include a low power little core.
[0062] Optionally, the CPU may include a processor cache. For example, the processor cache may be a level 3 cache. Of course, the processor cache may also be other types of caches, which are not limited in the embodiments of the present application.
[0063] Optionally, the main memory may be DDR SDRAM. Of course, the main memory may also be other types of memory, which is not limited in the embodiments of the present application. DDR SDRAM may be referred to as DDR for short.
[0064] Optionally, DDR may include a DDR controller (DDRC) and a low power double data rate SDRAM (LPDDR SDRAM) particle. LPDDR SDRAM may be referred to as LPDDR for short. For example, LPDDR particles may include LPDDR4, LPDDR5, etc.
[0065] When the CPU accesses data, it can first search for data in the processor cache. If the data is not found, it will continue to search for data in the system cache. If the data is still not found, it will access the data in the main memory. Therefore, the frequency of the processor cache, system cache and main memory has a great impact on the performance and power consumption of the system. In some embodiments, the processor cache, system cache and main memory can be collectively referred to as a data channel.
[0066] Currently, the bus dynamic clock and voltage scaling (BUS DCVS) algorithm can be used to adjust the frequency. BUSDCVS is a bus frequency selection algorithm used to select the best frequency point between dynamic workloads to meet the balance between performance and power consumption.
[0067] In the related art, the BUSDCVS algorithm provides a frequency adjustment strategy. Specifically, the CPU performance management unit (PMU) data is periodically obtained, and the CPU frequency is determined based on the PMU data. After that, the frequencies of the processor cache, system cache, and main memory are adjusted by combining the preset mapping table between the CPU frequency and the processor cache frequency, the mapping table between the CPU frequency and the system cache frequency, and the mapping table between the CPU frequency and the main memory frequency.
[0068] However, this frequency modulation strategy only performs periodic frequency modulation based on the CPU's PMU data. Even if the CPU performance has changed, it still needs to wait until the next cycle arrives before frequency modulation can be performed. This will lead to adjustment lag problems, and easily cause frequency oversupply or frequency undersupply, resulting in poor system performance and power consumption.
[0069] To this end, the embodiment of the present application provides a frequency adjustment method, which can obtain device operation information including user scenarios, system loads, etc., determine whether to trigger frequency modulation based on the device operation information, and if it is determined that frequency modulation needs to be triggered, adjust the frequency of the processor cache, system cache, and main memory based on the CPU's PMU data. In this way, frequency modulation can be triggered in a timely manner according to the device operation status to avoid the problem of adjustment lag, thereby ensuring dynamic frequency supply, avoiding frequency oversupply or insufficient frequency supply, and making the system performance and power consumption have better performance.
[0070] The frequency adjustment method provided in the embodiment of the present application can be applied to electronic devices. The electronic device can be a mobile phone, a tablet computer, a wearable device, a digital camera, a vehicle-mounted device, an augmented reality (AR) device, a virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a laptop computer, etc., and the embodiment of the present application does not limit this.
[0071] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 2The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0072] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0073] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0074] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0075] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0076] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0077] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0078] The electronic device 100 can implement the display function through the GPU, the display screen 194, and the application processor, etc. In an embodiment, the electronic device 100 can include 1 or N display screens 194, where N is an integer greater than 1.
[0079] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0080] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.
[0081] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is an integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0082] Next, the software system of the electronic device 100 will be described.
[0083] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 100.
[0084] Figure 3 1 is a block diagram of a software system of an electronic device 100 provided in an embodiment of the present application. Figure 3 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into an application layer, an application framework layer, an Android runtime (AndroidRuntime) and a system layer, and a kernel layer.
[0085] The application layer can include a series of application packages. Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, Bluetooth, music, video, short message, etc.
[0086] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Figure 3As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. 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. The content provider is used to store and obtain data and make these data accessible to applications. These data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build the display interface of the application, and the display interface can be composed of one or more views, for example, including a view for displaying a text message notification icon, including a view for displaying text, and including a view for displaying pictures. The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.
[0087] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0088] The system layer can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0089] The kernel layer is a layer between hardware and software. The kernel layer may include a scheduling module, a temperature control module, a frequency modulation module, a display driver, a camera driver, an audio driver, a sensor driver, etc. Among them, the scheduling module, the temperature control module and the frequency modulation module may be combined to implement the frequency adjustment method provided in the embodiment of the present application.
[0090] For example, the scheduling module can obtain one or more of the device operation information such as frame loss information, processor core status information, system load, etc. The temperature control module can obtain one or more of the device operation information such as user scenarios and device temperature. The frequency modulation module can obtain processor performance data and obtain the amount of data accessed by the processor to the memory. The frequency modulation module can determine the memory frequency based on one or more of the above-mentioned processor performance data, the amount of data accessed by the processor to the memory, user scenarios, system load, processor core status, device temperature, frame loss information, etc., and then call the underlying interface to set the memory frequency to adjust the frequency of the memory.
[0091] The frequency adjustment method provided in the embodiment of the present application is explained in detail below.
[0092] The frequency adjustment method provided in the embodiment of the present application is applied to an electronic device, and the electronic device includes a processor and a memory. By way of example, the processor may be a CPU. By way of example, the memory may be a processor cache, a system cache, or a main memory, and the memory supports a dynamic frequency modulation mechanism. The embodiment of the present application may adjust the frequency of the memory according to the frequency of the processor. One point to be noted is that the frequency described in the embodiment of the present application may also be referred to as a frequency point. Another point to be noted is that the adjustment of the frequency of the memory in the embodiment of the present application realizes the adjustment of the bandwidth of the memory.
[0093] Figure 4 is a flow chart of a frequency adjustment method provided in an embodiment of the present application. Figure 4, the method comprises the following steps:
[0094] Step 401: The electronic device periodically obtains processor performance data.
[0095] The processor performance data is data used to reflect the performance of the processor. The processor may include one or more processor cores. The processor performance data may include performance data of each processor core in the one or more processor cores of the processor.
[0096] Optionally, the performance data of a processor core may be PMU data of the processor core. Of course, the performance data of the processor core may also be other data that can reflect the performance of the processor core, which is not limited in the embodiments of the present application.
[0097] For example, the PMU data of a processor core may include one or more of the following data: the number of clock cycles required for the processor core to execute an instruction, the number of instructions executed by the processor core in a unit cycle, the number of data hits in the processor cache of the processor core in a unit cycle (also referred to as the number of cache hits), the number of data misses in the processor cache of the processor core in a unit cycle (also referred to as the number of cache misses), the processor pipeline stall time (also referred to as the CPU stall time), etc. The embodiments of the present application are not limited to this.
[0098] The time period for the electronic device to obtain the processor performance data can be preset. For example, the electronic device can obtain the processor performance data every 8 milliseconds or 16 milliseconds.
[0099] Step 402: The electronic device obtains device operation information.
[0100] The device operation information is information used to reflect the operation status of the electronic device. For example, the device operation information may include user scenarios and / or system loads. Further, the device operation information may also include one or more of frame loss information, device temperature, processor core status, etc.
[0101] User scenarios may include user operation scenarios and non-user operation scenarios. Among them, user operation scenarios may include user touch screen operation scenarios, such as scenarios where users slide and browse on electronic devices. Of course, user operation scenarios may also include other scenarios that can reflect that users are operating electronic devices, and the embodiments of the present application do not limit this. Non-user operation scenarios may include non-user touch screen operation scenarios, such as scenarios where users watch videos on electronic devices. Of course, non-user operation scenarios may also include other scenarios that can reflect that users are not operating electronic devices, and the embodiments of the present application do not limit this.
[0102] The system load may include a processor load, which is used to reflect the busyness of the processor. For example, the processor load may be a processor utilization rate. In this case, the processor utilization rate may reflect the level of the processor load. That is, the higher the processor utilization rate, the higher the processor load; the lower the processor utilization rate, the lower the processor load.
[0103] The frame loss information is used to reflect the foreground frame loss situation. For example, the frame loss information may include the system frame loss rate.
[0104] The device temperature is the current temperature of the electronic device.
[0105] The processor core state may include the state of each processor core in the one or more processor cores of the processor. The state of the processor core may include a sleep (idle) state and a running state.
[0106] Optionally, some information in the device operation information may be periodically acquired. For example, the electronic device may periodically acquire one or more of system load, frame loss information, processor core status, and the like.
[0107] Other information in the device operation information can be detected. For example, when the user scene changes, such as when the user scene changes from a user operation scene to a non-user operation scene, or when the user scene changes from a non-user operation scene to a user operation scene, the electronic device can detect this change and then determine the user scene the electronic device is currently in. Similarly, when the device temperature changes, the electronic device can also detect this change and then determine the current temperature of the electronic device.
[0108] Step 403: If the electronic device determines that the first preset condition is met according to the device operation information, the frequency of the memory is adjusted according to the processor performance data.
[0109] The first preset condition is used to indicate that the performance requirement of the electronic device is relatively low under the current operation condition. The first preset condition can be set in advance.
[0110] For example, when the device operation information includes a user scenario, the first preset condition may be: the user scenario is a non-user operation scenario. Since the concern about latency is relatively small in the non-user operation scenario, the performance requirement is relatively small at this time, so in this case, the frequency of the memory can be adjusted according to the processor performance data to avoid power consumption waste caused by frequency oversupply.
[0111] Alternatively, when the device operation information includes the system load, the first preset condition may be: the system load is less than the first load threshold. The first load threshold may be set in advance, and the first load threshold may be set to be relatively small. In this case, the system load is less than the first load threshold, indicating that the system load is relatively low, and the performance requirement is relatively small at this time. Therefore, in this case, the frequency of the memory may be adjusted according to the processor performance data to avoid power consumption waste caused by frequency oversupply.
[0112] Alternatively, when the device operation information includes a user scenario and a system load, the first preset condition may be: the user scenario is a non-user operation scenario and the system load is less than a first load threshold. Since the concern for latency in a non-user operation scenario is relatively small and the system load is also relatively small, the performance requirement is relatively small at this time, and therefore the frequency of the memory may be adjusted according to the processor performance data in this case to avoid power consumption waste caused by frequency oversupply.
[0113] Alternatively, when the device operation information includes a user scenario and a system load, the first preset condition may be: the user scenario is a user operation scenario and the system load is less than a first load threshold. In this case, although the user operation scenario pays relatively more attention to latency, since the system load is less than the first load threshold, it can still be said that the performance requirement is relatively small at this time, and thus the frequency of the memory may be adjusted according to the processor performance data in this case to avoid power consumption waste caused by frequency oversupply.
[0114] Alternatively, in the case where the device operation information includes a user scenario and a system load, the first preset condition may be: the user scenario is a non-user operation scenario, the system load is greater than a second load threshold, and the performance of the processor has not deteriorated. The second load threshold may be greater than the first load threshold, the second load threshold may be set in advance, and the second load threshold may be set larger. In this case, the user scenario is a non-user operation scenario, but the system load is greater than the second load threshold, indicating that the system load is high and the performance requirement is relatively large at this time. Although the performance requirement is large, the performance of the processor has not deteriorated, indicating that the current performance of the processor can already meet the requirement, and therefore the frequency of the memory may be adjusted according to the processor performance data in this case to avoid power consumption waste caused by oversupply of frequency.
[0115] Among them, the electronic device can determine whether the performance of the processor has deteriorated based on the processor performance data.
[0116] For example, the electronic device may determine whether the performance of the processor has deteriorated according to the number of cache misses and / or CPU stall time in the processor performance data.
[0117] For example, the electronic device can determine the maximum and minimum values of multiple (e.g., 20) cache miss times recently obtained; if the difference between the maximum and minimum values is small (e.g., less than a first preset difference), it can be determined that the performance of the processor has not deteriorated; if the difference between the maximum and minimum values is large (e.g., greater than or equal to the first preset difference), it can be determined that the performance of the processor has deteriorated.
[0118] For another example, the electronic device may determine the maximum and minimum values of multiple CPU stall times that have been recently acquired; if the difference between the maximum and minimum values is small (such as less than a second preset difference), it may be determined that the performance of the processor has not deteriorated; if the difference between the maximum and minimum values is large (such as greater than or equal to the second preset difference), it may be determined that the performance of the processor has deteriorated.
[0119] For another example, the electronic device may determine the maximum and minimum values of multiple cache miss times obtained recently, and determine the maximum and minimum values of multiple CPU stall times obtained recently; if the difference between the maximum and minimum values of the cache miss times is small, and the difference between the maximum and minimum values of the CPU stall time is small, it may be determined that the performance of the processor has not deteriorated; otherwise, it may be determined that the performance of the processor has deteriorated.
[0120] In the embodiment of the present application, when the electronic device determines that the first preset condition is met according to the device operation information, the frequency modulation can be triggered, that is, the operation of adjusting the frequency of the memory according to the processor performance data can be triggered. In this way, the frequency modulation can be triggered in time according to the operation of the electronic device to avoid the problem of adjustment lag, thereby ensuring dynamic frequency supply, and further avoiding the problem of power consumption waste caused by excessive frequency supply or poor performance caused by insufficient frequency supply, so that the system performance and power consumption have better performance.
[0121] In some embodiments, the operation of the electronic device adjusting the frequency of the memory according to the processor performance data may include the following method 1 or method 2.
[0122] Method 1: If the processor performance data meets the frequency adjustment condition, the frequency of the processor is calculated according to the processor performance data; and the frequency of the memory is adjusted according to the frequency of the processor.
[0123] Method 2: Filter out the performance data of the processor cores whose processor core state is in the dormant state from the processor performance data. Then, if the processor performance data meets the frequency adjustment condition, calculate the frequency of the processor according to the processor performance data; and adjust the frequency of the memory according to the frequency of the processor.
[0124] Since a processor core in a dormant state has no performance and power consumption requirements, the performance data of the processor core in a dormant state can be screened out from the processor performance data. In this way, the frequency adjustment is subsequently performed based on the performance data of the processor core in a running state, thereby improving the accuracy of the frequency adjustment.
[0125] The frequency adjustment condition can be set in advance. The frequency adjustment condition is used to indicate that the performance of the processor is too high or too low. Optionally, the frequency adjustment condition can be set with thresholds for each data in the processor performance data and the size relationship that should be satisfied between each data and the corresponding threshold. In this case, if the processor performance data satisfies the frequency adjustment condition, it means that the size relationship between each data in the processor performance data and the corresponding threshold satisfies the frequency adjustment condition, which also means that the performance of the processor is too high or too low.
[0126] It should be noted that, when the type of the memory is different, the threshold value set in the frequency adjustment condition may be different. Specifically, if the memory is a processor cache, then the frequency adjustment condition may be set with a first threshold value for each data in the processor performance data; if the memory is a system cache, then the frequency adjustment condition may be set with a second threshold value for each data in the processor performance data; if the memory is a main memory, then the frequency adjustment condition may be set with a third threshold value for each data in the processor performance data. The first threshold value, the second threshold value, and the third threshold value corresponding to a data in the processor performance data may be the same or different, and the embodiments of the present application are not limited to this.
[0127] If the processor performance data does not meet the frequency adjustment condition, it means that the current performance of the processor is relatively suitable, so there is no need to adjust the frequency of the memory, and the operation is directly terminated.
[0128] If the processor performance data meets the frequency adjustment condition, it means that the current performance of the processor is too high or too low, and the memory frequency needs to be adjusted. In this case, the electronic device can first calculate the frequency of the processor according to the processor performance data, and then adjust the frequency of the memory according to the frequency of the processor.
[0129] Among them, the operation of the electronic device calculating the frequency of the processor based on the processor performance data is similar to the operation of a certain device in the related technology calculating the frequency of a certain processor based on the performance data of the processor, and the embodiments of the present application will not elaborate on this.
[0130] In some embodiments, the operation of the electronic device adjusting the frequency of the memory according to the frequency of the processor may be: determining a first target frequency through a preset algorithm according to the frequency of the processor; and adjusting the frequency of the memory according to the first target frequency.
[0131] The preset algorithm may be pre-set. For example, the preset algorithm may be: first mapping the frequency of the processor to a first initial frequency, and then amplifying the first initial frequency to obtain a first target frequency greater than the first initial frequency.
[0132] Optionally, a mapping relationship between processor frequency and memory frequency may be preset in the electronic device. The electronic device may search the memory frequency corresponding to the processor frequency in the mapping relationship as the first initial frequency, and then add the first initial frequency to the preset amplification parameter to obtain the first target frequency.
[0133] It should be noted that, in the case of different types of the memory, the memory frequencies corresponding to the various processor frequencies in the mapping relationship may be different. Specifically, if the memory is a processor cache, then the memory frequency corresponding to a certain processor frequency in the mapping relationship may be the first frequency; if the memory is a system cache, then the memory frequency corresponding to this processor frequency in the mapping relationship may be the second frequency; if the memory is a main memory, then the memory frequency corresponding to this processor frequency in the mapping relationship may be the third frequency. The first frequency, second frequency, and third frequency corresponding to this processor frequency may be the same or different, and this is not limited in the embodiments of the present application.
[0134] In some embodiments, the operation of the electronic device adjusting the frequency of the memory according to the first target frequency may be implemented in any one of the following four ways:
[0135] The first way: the electronic device adjusts the frequency of the memory to a first target frequency.
[0136] The second method: if the risk of jamming is not detected within the preset time before the current moment, the electronic device adjusts the frequency of the memory to the first target frequency. If the risk of jamming is detected within the preset time before the current moment, the electronic device increases the first target frequency and then adjusts the frequency of the memory to the first target frequency.
[0137] The preset duration can be set in advance. For example, the preset duration can be the duration of 2 frames (such as 32 milliseconds).
[0138] It should be noted that the electronic device can determine whether there is a risk of jamming based on the frame loss information. If the electronic device detects the risk of jamming, it means that the system performance is poor. Then, within the preset time after the risk of jamming is detected, if the electronic device needs to adjust the frequency of the memory, it can perform a frequency increase operation, that is, increase the first target frequency and then adjust the frequency of the memory accordingly. In this way, the electronic device can perform a frequency increase operation in a short time after detecting the risk of jamming to meet the system performance requirements and avoid jamming.
[0139] For example, the electronic device may add the first target frequency to a preset amplification parameter to increase the first target frequency.
[0140] The third method: when the device temperature is greater than or equal to the first temperature threshold and less than or equal to the second temperature threshold, if the first target frequency is less than the first preset frequency, the electronic device adjusts the frequency of the memory to the first preset frequency; if the first target frequency is greater than the second preset frequency, the electronic device adjusts the frequency of the memory to the second preset frequency; if the first target frequency is greater than or equal to the first preset frequency and less than or equal to the second preset frequency, the electronic device adjusts the frequency of the memory to the first target frequency. When the device temperature is greater than the second temperature threshold, the electronic device adjusts the frequency of the memory to the first target frequency.
[0141] The first preset frequency and the second preset frequency can be preset. The second preset frequency is greater than the first preset frequency. The first preset frequency can be the preset minimum frequency that the memory needs to reach. The second preset frequency can be the preset maximum frequency that the memory can reach.
[0142] The first temperature threshold and the second temperature threshold can both be set in advance. The first temperature threshold is smaller than the second temperature threshold.
[0143] If the device temperature is greater than or equal to the first temperature threshold and less than or equal to the second temperature threshold, it means that the current temperature of the electronic device is relatively normal. Therefore, at this time, the frequency of the memory can be adjusted with reference to the pre-set first preset frequency and second preset frequency, that is, when adjusting the frequency of the memory, it is necessary to ensure that the frequency of the memory is greater than or equal to the first preset frequency and less than or equal to the second preset frequency.
[0144] If the device temperature is greater than the second temperature threshold, it means that the current temperature of the electronic device is too high. In this case, if the first preset frequency is set relatively large, such as greater than the first target frequency, then if the frequency of the memory is adjusted according to the first preset frequency, it will not only cause frequency oversupply and waste power consumption, but also cause the device to heat up more seriously due to high power consumption. For this reason, when the device temperature is greater than the second temperature threshold, the first preset frequency and the second preset frequency are not referenced, but the frequency of the memory is directly adjusted to the first target frequency to match the current system performance requirements and avoid power consumption loss caused by frequency oversupply.
[0145] The fourth method: if the risk of jamming is detected within the preset time before the current moment, the first target frequency is increased; if the risk of jamming is not detected within the preset time before the current moment, the subsequent operation is directly performed. Afterwards, when the device temperature is greater than or equal to the first temperature threshold and less than or equal to the second temperature threshold, if the first target frequency is less than the first preset frequency, the frequency of the memory is adjusted to the first preset frequency; if the first target frequency is greater than the second preset frequency, the frequency of the memory is adjusted to the second preset frequency; if the first target frequency is greater than or equal to the first preset frequency and less than or equal to the second preset frequency, the frequency of the memory is adjusted to the first target frequency. When the device temperature is greater than the second temperature threshold, the frequency of the memory is adjusted to the first target frequency.
[0146] In some embodiments, after step 402, if the electronic device determines that the second preset condition is met according to the device operation information, the frequency of the processor is obtained, and the frequency of the memory is adjusted according to the frequency of the processor.
[0147] The second preset condition is used to indicate that the performance requirement of the electronic device is relatively high under the current operation condition. The second preset condition can be set in advance.
[0148] For example, when the device operation information includes a user scenario, the second preset condition may be: the user scenario is a user operation scenario. Since the user operation scenario pays relatively more attention to latency and the performance requirement is relatively high, the frequency of the memory may be adjusted according to the processor performance data to avoid poor performance due to insufficient frequency supply.
[0149] Alternatively, when the device operation information includes the system load, the second preset condition may be: the system load is greater than the second load threshold. In this case, the system load is greater than the second load threshold, indicating that the system load is high. For example, the system load is high when the application is cold started, and the performance requirement is high at this time. Therefore, in this case, the frequency of the memory can be adjusted according to the processor performance data to avoid poor performance caused by insufficient frequency supply.
[0150] Alternatively, when the device operation information includes a user scenario and a system load, the second preset condition may be: the user scenario is a user operation scenario and the system load is greater than a second load threshold. In this case, since the user operation scenario pays relatively more attention to latency and the system load is also relatively large, the performance requirement is relatively large at this time, so the frequency of the memory may be adjusted according to the processor performance data in this case to avoid poor performance due to insufficient frequency supply.
[0151] Alternatively, when the device operation information includes a user scenario and a system load, the second preset condition may be: the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor deteriorates. In this case, although the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, indicating that the system load is high, and the performance requirement is high at this time, and the performance of the processor deteriorates, indicating that the current performance of the processor cannot meet the requirement, so in this case, the frequency of the memory can be adjusted according to the processor performance data to avoid poor performance caused by insufficient frequency supply.
[0152] It should be noted that the second preset condition cannot conflict with the first preset condition. That is, the electronic device will not determine that the first preset condition and the second preset condition are satisfied at the same time according to the device operation information.
[0153] Some possible combinations of the first preset condition and the second preset condition are described below.
[0154] For example, the first preset condition is: the user scenario is a non-user operation scenario. The second preset condition is: the user scenario is a user operation scenario, or the user scenario is a user operation scenario and the system load is less than a first load threshold.
[0155] For example, the first preset condition is: the system load is less than the first load threshold. The second preset condition is: the system load is greater than the second load threshold, or the user scenario is a user operation scenario and the system load is greater than the second load threshold, or the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor deteriorates.
[0156] For example, the first preset condition is: the user scenario is a non-user operation scenario and the system load is less than a first load threshold. The second preset condition is: the user scenario is a user operation scenario, or the system load is greater than a second load threshold, or the user scenario is a user operation scenario and the system load is greater than the second load threshold, or the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor deteriorates.
[0157] For example, the first preset condition is: the user scenario is a user operation scenario and the system load is less than a first load threshold. The second preset condition is: the system load is greater than a second load threshold, or the user scenario is a user operation scenario and the system load is greater than the second load threshold, or the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor deteriorates.
[0158] For example, the first preset condition is: the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor is not deteriorated. The second preset condition is: the user scenario is a user operation scenario, or the user scenario is a user operation scenario and the system load is greater than the second load threshold, or the user scenario is a non-user operation scenario, the system load is greater than the second load threshold, and the performance of the processor is deteriorated.
[0159] In some embodiments, when the electronic device obtains the frequency of the processor, it can obtain the frequency of the processor through the kernel universal interface, and the frequency of the processor obtained at this time is the actual frequency of the processor. It should be noted that the frequency of the processor calculated according to the processor performance data in the previous text is the frequency of the processor estimated according to the processor performance data.
[0160] If the electronic device determines that the second preset condition is met based on the device operation information, it means that the electronic device currently has relatively high performance requirements. In this case, if the frequency of the processor is calculated based on the processor performance data, it will cause more delays and loads, which is not conducive to performance improvement. Therefore, the electronic device here does not calculate the frequency of the processor based on the processor performance data, but directly obtains the frequency of the processor through the kernel universal interface, and then adjusts the frequency of the memory according to the frequency of the processor, which can achieve on-demand frequency improvement.
[0161] Among them, the operation of the electronic device adjusting the frequency of the memory according to the frequency of the processor is the same as the operation of the electronic device adjusting the frequency of the memory according to the frequency of the processor in the previous text, and the embodiment of the present application will not be repeated here.
[0162] In some embodiments, based on step 401, each time the electronic device obtains processor performance data, the frequency of the memory may be adjusted according to the most recently obtained processor performance data.
[0163] In this way, the electronic device periodically adjusts the frequency of the memory according to the processor performance data, so that the frequency of the memory can meet the performance requirements of the processor as much as possible.
[0164] Among them, the operation of the electronic device adjusting the frequency of the memory according to the latest acquired processor performance data is the same as the operation of the electronic device adjusting the frequency of the memory according to the processor performance data in the previous text, and the embodiment of the present application will not be repeated here.
[0165] In some embodiments, the electronic device may also obtain the amount of data accessed by the processor to the memory. If the amount of data accessed by the processor to the memory is greater than a first data amount threshold, or if the amount of data accessed by the processor to the memory is less than a second data amount threshold, the frequency of the memory is adjusted according to the amount of data accessed.
[0166] The amount of data accessed by the processor to the memory obtained by the electronic device here refers to the amount of data accessed by the processor to the memory within a unit cycle. In this case, the amount of accessed data can be called the access bandwidth of the processor.
[0167] The first data volume threshold and the second data volume threshold can both be set in advance. The first data volume threshold is smaller than the second data volume threshold.
[0168] If the amount of data accessed by the processor to the memory is greater than the first data amount threshold, it indicates that the processor currently has a large access bandwidth requirement. Therefore, the frequency of the memory can be adjusted according to the access data amount to ensure dynamic frequency supply to match the current access bandwidth requirement and avoid insufficient frequency supply.
[0169] If the amount of data accessed by the processor to the memory is less than the second data amount threshold, it means that the processor's current access bandwidth requirement is relatively small. Therefore, the frequency of the memory can be adjusted according to the access data amount to ensure dynamic frequency supply to match the current access bandwidth requirement and avoid frequency oversupply.
[0170] Optionally, the operation of the electronic device adjusting the frequency of the memory according to the access data volume may be: determining a second target frequency according to the access data volume; and adjusting the frequency of the memory according to the second target frequency.
[0171] Optionally, when the electronic device determines the second target frequency according to the access data volume, the access data volume may be divided by the bus width to obtain a second initial frequency, and then the second initial frequency may be amplified to obtain the second target frequency.
[0172] For example, when the electronic device performs amplification processing on the second initial frequency, the second initial frequency may be added to a preset amplification parameter to obtain the second target frequency.
[0173] The operation of the electronic device adjusting the frequency of the memory according to the second target frequency is similar to the operation of the electronic device adjusting the frequency of the memory according to the first target frequency, and will not be described in detail in the embodiments of the present application.
[0174] In an embodiment of the present application, the electronic device periodically obtains processor performance data and device operation information. When it is determined that the first preset condition is met according to the device operation information, the frequency of the memory is adjusted according to the processor performance data. In this way, the frequency modulation can be triggered in time according to the operation of the electronic device to avoid the problem of adjustment lag, thereby ensuring dynamic frequency supply, and then avoiding the problem of power consumption waste caused by excessive frequency supply or poor performance caused by insufficient frequency supply, so that the system performance and power consumption have better performance.
[0175] Combine the following Figure 1 The SOC architecture shown, Figure 3 The software system of the electronic device shown, and Figure 5 The frequency adjustment schematic diagram shown is used to exemplarily illustrate the above frequency adjustment method.
[0176] like Figure 5 As shown, optionally, the frequency modulation module can periodically obtain processor performance data, and for example, the processor performance data can be PMU data of the processor. Optionally, the frequency modulation module can obtain the amount of data accessed by the processor to the memory.
[0177] Optionally, the scheduling module may periodically obtain frame loss information, and may predict whether there is a risk of jamming based on the frame loss information. Optionally, the scheduling module may periodically obtain the processor core state. The processor core state includes the state of each processor core in one or more processor cores of the processor. The state of a processor core may include a sleep state and a running state. Optionally, the scheduling module may periodically obtain the system load, for example, the system load may be the processor load, which represents the busyness of the processor.
[0178] Optionally, the temperature control module can identify user scenarios, for example, the user scenarios can include user operation scenarios (including but not limited to user touch screen operation scenarios) and non-user operation scenarios (including but not limited to non-user touch screen operation scenarios). Optionally, the frequency modulation module can periodically detect the device temperature.
[0179] It should be noted that the frequency modulation module can exist independently as a separate module, or the frequency modulation module can also be included in the BUSDCVS module.
[0180] In some embodiments, the scheduling module can notify the frequency modulation module that there is a risk of jamming when determining that there is a risk of jamming according to the frame loss information. In some embodiments, the scheduling module can notify the frequency modulation module that the current system load is too high or too low when the system load is too high or too low.
[0181] In some embodiments, when the user scene changes, such as when the user scene changes from a user operation scene to a non-user operation scene, or when the user scene changes from a non-user operation scene to a user operation scene, the temperature control module can notify the frequency modulation module that the current user scene has changed. In some embodiments, when the device temperature is too high, the scheduling module can notify the frequency modulation module that the current device temperature is too high.
[0182] In some embodiments, the frequency modulation module may periodically obtain one or more of frame loss information, processor core status, and system load from the scheduling module, and periodically obtain one or more of user scenarios and device temperature from the temperature control module.
[0183] In some embodiments, the frequency modulation module can obtain one or more of frame loss information, processor core status, and system load from the scheduling module, and obtain one or more of user scenarios and device temperatures from the temperature control module when receiving a notification from the scheduling module (such as the above-mentioned notification for reminding that there is a risk of lag, the above-mentioned notification for reminding that the system load is too high or too low), and / or when receiving a notification from the temperature control module (such as the above-mentioned notification for reminding users that the scene has changed, the notification for reminding that the device temperature is too high).
[0184] The frequency modulation module can adjust the memory frequency according to one or more of the above-mentioned processor performance data, the amount of data accessed by the processor to the memory, the user scenario, the system load, the processor core status, the device temperature, and the frame loss information. In this way, frequency modulation can be performed with reference to multiple factors, thereby ensuring dynamic frequency supply, thereby avoiding the problem of power consumption waste caused by excessive frequency supply or poor performance caused by insufficient frequency supply.
[0185] The following is an exemplary description of the frequency adjustment process of the processor cache, system cache, and main memory respectively:
[0186] In the first case, assuming that the memory mentioned above is a processor cache, the frequency adjustment process of the processor cache is as follows:
[0187] The processor is provided with a timer 1, which can obtain processor performance data when the time interval is greater than a preset watermark, that is, the processor performance data can be obtained periodically.
[0188] The frequency modulation module is provided with a timer 2, which can obtain processor performance data from the processor when the time interval is greater than a preset watermark, that is, the processor performance data can be periodically obtained from the processor.
[0189] The frequency modulation module may periodically obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and periodically obtain one or more of the user scenario and the device temperature from the temperature control module. Optionally, the frequency modulation module may obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and obtain one or more of the user scenario and the device temperature from the temperature control module upon receiving a notification from the scheduling module and / or the temperature control module.
[0190] The frequency modulation module can determine the processor cache frequency based on one or more of the above processor performance data, user scenario, system load, processor core status, device temperature, and frame loss information. The specific determination process has been described above. Figure 4 The embodiments are described in detail, and the embodiments of the present application will not be repeated. After the frequency modulation module determines the processor cache frequency, it can call the underlying interface to set the processor cache frequency to achieve the adjustment of the processor cache frequency.
[0191] In the second case, assuming that the memory mentioned above is the system cache, the frequency adjustment process of the system cache is as follows:
[0192] The processor is provided with a timer 1, which can obtain processor performance data when the time interval is greater than a preset watermark, that is, the processor performance data can be obtained periodically.
[0193] The frequency modulation module is provided with a timer 2, which can obtain processor performance data from the processor when the time interval is greater than a preset watermark, that is, the processor performance data can be periodically obtained from the processor.
[0194] The system cache is provided with a hardware register, which can record the amount of data accessed by the processor to the system cache. In addition, a monitor can be set for the system cache, which can periodically read the hardware register to obtain the amount of data accessed by the processor to the system cache in the previous cycle, and when the amount of data accessed is greater than a preset data amount threshold, the monitor sends an interrupt notification carrying the amount of data accessed to the frequency modulation module. For example, the interrupt notification can be generated by hardware support and can be configured by a DTS file.
[0195] The frequency modulation module may periodically obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and periodically obtain one or more of the user scenario and the device temperature from the temperature control module. Optionally, the frequency modulation module may obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and obtain one or more of the user scenario and the device temperature from the temperature control module upon receiving a notification from the scheduling module and / or the temperature control module.
[0196] The frequency modulation module can determine the system cache frequency according to one or more of the above processor performance data, the amount of data accessed by the processor to the system cache, the user scenario, the system load, the processor core status, the device temperature, and the frame loss information. The specific determination process has been described above. Figure 4 The embodiments have been described in detail, and the embodiments of the present application will not be repeated. After the frequency modulation module determines the system cache frequency, it can call the bottom interface to set the system cache frequency to achieve the adjustment of the system cache frequency.
[0197] In the second case, assuming that the memory described above is the main memory, the frequency adjustment process of the main memory is as follows:
[0198] The processor is provided with a timer 1, which can obtain processor performance data when the time interval is greater than a preset watermark, that is, the processor performance data can be obtained periodically.
[0199] The frequency modulation module is provided with a timer 2, which can obtain processor performance data from the processor when the time interval is greater than a preset watermark, that is, the processor performance data can be periodically obtained from the processor.
[0200] The main memory is provided with a hardware register, which can record the amount of data accessed by the processor to the main memory. In addition, a monitor can be set for the main memory, and the monitor can periodically read the hardware register to obtain the amount of data accessed by the processor to the main memory in the previous cycle, and when the amount of accessed data is greater than a preset data amount threshold, the monitor sends an interrupt notification carrying the amount of accessed data to the frequency modulation module. For example, the interrupt notification can be generated by hardware support and can be configured by a DTS file.
[0201] The frequency modulation module may periodically obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and periodically obtain one or more of the user scenario and the device temperature from the temperature control module. Optionally, the frequency modulation module may obtain one or more of the frame loss information, the processor core state, and the system load from the scheduling module, and obtain one or more of the user scenario and the device temperature from the temperature control module upon receiving a notification from the scheduling module and / or the temperature control module.
[0202] The frequency modulation module can determine the main memory frequency according to one or more of the above processor performance data, the amount of data accessed by the processor to the main memory, the user scenario, the system load, the processor core status, the device temperature, and the frame loss information. The specific determination process has been described above. Figure 4The embodiments have been described in detail, and the embodiments of the present application will not repeat them in detail. After the frequency modulation module determines the main memory frequency, it can call the bottom layer interface to set the main memory frequency to achieve the adjustment of the main memory frequency.
[0203] Figure 6 is a structural diagram of a frequency adjustment device provided in an embodiment of the present application. The device can be implemented by software, hardware or a combination of both to become part or all of an electronic device. The electronic device can be the above Figures 2 to 3 The electronic device 100 described in the embodiment. Figure 6 The device includes: a first acquisition module 601, a second acquisition module 602 and an adjustment module 603.
[0204] The first acquisition module 601 is used to execute the above Figure 4 Step 401 in the embodiment;
[0205] The second acquisition module 602 is used to execute the above Figure 4 Step 402 in the embodiment;
[0206] Adjustment module 603, used to execute the above Figure 4 Step 403 in the embodiment.
[0207] In an embodiment of the present application, processor performance data is periodically obtained, and device operation information is obtained. When it is determined that the first preset condition is met according to the device operation information, the frequency of the memory is adjusted according to the processor performance data. In this way, frequency modulation can be triggered in time according to the device operation status to avoid the problem of adjustment lag, thereby ensuring dynamic frequency supply, and further avoiding the problem of power consumption waste caused by excessive frequency supply or poor performance caused by insufficient frequency supply, so that the system has better performance and power consumption.
[0208] It should be noted that: the frequency adjustment device provided in the above embodiment only uses the division of the above-mentioned functional modules as an example to illustrate the frequency adjustment. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0209] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.
[0210] The frequency adjustment device and the frequency adjustment method provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.
[0211] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).
[0212] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.
Claims
1. A frequency adjustment method, characterized in that: Applied to an electronic device, the electronic device includes a processor and a memory, and the method includes: Periodically obtain processor performance data; Acquiring device operation information, wherein the device operation information includes user scenarios and / or system load; If it is determined according to the device operation information that the first preset condition is met, the frequency of the memory is adjusted according to the processor performance data.
2. The method according to claim 1, characterized in that The method further comprises: Each time the processor performance data is obtained, the frequency of the memory is adjusted according to the processor performance data.
3. The method according to claim 1, characterized in that The method further comprises: If the amount of data accessed by the processor to the memory is greater than a first data amount threshold, or if the amount of data accessed by the processor to the memory is less than a second data amount threshold, the frequency of the memory is adjusted according to the amount of accessed data.
4. The method according to any one of claims 1 to 3, characterized in that: The device operation information includes a user scenario, and the first preset condition is: the user scenario is a non-user operation scenario; or, The device operation information includes a system load, and the first preset condition is: the system load is less than a first load threshold; or, The device operation information includes a user scenario and a system load, and the first preset condition is: the user scenario is a non-user operation scenario and the system load is less than a first load threshold, or, the user scenario is a user operation scenario and the system load is less than the first load threshold, or, the user scenario is a non-user operation scenario, the system load is greater than a second load threshold, and the performance of the processor has not deteriorated.
5. The method according to any one of claims 1 to 4, characterized in that: The adjusting the frequency of the memory according to the processor performance data comprises: If the processor performance data satisfies the frequency adjustment condition, calculating the frequency of the processor according to the processor performance data; Determining a first target frequency by a preset algorithm according to the frequency of the processor; The frequency of the memory is adjusted according to the first target frequency.
6. The method according to claim 1, characterized in that The method further comprises: If it is determined according to the device operation information that the second preset condition is met, obtaining the frequency of the processor; Determining a first target frequency by a preset algorithm according to the frequency of the processor; The frequency of the memory is adjusted according to the first target frequency.
7. The method according to claim 6, characterized in that The device operation information includes a user scenario, and the second preset condition is: the user scenario is a user operation scenario; or, The device operation information includes a system load, and the second preset condition is: the system load is greater than a second load threshold; or, The device operation information includes a user scenario and a system load, and the second preset condition is: the user scenario is a user operation scenario and the system load is greater than a second load threshold, or the user scenario is a non-user operation scenario, the system load is greater than the second load threshold and the performance of the processor deteriorates.
8. The method according to any one of claims 5 to 7, characterized in that: The device operation information further includes frame loss information, and the method further includes: Detecting whether there is a risk of freeze according to the frame loss information; Before adjusting the frequency of the memory according to the first target frequency, the method further includes: If the risk of freezing is detected within a preset time period before the current moment, the first target frequency is increased.
9. The method according to any one of claims 5 to 8, characterized in that: The device operation information further includes device temperature, and adjusting the frequency of the memory according to the first target frequency includes: When the device temperature is greater than or equal to a first temperature threshold and less than or equal to a second temperature threshold, if the first target frequency is less than a first preset frequency, the frequency of the memory is adjusted to the first preset frequency; if the first target frequency is greater than the second preset frequency, the frequency of the memory is adjusted to the second preset frequency; if the first target frequency is greater than or equal to the first preset frequency and less than or equal to the second preset frequency, the frequency of the memory is adjusted to the first target frequency.
10. The method according to any one of claims 5 to 9, characterized in that: The device operation information further includes a device temperature, and determining the frequency of the memory according to the first target frequency includes: When the device temperature is greater than a second temperature threshold, the frequency of the memory is adjusted to the first target frequency.
11. The method according to any one of claims 1 to 10, characterized in that: The processor includes one or more processor cores, the device operation information also includes a processor core state, and before adjusting the frequency of the memory according to the processor performance data, the method further includes: The performance data of the processor cores whose processor core states are in a dormant state are filtered out from the processor performance data.
12. The method according to any one of claims 1 to 11, characterized in that: The memory is a processor cache, a system cache, or a main memory.
13. An electronic device, characterized in that: The electronic device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 12 when executed by the processor.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Core-level dynamic voltage and frequency scaling in a chip multiprocessor
CN104205087A
Memory running frequency adjusting method and device, storage medium and electronic equipment
CN111324196A
Energy efficiency optimization method suitable for mobile application processor
CN113434286A
Scheduling method, scheduling device and storage medium
CN114610496A
Processing device, processing method and related equipment
CN116710904A