Application query frequency adjustment method, electronic equipment and storage medium
By monitoring the processor resource occupancy rate and adjusting the query frequency according to the application priority, the system stability problem caused by CPU resource shortage is solved, and resource optimization and user experience improvement are achieved.
Patent Information
- Application Number
- CN202411785148.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
In the case of tight CPU resources, the operation of applications to regularly query system status may occupy too much CPU resources, affecting the operation of other applications and system stability.
By monitoring the current resource occupancy of the processor, when it exceeds the preset threshold, the query frequency of at least some of the applications is sequentially reduced according to the priority of the application to reduce the resource occupancy of the processor.
This method can dynamically adjust the query frequency of the application, optimize resource allocation, reduce the use of CPU resources by query operations, thereby improving system performance, reducing the risk of system crashes and slow response, and improving user experience.
Smart Images

Figure CN119646043A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer network technology, and more specifically to an application query frequency adjustment method, electronic equipment and storage medium. Background Art
[0002] Currently, some applications periodically query the system status (including network connection status, network status, signal strength, and network cell information) during operation, and perform operations such as fault diagnosis and security monitoring based on the queried system status to ensure system stability and safe operation.
[0003] In the related art, the operation of querying the system status (i.e., query operation) performed by the application is usually set to a fixed frequency, that is, the system status is queried at a fixed frequency. This query strategy can run normally when the processor (CPU) resources are sufficient. However, when the CPU resources are tight, these query operations may occupy too much CPU resources, which may affect the operation of other applications and affect the stability of the system.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] The present invention is proposed in view of the above problems. According to one aspect of the present invention, a method for adjusting application query frequency is provided, which is used to adjust the query frequency of multiple application programs querying system status; the method comprises the following steps: Determine the current resource utilization of the processor; When the current resource occupancy rate exceeds a preset occupancy rate threshold, based on a target adjustment strategy, adjusting the query frequency of at least part of the multiple application programs to reduce the resource occupancy rate of the processor; The target adjustment strategy is a strategy for sequentially reducing the query frequency of at least some of the multiple applications based on the priorities of the multiple applications preset by the user; Among them, for any two applications with different priorities among the at least part of the adjusted applications, the query frequency of the application with a higher priority is less than or equal to the query frequency of the application with a lower priority.
[0006] Exemplarily, there are multiple preset occupancy rate thresholds; the target adjustment strategy is a preset adjustment strategy among the multiple preset adjustment strategies corresponding to the preset occupancy rate threshold exceeded by the current resource occupancy rate; the multiple preset adjustment strategies correspond one-to-one to the multiple preset occupancy rate thresholds.
[0007] Exemplarily, the greater the preset occupancy rate threshold that the current resource occupancy rate exceeds is, the greater the number of application programs adjusted by the corresponding preset adjustment policy is.
[0008] Exemplarily, the preset occupancy rate threshold includes a first preset occupancy rate threshold, and when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the target adjustment strategy includes: Based on the priorities of the multiple applications preset by the user, sequentially reduce the query frequency of some of the multiple applications, wherein the some of the applications are applications whose priorities are less than or equal to the first preset priority; or, The preset occupancy rate threshold includes a second preset occupancy rate threshold, and when the current resource occupancy rate exceeds the second preset occupancy rate threshold, the target adjustment strategy includes: Based on the priorities of the multiple applications preset by the user, sequentially reducing the query frequency of each of the multiple applications; or, The preset occupancy rate threshold includes a first preset occupancy rate threshold and a second preset occupancy rate threshold; the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold; wherein, when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the target adjustment strategy includes: based on the priorities of the multiple applications preset by the user, sequentially reducing the query frequency of some of the multiple applications, wherein the some of the applications are applications with priorities less than or equal to the first preset priority; When the current resource occupancy rate exceeds the second preset occupancy rate threshold, the target adjustment strategy includes: based on the priority of the multiple applications preset by the user, sequentially reducing the query frequency of each application in the multiple applications.
[0009] Exemplarily, the priorities include high priority, medium priority and low priority; The step of sequentially reducing the query frequency of some of the multiple applications based on the priorities of the multiple applications preset by the user includes: reducing the query frequency of the application program with the medium priority level to a first preset query frequency; reducing the query frequency of the application program with the low priority level to a second preset query frequency; The first preset query frequency is greater than the second preset query frequency.
[0010] Exemplarily, the priorities include high priority, medium priority and low priority in descending order; The step of sequentially reducing the query frequency of each of the plurality of applications based on the priorities of the plurality of applications preset by the user comprises: reducing the query frequency of the application program with the high priority level to a first preset query frequency; reducing the query frequency of the application programs with the medium priority and the low priority to a second preset query frequency; The first preset query frequency is greater than the second preset query frequency.
[0011] Exemplarily, the method further includes: when the current resource occupancy is less than or equal to a preset occupancy threshold, based on the priorities of the multiple applications preset by the user, restoring the query frequency of at least some of the multiple applications in a progressive manner.
[0012] Exemplarily, the preset occupancy rate threshold comprises a first preset occupancy rate threshold and a second preset occupancy rate threshold, and the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold; When the current resource occupancy rate is less than or equal to a second preset occupancy rate threshold, the priority of the multiple applications preset by the user is based on which the query frequency of at least some of the multiple applications is restored in a progressive manner, including: Based on the priorities of the multiple applications preset by the user, the query frequencies of the applications whose priorities are greater than or equal to the second preset priority among the multiple applications are restored in a progressive manner in sequence; When the current resource occupancy rate is less than or equal to a first preset occupancy rate threshold, the priority of the multiple applications preset by the user is based on which the query frequency of at least some of the multiple applications is restored in a progressive manner, including: Based on the priorities of the multiple applications preset by the user, the query frequency of each application in the multiple applications is restored in sequence in a progressive manner.
[0013] Exemplarily, the priorities include high priority, medium priority and low priority; The method of restoring the query frequencies of the applications whose priorities are greater than or equal to the second preset priority among the multiple applications in a progressive manner based on the priorities of the multiple applications preset by the user comprises: Restoring the query frequency of the application corresponding to the high priority in a first progressive manner; Restoring the query frequency of the application corresponding to the medium priority by a second progressive method; The step of restoring the query frequency of each of the plurality of applications in a progressive manner based on the priorities of the plurality of applications preset by the user comprises: Restoring the query frequency of the application corresponding to the high priority in a first progressive manner; Restoring the query frequency of the application corresponding to the medium priority by a second progressive method; The query frequency of the application corresponding to the low priority is restored in a third progressive manner.
[0014] Exemplarily, determining the current resource occupancy of the processor includes: Based on a preset detection frequency, obtaining the occupancy rate of the processor within a preset time before a current moment; An average of the occupancy rates obtained within the preset time is calculated to determine the current resource occupancy rate of the processor.
[0015] According to another aspect of the present invention, there is provided an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and the processor is used to execute the computer program to implement the above method.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, storing a computer program / instruction, and the computer program / instruction implements the above method when executed by a processor.
[0017] In the above technical solution, when the current resource occupancy rate exceeds (i.e. is greater than) the preset occupancy rate threshold, the query frequency of at least some of the multiple applications can be reduced in turn according to the priority of the application, and after adjustment, the query frequency of the application with a higher priority in at least some of the applications is less than or equal to the query frequency of the application with a lower priority, thereby reducing the resource occupancy rate of the processor. This method can dynamically adjust the query frequency of each application according to the current resource occupancy and the priority of each application, so as to dynamically optimize resource allocation and avoid the query operation of the application occupying too many resources as much as possible, which helps to improve the overall performance of the system and reduce the risk of system crashes and slow responses. In addition, this method of adjusting according to priority can give priority to the execution of the query operation of the application with a higher priority as much as possible when resources are tight, which helps to avoid affecting the user experience as much as possible. In short, this method can improve resource utilization efficiency, ensure system stability, and help improve the user experience.
[0018] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and other purposes, features and advantages of the present invention will become more apparent by describing the embodiments of the present invention in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0020] Figure 1 A schematic flow chart of a method for adjusting application query frequency according to an embodiment of the present invention is shown; Figure 2 A schematic block diagram of an electronic device according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0021] In order to make the purpose, technical scheme and advantages of the present invention more obvious, the exemplary embodiments according to the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments of the present invention, and it should be understood that the present invention is not limited to the exemplary embodiments described herein. Based on the embodiments of the present invention described in the present invention, all other embodiments obtained by those skilled in the art without creative work should fall within the protection scope of the present invention.
[0022] In this article, the so-called application for querying the system status (such as the program for controlling the vehicle-mounted 5G communication module) can be collectively referred to as a diagnostic program. It can be understood that in the vehicle-mounted 5G communication module, the vehicle network V2X, etc., the system status is monitored by setting a diagnostic program to ensure the stable operation of the system. As described above, these diagnostic programs usually perform query operations at a fixed query frequency. When CPU resources are tight, these diagnostic programs still maintain a fixed query frequency, resulting in a reduction in CPU resources available to other applications, which may cause other applications to fail to operate normally (for example, causing other applications to respond slowly or crash), affecting the stability of the system and reducing the user experience. For example, in the vehicle-mounted 5G communication module, if the CPU occupancy rate is too high, it may cause a delay when the vehicle-mounted 5G communication module uploads vehicle data to the cloud; in the vehicle network V2X, vehicles need to share real-time information, and high-precision, low-latency information reporting is required. If the CPU occupancy rate of a vehicle is too high at this time, it will also cause a delay in information upload, which may lead to unexpected accidents. In addition, when the CPU occupancy rate is too high, the system may not respond or even crash. Feedback to customers is that functions fail at irregular times, user experience decreases, and risks are greatly increased. In view of this, the present invention provides an application query frequency adjustment method, electronic device, and storage medium, which can dynamically adjust the query frequency of the application program according to the processor resource occupancy, thereby improving resource utilization efficiency, ensuring system stability, and helping to improve the user experience. The method, electronic device, and storage medium are described in detail below.
[0023] In the following text, unless otherwise specified, the applications referred to are applications for querying system status.
[0024] According to one aspect of the present invention, a method for adjusting application query frequency is provided, the method being used to adjust the query frequency of multiple application programs querying system status. Figure 1 FIG. 2 is a schematic flow chart of a method for adjusting application query frequency according to an embodiment of the present invention. Figure 1 As shown, the method may include the following steps S110 and S120.
[0025] In step S110, the current resource occupancy rate of the processor is determined.
[0026] Alternatively, the current resource occupancy rate may be determined by any existing or future developed means for querying the processor resource occupancy rate. For example, the processor resource occupancy rate may be detected by a system API or a custom detection tool, and the present invention does not limit this.
[0027] Optionally, the current resource occupancy rate determined in step S110 may be a real-time resource occupancy rate detected at the current moment, or may be an average of multiple resource occupancies detected within a preset time before the current moment.
[0028] In step S120, when the current resource occupancy rate exceeds a preset occupancy rate threshold, based on the target adjustment strategy, the query frequency of at least some of the multiple applications is adjusted to reduce the resource occupancy rate of the processor; wherein the target adjustment strategy is a strategy for successively reducing the query frequency of at least some of the multiple applications based on the priorities of the multiple applications preset by the user; wherein, for any two applications of different priorities among at least some of the adjusted applications, the query frequency of the application with a higher priority is less than or equal to the query frequency of the application with a lower priority.
[0029] In this example, the target adjustment strategy is a strategy for reducing the query frequency of at least some of the multiple applications in turn based on the priorities of multiple applications preset by the user. The at least some of the applications can be some applications with lower priorities, or all of the applications. The priority of each application can be set according to the importance of the application, or according to user needs. For example, the priority can include high priority, medium priority, and low priority. For another example, the priority can include P1, P2, P3, etc., which are reduced in turn, and will not be repeated.
[0030] In this example, for any two applications of different priorities among at least some of the adjusted applications, the query frequency of the application with a higher priority is less than or equal to the query frequency of the application with a lower priority. That is, after the adjustment, the query frequency of at least some of the applications shows a downward trend as the priority decreases. In other words, the adjustment strategy is more inclined to reduce the query frequency of the application with a lower priority. This helps ensure that critical or important applications can maintain better performance or responsiveness.
[0031] In the above technical solution, when the current resource occupancy rate exceeds (i.e. is greater than) the preset occupancy rate threshold, the query frequency of at least some of the multiple applications can be reduced in turn according to the priority of the application, and after adjustment, the query frequency of the application with a higher priority in at least some of the applications is less than or equal to the query frequency of the application with a lower priority, thereby reducing the resource occupancy rate of the processor. This method can dynamically adjust the query frequency of each application according to the current resource occupancy and the priority of each application, so as to dynamically optimize resource allocation and avoid the query operation of the application occupying too many resources as much as possible, which helps to improve the overall performance of the system and reduce the risk of system crashes and slow responses. In addition, this method of adjusting according to priority can give priority to the execution of the query operation of the application with a higher priority as much as possible when resources are tight, which helps to avoid affecting the user experience as much as possible. In short, this method can improve resource utilization efficiency, ensure system stability, and help improve the user experience.
[0032] Exemplarily, there are multiple preset occupancy thresholds; the target adjustment strategy is a preset adjustment strategy among the multiple preset adjustment strategies corresponding to the preset occupancy threshold exceeded by the current resource occupancy; and the multiple preset adjustment strategies correspond one-to-one to the multiple preset occupancy thresholds.
[0033] It can be understood that the preset occupancy threshold exceeded by the current resource occupancy rate refers to the maximum preset occupancy threshold among the multiple preset occupancy thresholds exceeded by the current resource occupancy rate. For example, the multiple preset occupancy thresholds include 75%, 85% and 90% in sequence. If the current resource occupancy rate is 87%, the preset occupancy threshold exceeded by the current resource occupancy rate is 85%. If the current resource occupancy rate is 93%, the preset occupancy threshold exceeded by the current resource occupancy rate is 90%.
[0034] In the solution of this example, multiple preset occupancy rate thresholds are set, and each preset occupancy rate threshold is preset with a different preset adjustment strategy. Therefore, the corresponding preset adjustment strategy can be selected according to the current resource occupancy situation, so that the query frequency of different applications can be adjusted more effectively, ensuring that the system can run stably under different resource occupancy situations.
[0035] Exemplarily, the greater the preset occupancy rate threshold value exceeded by the current resource occupancy rate, the greater the number of applications adjusted by the corresponding preset adjustment policy. It can be understood that the greater the preset occupancy rate threshold value, the tighter the system resources. In the solution of this example, as the degree of system resource tightness increases, the number of adjusted applications increases. Therefore, when system resources are relatively tight, resource occupancy can be quickly reduced by adjusting the query frequency of multiple applications, which helps to further ensure system stability.
[0036] Exemplarily, the preset occupancy threshold includes a first preset occupancy threshold. When the current resource occupancy exceeds the first preset occupancy threshold, the target adjustment strategy includes: based on the priorities of multiple applications preset by the user, reducing the query frequency of some of the multiple applications in turn, wherein the some applications are applications whose priorities are less than or equal to the first preset priority.
[0037] The first preset occupancy rate threshold can be set as needed and will not be described in detail.
[0038] In the solution of this example, when the current resource occupancy rate exceeds the first preset occupancy rate threshold, only the query frequency of the application program with a priority less than or equal to the first preset priority is adjusted. In this way, the application program with a higher priority (i.e., greater than the first preset priority) can be prevented from being affected as much as possible while ensuring resource utilization, thereby helping to balance system stability and user experience.
[0039] Exemplarily, the preset occupancy threshold includes a second preset occupancy threshold. When the current resource occupancy exceeds the second preset occupancy threshold, the target adjustment strategy includes: based on the priorities of multiple applications preset by the user, reducing the query frequency of each application in the multiple applications in turn.
[0040] In the solution of this example, the query frequency of each application can be reduced in turn according to the priority of multiple applications. This method can quickly reduce the system resources occupied by the query operation of each application, thereby helping to ensure the stability of the system.
[0041] Exemplarily, the preset occupancy rate threshold includes a first preset occupancy rate threshold and a second preset occupancy rate threshold; the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold.
[0042] Among them, when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the target adjustment strategy includes: based on the priorities of multiple applications preset by the user, reducing the query frequency of some applications among the multiple applications in turn, wherein some applications are applications whose priorities are less than or equal to the first preset priority.
[0043] When the current resource occupancy rate exceeds the second preset occupancy rate threshold, the target adjustment strategy includes: based on the priorities of the multiple application programs preset by the user, sequentially reducing the query frequency of each application program in the multiple application programs.
[0044] In the solution of this example, when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the resource occupancy rate of the processor is reduced by reducing the query frequency of some applications among multiple applications; when the current resource occupancy rate exceeds the second preset occupancy rate threshold, the resource occupancy rate of the processor is reduced by reducing the query frequency of each application among multiple applications. This method can adopt different adjustment methods according to the different levels of resource occupancy tension, so as to more effectively ensure the stability of the system. In addition, this method only adjusts some applications when the resource occupancy tension is relatively low (i.e., it only exceeds the first preset occupancy rate threshold), which can avoid the impact of higher priority applications as much as possible while ensuring resource utilization, thereby helping to balance system stability and user experience.
[0045] Exemplarily, the priorities include high priority, medium priority and low priority; based on the priorities of multiple applications preset by the user, the query frequencies of some of the multiple applications are sequentially reduced, including: reducing the query frequency of applications with medium priority to a first preset query frequency; reducing the query frequency of applications with low priority to a second preset query frequency; wherein the first preset query frequency is greater than the second preset query frequency. In this example, the first preset priority is medium priority.
[0046] The implementation scheme of this example is described below through a specific embodiment. In this embodiment, the high priority is represented by P1, the medium priority is represented by P2, the low priority is represented by P3, the initial query frequency is F1, the first preset query frequency is F2, the second preset query frequency is F3, F1>F2>F3. The first preset occupancy threshold is x1%.
[0047] When the current resource usage exceeds x1%, for applications with priority P1, keep their query frequency unchanged, that is, their query frequency is still P1. For applications with priority F2, reduce their query frequency to F2. For applications with priority F3, reduce their query frequency to F3. In this way, the resource usage of the processor can be reduced by reducing the query frequency of some applications.
[0048] In the above technical solution, when adjusting the query frequency of some applications, different query frequencies are set for applications with different priorities, and the higher the priority, the higher the query frequency. In this way, the impact of optimization on higher priority applications can be avoided or reduced as much as possible while ensuring system stability, which helps to improve user experience.
[0049] Exemplarily, the priorities include high priority, medium priority and low priority in decreasing order; based on the priorities of multiple applications preset by the user, the query frequency of each of the multiple applications is reduced in turn, including: reducing the query frequency of applications with high priority to a first preset query frequency; reducing the query frequency of applications with medium priority and low priority to a second preset query frequency; wherein the first preset query frequency is greater than the second preset query frequency.
[0050] The implementation scheme of this example is described below through a specific embodiment. In this embodiment, the high priority is represented by P1, the medium priority is represented by P2, the low priority is represented by P3, the initial query frequency is F1, the first preset query frequency is F2, the second preset query frequency is F3, F1>F2>F3. The second preset occupancy threshold is x2%.
[0051] When the current resource occupancy rate exceeds x2%, for applications with a priority of P1, its query frequency is reduced to F2. For applications with a priority of F2, its query frequency is reduced to F3. For applications with a priority of F3, its query frequency is reduced to F3. In this way, the resource occupancy rate of the processor can be reduced.
[0052] In the above technical solution, the processor resource occupancy rate is optimized by setting different query frequencies for applications of different priorities. In this way, the impact of the optimization on higher priority applications can be avoided or reduced as much as possible while ensuring system stability, which helps to improve the user experience.
[0053] Exemplarily, the current resource occupancy rate is determined based on the resource occupancy rate of the processor collected by the monitoring module. The monitoring module is also used to issue an early warning signal when the resource occupancy rate of the processor is close to a preset occupancy rate threshold (ie, the difference between the two is less than a preset difference).
[0054] Optionally, the monitoring module can be used to: monitor the resource occupancy rate of the processor; determine whether the difference between the average of the resource occupancy rates monitored for a preset number of consecutive times and a preset occupancy rate threshold is less than a preset difference; if so, issue a warning signal.
[0055] It is understood that the monitoring module can monitor the resource occupancy of the processor at a preset frequency. Therefore, the resource occupancy monitored for a preset number of consecutive times can also be understood as the resource occupancy monitored within a period of time (the period of time is equal to the product of the preset number of times and the preset frequency).
[0056] In the solution of this example, the monitoring module can send an alarm signal to the system executing the method in this article so that the system can make adjustments in advance. For example, when receiving the warning signal, the application performance data during the current high load period can be recorded to facilitate subsequent analysis and optimization. For another example, after receiving the warning signal, the query frequency of applications with lower priority and higher resource usage can be reduced.
[0057] Exemplarily, the method further includes: when the current resource occupancy is less than or equal to a preset occupancy threshold, based on the priorities of the multiple applications preset by the user, gradually restoring the query frequency of at least some of the multiple applications.
[0058] In the solution of this example, when current resources are relatively abundant, the query frequency of at least some of the applications can be restored according to the priorities of the multiple applications, that is, the query frequency of at least some of the applications can be restored to the initial query frequency.
[0059] In this example, for any application in at least some of the applications, the query frequency of the application is restored in a progressive manner. The progressive manner may be: gradually increasing the query frequency of the application according to a preset step value until the query frequency of the application is restored to the initial query frequency. Optionally, the progressive manners corresponding to applications of different priorities in at least some of the applications may be the same or different. For example, the step value used in the progressive manner corresponding to an application with a higher priority in at least some of the applications may be greater than that used for an application with a lower priority.
[0060] According to the above technical solution, the query frequency of at least part of the application can be gradually restored when the current resources are relatively abundant. As a result, the operation of at least part of the application can be quickly restored when the system resources are abundant. This dynamic adjustment method helps to improve the user experience. And the solution of this example can help the system avoid sudden peak loads by gradually restoring the query frequency. By gradually increasing the query frequency, the system can have enough time to adapt and adjust resource allocation, which helps to ensure the stability of the system.
[0061] Exemplarily, the preset occupancy rate threshold includes a first preset occupancy rate threshold and a second preset occupancy rate threshold, and the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold.
[0062] When the current resource occupancy rate is less than or equal to a second preset occupancy rate threshold, based on the priorities of multiple applications preset by the user, the query frequencies of at least some of the multiple applications are restored in a progressive manner, including: based on the priorities of multiple applications preset by the user, the query frequencies of applications whose priorities are greater than or equal to the second preset priority are restored in a progressive manner.
[0063] When the current resource occupancy rate is less than or equal to a first preset occupancy rate threshold, based on the priorities of multiple applications preset by the user, the query frequency of at least some of the multiple applications is restored in a progressive manner in turn, including: based on the priorities of multiple applications preset by the user, the query frequency of each of the multiple applications is restored in a progressive manner in turn.
[0064] Take an example. In this embodiment, high priority is represented by P1, medium priority is represented by P2, low priority is represented by P3, and the initial query frequency is F1. The first preset occupancy threshold is x1%. The second preset occupancy threshold is x2%. The second preset priority is P2. In this embodiment, when the current resource occupancy is less than or equal to x2%, the query frequencies of the application with priority P1 and the application with priority P2 can be restored in a progressive manner. When the current resource occupancy is less than or equal to x1%, the query frequencies of the application with priority P1, the application with priority P2, and the application with priority P3 can be restored in a progressive manner.
[0065] The above technical solution can select to restore the query frequency of applications with different priorities according to the system resource usage, that is, when the system resource abundance is low, the query frequency of applications with higher priority is restored first. This method can give priority to the operation of applications with higher priority, help meet user needs, and improve user experience.
[0066] Exemplarily, the priorities include high priority, medium priority and low priority; based on the priorities of multiple applications preset by the user, the query frequencies of applications among the multiple applications whose priorities are greater than or equal to a second preset priority are restored in a progressive manner, including: restoring the query frequency of applications corresponding to high priority through a first progressive manner; restoring the query frequency of applications corresponding to medium priority through a second progressive manner.
[0067] Based on the priorities of multiple applications preset by the user, the query frequency of each application in the multiple applications is restored in turn in a progressive manner, including: restoring the query frequency of the application corresponding to the high priority through a first progressive method; restoring the query frequency of the application corresponding to the medium priority through a second progressive method; and restoring the query frequency of the application corresponding to the low priority through a third progressive method.
[0068] Optionally, restoring the query frequency of the application corresponding to the high priority in a first progressive manner may include the following steps: gradually restoring the query frequency of the application corresponding to the high priority according to a first preset step size.
[0069] Optionally, restoring the query frequency of the application corresponding to the medium priority in a second progressive manner may include the following steps: gradually restoring the query frequency of the application corresponding to the medium priority according to a second preset step size.
[0070] Optionally, restoring the query frequency of the application corresponding to the low priority in a third progressive manner may include the following steps: gradually restoring the query frequency of the application corresponding to the low priority according to a second preset step size.
[0071] Optionally, the first preset step size, the second preset step size, and the third preset step size may be the same or different. In some embodiments, the first preset step size is greater than the second preset step size, and the second preset step size is greater than the third preset step size. Thus, the query frequency of the application with a higher priority can be restored more quickly, thereby helping to prioritize the operation of the application with a higher priority.
[0072] The above technical solution can restore the query frequency of applications with different priorities in different progressive ways, so as to ensure the operation of each application when system resources are sufficient, which helps to further improve the user experience.
[0073] Exemplarily, step S110, determining the current resource occupancy of the processor, includes: based on a preset detection frequency, obtaining the processor occupancy within a preset time before the current moment; calculating the average of the occupancy obtained within the preset time to determine the current resource occupancy of the processor.
[0074] The preset time can be set as needed and will not be described in detail.
[0075] In the solution of this example, the average occupancy rate of the preset time is used as the current resource occupancy rate. This method can avoid false alarms caused by single detection errors and more accurately determine the current resource occupancy rate, thereby providing a more accurate basis for adjusting the query frequency in subsequent steps.
[0076] According to yet another aspect of the embodiments of the present invention, an electronic device is provided. Figure 2 FIG. 2 shows a schematic block diagram of an electronic device according to an embodiment of the present invention. Figure 2 As shown, the electronic device 200 includes: a processor 210 and a memory 220. The memory 220 stores a computer program, and the processor 210 is used to execute the computer program to implement the above method.
[0077] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided. The storage medium stores a computer program / instruction, and the computer program / instruction implements the above method when executed by a processor. The storage medium may include, for example, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. The computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0078] A person skilled in the art can easily understand the implementation structure, working principle and beneficial effects of the electronic device and the computer-readable storage medium by reading the above method, and will not be described in detail for the sake of brevity.
[0079] Although example embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above example embodiments are merely exemplary and are not intended to limit the scope of the present invention thereto. Various changes and modifications may be made therein by one of ordinary skill in the art without departing from the scope and spirit of the present invention. All such changes and modifications are intended to be included within the scope of the present invention as required by the appended claims.
[0080] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0081] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0082] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0083] Similarly, it should be understood that in order to streamline the present invention and help understand one or more of the various inventive aspects, in the description of the exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, the method of the present invention should not be interpreted as reflecting the following intention: the claimed invention requires more features than the features explicitly stated in each claim. More specifically, as reflected in the corresponding claims, the inventive point is that the corresponding technical problem can be solved with less than all the features of a single disclosed embodiment. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present invention.
[0084] Those skilled in the art will understand that, except for mutually exclusive features, all features disclosed in this specification (including the accompanying claims, abstract and drawings) and all processes or units of any method or device disclosed in this specification may be combined in any combination. Unless otherwise explicitly stated, each feature disclosed in this specification (including the accompanying claims, abstract and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0085] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0086] The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some modules in an electronic device according to an embodiment of the present invention. The present invention may also be implemented as a device program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0087] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
[0088] The above is only a specific embodiment of the present invention or an explanation of a specific embodiment, and the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for adjusting application query frequency, characterized in that: Used to adjust the query frequency of multiple applications querying system status; the method comprises the following steps: Determine the current resource utilization of the processor; When the current resource occupancy rate exceeds a preset occupancy rate threshold, based on a target adjustment strategy, adjusting the query frequency of at least part of the multiple application programs to reduce the resource occupancy rate of the processor; The target adjustment strategy is a strategy for sequentially reducing the query frequency of at least some of the multiple applications based on the priorities of the multiple applications preset by the user; Among them, for any two applications with different priorities among the at least part of the adjusted applications, the query frequency of the application with a higher priority is less than or equal to the query frequency of the application with a lower priority.
2. The method according to claim 1, characterized in that There are multiple preset occupancy rate thresholds; the target adjustment strategy is a preset adjustment strategy among the multiple preset adjustment strategies corresponding to the preset occupancy rate threshold that the current resource occupancy rate exceeds; the multiple preset adjustment strategies correspond one-to-one to the multiple preset occupancy rate thresholds.
3. The method according to claim 2, characterized in that The greater the preset occupancy rate threshold that the current resource occupancy rate exceeds is, the greater the number of application programs adjusted by the corresponding preset adjustment policy is.
4. The method according to claim 1, characterized in that: The preset occupancy rate threshold includes a first preset occupancy rate threshold, and when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the target adjustment strategy includes: Based on the priorities of the multiple applications preset by the user, sequentially reduce the query frequency of some of the multiple applications, wherein the some of the applications are applications whose priorities are less than or equal to the first preset priority; or, The preset occupancy rate threshold includes a second preset occupancy rate threshold, and when the current resource occupancy rate exceeds the second preset occupancy rate threshold, the target adjustment strategy includes: Based on the priorities of the multiple applications preset by the user, sequentially reducing the query frequency of each of the multiple applications; or, The preset occupancy rate threshold includes a first preset occupancy rate threshold and a second preset occupancy rate threshold; the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold; wherein, when the current resource occupancy rate exceeds the first preset occupancy rate threshold, the target adjustment strategy includes: based on the priorities of the multiple applications preset by the user, sequentially reducing the query frequency of some of the multiple applications, wherein the some of the applications are applications with priorities less than or equal to the first preset priority; When the current resource occupancy rate exceeds the second preset occupancy rate threshold, the target adjustment strategy includes: based on the priority of the multiple applications preset by the user, sequentially reducing the query frequency of each application in the multiple applications.
5. The method according to claim 4, characterized in that The priorities include high priority, medium priority and low priority; The step of sequentially reducing the query frequency of some of the multiple applications based on the priorities of the multiple applications preset by the user includes: reducing the query frequency of the application program with the medium priority level to a first preset query frequency; reducing the query frequency of the application program with the low priority level to a second preset query frequency; The first preset query frequency is greater than the second preset query frequency.
6. The method according to claim 4, characterized in that The priorities include high priority, medium priority and low priority in descending order; The step of sequentially reducing the query frequency of each of the plurality of applications based on the priorities of the plurality of applications preset by the user comprises: reducing the query frequency of the application program with the high priority level to a first preset query frequency; reducing the query frequency of the application programs with the medium priority and the low priority to a second preset query frequency; The first preset query frequency is greater than the second preset query frequency.
7. The method according to any one of claims 1 to 6, characterized in that: The method further includes: when the current resource occupancy rate is less than or equal to a preset occupancy rate threshold, based on the priorities of the multiple applications preset by a user, successively and progressively restoring the query frequencies of at least some of the multiple applications; Preferably, the preset occupancy rate threshold comprises a first preset occupancy rate threshold and a second preset occupancy rate threshold, and the second preset occupancy rate threshold is greater than the first preset occupancy rate threshold; When the current resource occupancy rate is less than or equal to a second preset occupancy rate threshold, the priority of the multiple applications preset by the user is based on which the query frequency of at least some of the multiple applications is restored in a progressive manner, including: Based on the priorities of the multiple applications preset by the user, the query frequencies of the applications whose priorities are greater than or equal to the second preset priority among the multiple applications are restored in a progressive manner in sequence; When the current resource occupancy rate is less than or equal to a first preset occupancy rate threshold, the priority of the multiple applications preset by the user is based on which the query frequency of at least some of the multiple applications is restored in a progressive manner, including: Based on the priorities of the multiple applications preset by the user, restoring the query frequency of each of the multiple applications in a progressive manner in turn; Preferably, the priority includes high priority, medium priority and low priority; The method of restoring the query frequencies of the applications whose priorities are greater than or equal to the second preset priority among the multiple applications in a progressive manner based on the priorities of the multiple applications preset by the user comprises: Restoring the query frequency of the application corresponding to the high priority in a first progressive manner; Restoring the query frequency of the application corresponding to the medium priority in a second progressive manner; The step of restoring the query frequency of each of the plurality of applications in a progressive manner based on the priorities of the plurality of applications preset by the user comprises: Restoring the query frequency of the application corresponding to the high priority in a first progressive manner; Restoring the query frequency of the application corresponding to the medium priority in a second progressive manner; The query frequency of the application corresponding to the low priority is restored in a third progressive manner.
8. The method according to any one of claims 1 to 6, characterized in that: The determining the current resource occupancy rate of the processor includes: Based on a preset detection frequency, obtaining the occupancy rate of the processor within a preset time before a current moment; An average of the occupancy rates obtained within the preset time is calculated to determine the current resource occupancy rate of the processor.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that: A computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 8 is implemented.