CN110795323A - Load statistical method, device, storage medium and electronic equipment - Google Patents

Load statistical method, device, storage medium and electronic equipment Download PDF

Info

Publication number
CN110795323A
CN110795323A CN201911038787.XA CN201911038787A CN110795323A CN 110795323 A CN110795323 A CN 110795323A CN 201911038787 A CN201911038787 A CN 201911038787A CN 110795323 A CN110795323 A CN 110795323A
Authority
CN
China
Prior art keywords
load
process group
group
determining
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911038787.XA
Other languages
Chinese (zh)
Inventor
高龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201911038787.XA priority Critical patent/CN110795323A/en
Publication of CN110795323A publication Critical patent/CN110795323A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3452Performance evaluation by statistical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3438Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment monitoring of user actions
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses a load statistical method, a device, a storage medium and an electronic device, wherein the method comprises the following steps: acquiring a currently running process, and determining a process group to which the process belongs in a process group set; determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies; and adopting the target load tracking strategy to count the current load of the process. Therefore, by adopting the embodiment of the application, the system performance and the power consumption can be balanced.

Description

Load statistical method, device, storage medium and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a load statistics method and apparatus, a storage medium, and an electronic device.
Background
The current load tracking mechanism of the android Linux kernel mainly includes a window assisted load tracking (walt) mechanism and a per-entity load tracking (pelt) mechanism, and the load tracking mechanisms realize load tracking of a process based on statistics of historical loads of the process. When the load of each process is counted, the loads of all the processes in the system are treated equally, a consistent load tracking strategy is applied, and the system performance and the power consumption cannot be balanced according to the mode.
Disclosure of Invention
The embodiment of the application provides a load statistical method and device, a storage medium and electronic equipment, which can balance system performance and power consumption. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a load statistics method, where the method includes:
acquiring a currently running process, and determining a process group to which the process belongs in a process group set;
determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and adopting the target load tracking strategy to count the current load of the process.
In a second aspect, an embodiment of the present application provides a load statistics apparatus, where the apparatus includes:
the process group determining module is used for acquiring the currently running process and determining the process group to which the process belongs in the process group set;
the strategy determining module is used for determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and the load counting module is used for counting the current load of the process by adopting the target load tracking strategy.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides an electronic device, which may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
in the embodiment of the application, a process group to which a process belongs is determined in a process group set by acquiring a currently running process, a target load tracking strategy corresponding to the process group is determined based on the corresponding relation between different process groups and different load tracking strategies, and then the current load of the process is counted by adopting the target load tracking strategy. The process of the system is classified into different process groups in advance, different load tracking strategies are configured for the different process groups, so that when the current process is operated, the load of the process is counted by adopting the adaptive load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the process with high performance requirement can better meet the performance, the user experience of the application is further improved, and the load tracking strategy with low load calculated by applying the application with low performance requirement is used for the application with low performance requirement, so that the power consumption of the system is saved, and the endurance of the system is prolonged.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a load statistics method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a load statistics method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a load statistics apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a load statistics apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The load statistics method provided by the embodiment of the present application will be described in detail below with reference to fig. 1 to fig. 2. The method may be implemented in dependence on a computer program, operable on a load statistics apparatus based on the von neumann architecture. The computer program may be integrated into the application or may run as a separate tool-like application. The load statistics apparatus in this embodiment may be a user terminal, where the user terminal includes but is not limited to: a smartphone, personal computer, tablet, handheld device, in-vehicle device, wearable device, computing device, or other processing device connected to a wireless modem, and the like.
Fig. 1 is a schematic flow chart of a load statistics method according to an embodiment of the present application. As shown in fig. 1, the method of the embodiment of the present application may include the steps of:
s101, acquiring a currently running process, and determining a process group to which the process belongs in a process group set;
a process is often defined as the execution of a program. A process can be viewed as a stand-alone program with its complete data space and code space in memory.
The process is a basic unit for representing resource allocation and is also a basic unit for scheduling operation. For example, a user runs his or her own program, and the system creates a process and allocates resources for it, including various tables, memory space, disk space, I/O devices, etc. The process is then added to the process' ready queue. The process scheduler chooses it, allocates the CPU and other related resources to it, and the process is actually running. A process is therefore the unit of concurrent execution in the system.
In operating systems such as Mac and Windows NT that use a microkernel architecture, the functions of processes are changed, and they are only the units of resource allocation, not the units of scheduling operation. In a microkernel system, the basic unit for really scheduling the operation is a thread. Thus, the unit of implementing the concurrency function is a thread.
A thread (thread) is a program that runs alone in a process. That is, threads exist within a process, and typically at least one thread may be included in a process. The thread can utilize the resources owned by the process, and in an operating system introducing the thread, the process is generally used as a basic unit for allocating the resources, and the thread is used as a basic unit for independently running and independently scheduling. Because the thread is smaller than the process and basically does not possess system resources, the overhead for scheduling the thread is much smaller, and the concurrent execution degree among a plurality of programs of the system can be more efficiently improved.
The process group set is a classification of all processes included in the system, so that different process groups are generated. The specific classification may be based on attributes of each process. Basic properties of a process may include: process name, application type, application identification, environmental data, user data, priority, degree of demand on CPU frequency or degree of demand on response speed, etc. The application type is the type of the application selected to be started when the trigger message is received by the start queue.
In the concrete implementation, the attribute of the currently running process is obtained, the attribute of the process is sequentially matched with the attribute of each process group in the process group set, the target attribute matched with the attribute of the process is obtained, and the process group corresponding to the target attribute to which the process belongs is determined. The currently running process may be one or more. When there are a plurality of processes, each process is processed in the same manner, thereby determining a process group to which each process belongs.
S102, determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and (3) a load tracking strategy is a load statistical algorithm. It can be understood that a plurality of process groups are recorded in the system in advance, and a plurality of load tracking strategies are defined, and different process groups correspond to different load tracking strategies, so as to keep balance between system performance and power consumption.
For example, the process group set includes a foreground process group, a background process group, and a top level process group. The foreground process group comprises foreground processes of the system, the background process group comprises background processes of the system, and the top process group comprises top processes of the system. The foreground process group, the background process group and the top-level process group constitute all processes of the system.
Wherein, the top-level process is more biased towards performance, and the corresponding load tracking strategy can be the maximum value of five historical load tracking records; if the background process has low performance requirement, the corresponding load tracking strategy is the average value of five historical load tracking records; the performance requirement of the foreground process is between that of the top process and that of the background process, and the corresponding load tracking strategy is the larger one of the average value of five historical load tracking records and the latest one. Therefore, further subdivision control can be realized by applying different load tracking strategies, so that the performance of the process with high performance requirement can be better met, the user experience of the application is further improved, the load tracking strategy with low load calculated by applying the application with low performance requirement is used for saving the power consumption of the system, and the endurance of the system is prolonged.
As shown in table 1, a table of correspondence between each process group in the cached process group set and the load tracking policy is shown.
TABLE 1
Figure BDA0002252286840000051
S103, counting the current load of the process by adopting the target load tracking strategy.
The current load is a Central Processing Unit (CPU) load currently occupied by the process. The CPU is an arithmetic core and a control core of a computer, and is a final execution unit for information processing and program operation. The CPU includes an arithmetic logic unit, a register unit, a control unit, and the like, and has functions of processing instructions, performing operations, controlling time, processing data, and the like.
The performance of a CPU is mainly reflected in the speed at which it runs programs. The performance indexes affecting the running speed comprise parameters such as the working frequency of a CPU, the Cache capacity, an instruction system, a logic structure and the like. The CPU load is the CPU utilization rate, when the CPU utilization rate is high, the running speed of the CPU is low, and the use of the CPU can be limited through CPU frequency modulation.
The current time may be understood as the current time, and may also be understood as the current time window.
Wherein, if the current is understood as the current time, the statistics of the process load are real-time or periodic.
If the current is understood to be the current time window, then the statistics for the process load are the total load over a period of time. The time window is a period of time from a certain moment, and is periodic. The current time window refers to a period of time in the future from the current time, that is, a time window starting from the current time in the periodic time window. Different processes are operated in each time window, and the occupied CPU load is different.
Specifically, after a target load tracking strategy corresponding to the process is determined, the CPU load currently occupied by the process is counted according to the strategy.
For example, if the target load tracking policy is the maximum value of five historical load tracking records, five load values randomly corresponding to the process at historical time are obtained, and the maximum value is determined as the current load of the process.
For a CPU, the total load of the CPU is mainly from the number of processes running on the CPU, the number of processes ready in the queue and the number of uninterruptable processes.
The number of transactions that the CPU can process in parallel should be the number of CPU cores, and it is generally preferable that the number of loads does not exceed the number of cores. For example, if a 4-core CPU is used, the maximum CPU load is 4, and cannot exceed 4 for a long time, otherwise tasks are not processed in time, so that the load of the system is increased cumulatively, and the system runs slowly.
It should be noted that most loads in Unix systems only record processes that are running and running, but Linux differs in that it includes processes that are not interrupted and are sleeping. When these processes are unable to run due to I/O blocking, the CPU load may be significantly increased. The load of the CPU under Unix and Linux is calculated differently.
When the CPU load is higher, some processes influencing the CPU load can be killed through kill and killlal, and the purpose of reducing the CPU load is achieved.
In the embodiment of the application, a process group to which a process belongs is determined in a process group set by acquiring a currently running process, a target load tracking strategy corresponding to the process group is determined based on the corresponding relation between different process groups and different load tracking strategies, and then the current load of the process is counted by adopting the target load tracking strategy. The process of the system is classified into different process groups in advance, different load tracking strategies are configured for the different process groups, so that when the current process is operated, the load of the process is counted by adopting the adaptive load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the process with high performance requirement can better meet the performance, the user experience of the application is further improved, and the load tracking strategy with low load calculated by applying the application with low performance requirement is used for the application with low performance requirement, so that the power consumption of the system is saved, and the endurance of the system is prolonged.
Fig. 2 is a schematic flow chart of a load statistics method according to an embodiment of the present application. The embodiment shown in fig. 2 differs from the embodiment shown in fig. 1 in that the specific manner of generating the process group, the specific implementation of different load tracking strategies, and the process of performing CPU frequency tuning based on the current load of the process are emphasized, and the load statistical method may include the following steps:
s201, acquiring all processes of a system, and dividing all the processes by adopting a derived control group strategy to generate a process group set, wherein the process group set comprises at least one of a foreground process group, a background process group and a top-level process group;
the system comprises a plurality of processes, each process has different functions, so that the requirements of the processes on the CPU resources are different, the scheduling of the processes has priority, and the priority of the processes determines the priority distribution of the CPU resources of one process. The priority of CPU resource allocation refers to the priority of the process.
For multiple processes, the processes may run in parallel or concurrently on the CPU. Wherein, a plurality of processes run under a plurality of CPUs respectively and simultaneously, which is called as parallel. Multiple processes are switched under one CPU in a process switching mode, and the multiple processes are all advanced within a period of time, which is called concurrency.
According to the difference of the priority or performance requirement of each process, the processes are divided into a plurality of process groups, including a foreground process group, a background process group, a top-level process group and the like. The foreground process group comprises at least one foreground process, the background process group comprises at least one background process, and the top-level process group comprises at least one top-level process.
The specific implementation mode is that whether each process has interaction with a user is determined through the process performance, if no interaction exists, the process is determined to be a background process, if interaction exists, the user usage amount and the usage frequency corresponding to the process are further obtained, when the user usage amount and/or the usage frequency respectively exceed set standards, the process is determined to be a top-level process, and otherwise, the process is determined to be a foreground process.
The foreground process is a process used by a user and provided with a control terminal, and the program of the foreground interacts with the user, so that higher response speed is required and the priority level is higher.
Background processes, also called daemon processes, are special processes that run in the background. It is independent of the control terminal and periodically performs some kind of task or waits to process some occurring event. The daemon basically does not interact with the user, and the priority level is slightly lower.
The top-level process is more biased to performance, has interaction with users, frequent interaction and/or larger number of users, and has higher priority than the foreground process and the background process.
S202, acquiring a currently running process and acquiring the attribute of the process;
the attributes of the process may include: process name, application type, application identification, environmental data, user data, priority, degree of demand on CPU frequency or degree of demand on response speed, etc. The application type is the type of the application selected to be started when the trigger message is received by the start queue.
S203, matching the attributes of the processes with the attributes of each process group in the process group set in sequence to obtain target attributes matched with the attributes of the processes;
the process group set comprises at least one process group, each process group is provided with process attributes, and the attributes of the currently running process are sequentially compared with the process attributes configured by the process groups, so that matched target attributes are found out from the process attributes configured by the process groups.
S204, determining a process group corresponding to the target attribute to which the process belongs;
s205, determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and (3) a load tracking strategy is a load statistical algorithm. It can be understood that a plurality of process groups are pre-recorded in the system, and a plurality of load tracking policies are defined, and different process groups correspond to different load tracking policies, as shown in table 1, so as to keep the balance of system performance and power consumption.
In the embodiment of the present application, a control group (cgroups) policy is adopted to allocate different load tracking policies to different process groups. Wherein, cgroups is a function of the Linux kernel, and is used to limit, control and separate resources (such as CPU, memory, disk input and output, etc.) of a process group. The original aim of the method is to provide a unified framework for resource management, so that the method not only integrates the existing cpuiset and other subsystems, but also provides an interface for developing new subsystems in the future. The current cgroups are applicable to a variety of application scenarios, from resource control of a single process to realization of operating system Level Virtualization (OS Level Virtualization). cgroups provide the following functions:
the number of resources (Resource limiting) that the process group can use is limited. Such as: the memory subsystem can set a memory use upper limit for the process group, and once the memory used by the process group reaches the limit and then requests for the memory, the OOM (out of memory) is triggered;
priority control of process groups (priority). Such as: a CPU subsystem can be used for allocating a specific CPU share for a certain process group;
the number of resources (Accounting) used by the process group is recorded. Such as: the CPU time used by a certain process group can be recorded by using a CPU access subsystem;
process group Isolation (Isolation). Such as: different namespaces can be used by different process groups by using the ns subsystem so as to achieve the purpose of isolation, and the different process groups have respective process, network and file system mounting spaces;
process group Control (Control). Such as: the process group may be suspended and resumed using the freezer subsystem.
That is, cgroups can manage processes of each process group as a management container of the processes.
S206, when the process group is a top-level process group, acquiring the historical loads of the designated number corresponding to the process;
the historical load is the historical load value of the process before the current time. The designated number is preset and is at least one, such as five.
It can be understood that the historical loads corresponding to the processes before the current time are read in the cache, and several of them are randomly selected from the cache, such as a1, a2, A3, a4, and a 5.
Optionally, the selected historical load is a load with a larger value.
S207, acquiring the maximum load in the historical loads with the specified number, and determining the maximum load as the current load of the process;
the current load is the CPU load currently occupied by the process. The CPU is an arithmetic core and a control core of a computer, and is a final execution unit for information processing and program operation. The CPU includes an arithmetic logic unit, a register unit, a control unit, and the like, and has functions of processing instructions, performing operations, controlling time, processing data, and the like.
The maximum load (e.g., a1) is determined among the plurality of loads a1, a2, A3, a4, and a5, then the current load of the process is a 1.
Optionally, if the currently running process includes multiple processes, which are X, Y, and Z, and the corresponding current loads are a1, B1, and C1, respectively, then the total load of the CPU at this time is obtained based on a1, B1, and C1, which is a1+ B1+ C1, for example.
S208, when the process group is a background process group, acquiring the historical loads of the designated number corresponding to the process;
it can be understood that the historical loads corresponding to the processes before the current time are read in the cache, and several of them are randomly selected from the cache, such as a1, a2, A3, a4, and a 5.
S209, calculating the average load of the historical loads with the specified number, and determining the average load as the current load of the process;
calculating the average value a of a1, a2, A3, a4 and a5 to (a1+ a2+ A3+ a4+ a5)/5, then the current load of the process is a.
S210, when the process group is a foreground process group, acquiring a first historical load of a specified number corresponding to the process within a first time length from the current time and a second historical load corresponding to the process within a second time length from the current time, wherein the first time length is greater than the second time length;
the first historical load may include one or more than one, and the second historical load may also include one or more than one.
When the first historical load comprises a plurality of, such as a1, a2, A3, a4 and a5, respectively, the second historical load comprises one, such as B, and comprises a plurality of, such as B1, B2 and B3, respectively.
The first duration is longer than the second duration, which indicates that the time recording the first historical load is farther from the current time, and the time recording the second historical load is closer to the current time.
S211, calculating the average load of the first historical loads with the specified number, obtaining the larger load in the average load and the second historical loads, and determining the larger load as the current load of the process.
Calculating the average value a of a1, a2, A3, a4 and a5, (a1+ a2+ A3+ a4+ a5)/5, if the second load is B (or B ═ B1+ B2+ B3)/3), when a > B, then the current load of the process is a; when A < B, then the current load of the process is B.
Optionally, after obtaining the loads of all currently running processes, the total load of the CPU may be calculated, and the CPU may be frequency-modulated according to a Dynamic Voltage and Frequency Scaling (DVFS) policy and the total load. A Dynamic Voltage and Frequency Scaling (DVFS) strategy in a Linux kernel is a key strategy related to response speed, power consumption performance and running time of an operating system, a specific frequency modulation algorithm of the DVFS is inseparable from a load tracking mechanism, and under a normal condition, the DVFS drives the frequency modulation processing of a CPU according to a load tracking result.
The performance of a CPU is mainly reflected in the speed at which it runs programs. The performance indexes affecting the running speed comprise parameters such as the working frequency of a CPU, the Cache capacity, an instruction system, a logic structure and the like. The CPU load is the CPU utilization rate, and the CPU frequency is adjusted by combining the CPU load so as to maintain the CPU to run at a proper running speed.
The lower frequency is lower than the normal frequency, the electricity can be saved, the temperature can be reduced, the service life can be prolonged, but the lower frequency is not too low, the system can make mistakes, the higher frequency is called the overclocking frequency, and the overclocking frequency is generally realized by increasing the operating voltage.
The CPU frequency includes the following modes:
ondemand (response on demand mode): the default overclocking mode of the system is automatically adjusted between the maximum frequency and the minimum frequency;
interactive (alternating current circulation mode): the system operation frequency is directly increased to the highest value, then the CPU load is slowly reduced, and the system response is fastest and the power consumption is more in the mode;
conservative (Conservative mode): along with the increase of the CPU load, the frequency is gradually increased to the highest and then is reduced to the lowest, the system response is fast in the mode, and the power consumption is saved compared with an Interactive mode;
smartass: the upgrading of interative and consistency is realized, the actual CPU cannot be reduced to the minimum, the response is fast, and the standby power consumption is realized;
performance (high performance mode): the system runs according to the optimal frequency in the set range, the system is most smooth in the mode, and the power consumption is also the largest;
userpace (user isolation mode): a mode of controlling the speed of the CPU when the controller is in a non-operational state;
powersave (power saving mode): the system runs at low load according to the set minimum frequency, saves electricity but has slow response speed;
lagthree (no delay mode): a CPU throttling strategy tends to conserve power.
In specific implementation, the DVFS automatically optimizes the voltage and operating frequency of the CPU according to the load and the system load, thereby adjusting to operate in a certain adaptive mode.
In the embodiment of the application, a process group to which a process belongs is determined in a process group set by acquiring a currently running process, a target load tracking strategy corresponding to the process group is determined based on the corresponding relation between different process groups and different load tracking strategies, and then the current load of the process is counted by adopting the target load tracking strategy. The process of the system is classified into different process groups in advance, different load tracking strategies are configured for the different process groups, so that when the current process is operated, the load of the process is counted by adopting the adaptive load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the process with high performance requirement can better meet the performance, the user experience of the application is further improved, and the load tracking strategy with low load calculated by applying the application with low performance requirement is used for the application with low performance requirement, so that the power consumption of the system is saved, and the endurance of the system is prolonged.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 3, a schematic structural diagram of a load statistics apparatus according to an exemplary embodiment of the present application is shown. The load statistics means may be implemented as all or part of the user terminal in software, hardware or a combination of both. The apparatus 1 comprises a process group determination module 10, a policy determination module 20 and a load statistics module 30.
A process group determining module 10, configured to obtain a currently running process, and determine a process group to which the process belongs in a process group set;
a policy determining module 20, configured to determine a target load tracking policy corresponding to a process group based on correspondence between different process groups and different load tracking policies;
and the load counting module 30 is configured to count the current load of the process by using the target load tracking policy.
Optionally, as shown in fig. 4, the apparatus further includes:
and the set generating module 40 is configured to acquire all processes of the system, and divide all the processes by using a control group derived policy to generate a process group set.
Optionally, the process group determining module 10 is specifically configured to:
acquiring the attribute of the process;
matching the attributes of the processes with the attributes of each process group in the process group set in sequence to obtain target attributes matched with the attributes of the processes;
and determining a process group corresponding to the target attribute to which the process belongs.
Optionally, the process group set includes at least one of a foreground process group, a background process group, and a top-level process group.
Optionally, when the process group is a top-level process group, the load statistics module 30 is specifically configured to:
acquiring a specified number of historical loads corresponding to the process;
and acquiring the maximum load in the historical loads of the specified number, and determining the maximum load as the current load of the process.
Optionally, when the process group is a background process group, the load statistics module 30 is specifically configured to:
acquiring a specified number of historical loads corresponding to the process;
and calculating the average load of the historical loads of the specified number, and determining the average load as the current load of the process.
Optionally, when the process group is a foreground process group, the load statistics module 30 is specifically configured to:
acquiring a first historical load of a specified number corresponding to the process within a first time length from the current time and a second historical load corresponding to the process within a second time length from the current time, wherein the first time length is greater than the second time length;
and calculating the average load of the first historical loads with the specified number, acquiring the larger load of the average load and the second historical load, and determining the larger load as the current load of the process.
It should be noted that, when the load statistics apparatus provided in the foregoing embodiment executes the load statistics method, only the division of the functional modules is illustrated, and in practical applications, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the load statistics apparatus and the load statistics method provided by the above embodiments belong to the same concept, and details of implementation processes thereof are referred to as method embodiments, which are not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the embodiment of the application, a process group to which a process belongs is determined in a process group set by acquiring a currently running process, a target load tracking strategy corresponding to the process group is determined based on the corresponding relation between different process groups and different load tracking strategies, and then the current load of the process is counted by adopting the target load tracking strategy. The process of the system is classified into different process groups in advance, different load tracking strategies are configured for the different process groups, so that when the current process is operated, the load of the process is counted by adopting the adaptive load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the process with high performance requirement can better meet the performance, the user experience of the application is further improved, and the load tracking strategy with low load calculated by applying the application with low performance requirement is used for the application with low performance requirement, so that the power consumption of the system is saved, and the endurance of the system is prolonged.
An embodiment of the present application further provides a computer storage medium, where the computer storage medium may store a plurality of instructions, where the instructions are suitable for being loaded by a processor and executing the method steps in the embodiments shown in fig. 1 to fig. 2, and a specific execution process may refer to specific descriptions of the embodiments shown in fig. 1 to fig. 2, which are not described herein again.
Please refer to fig. 5, which is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 5, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, memory 1005, at least one communication bus 1002.
Wherein a communication bus 1002 is used to enable connective communication between these components.
The user interface 1003 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Processor 1001 may include one or more processing cores, among other things. The processor 1001 interfaces various components throughout the electronic device 1000 using various interfaces and lines to perform various functions of the electronic device 1000 and to process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 1005 and invoking data stored in the memory 1005. Alternatively, the processor 1001 may be implemented in at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1001 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1001, but may be implemented by a single chip.
The Memory 1005 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 1005 includes a non-transitory computer-readable medium. The memory 1005 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory 1005 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 1005 may optionally be at least one memory device located remotely from the processor 1001. As shown in fig. 5, a memory 1005, which is a type of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a load statistics application.
In the electronic device 1000 shown in fig. 5, the user interface 1003 is mainly used as an interface for providing input for a user, and acquiring data input by the user; and the processor 1001 may be configured to call the load statistics application stored in the memory 1005, and specifically perform the following operations:
acquiring a currently running process, and determining a process group to which the process belongs in a process group set;
determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and adopting the target load tracking strategy to count the current load of the process.
In one embodiment, the processor 1001 further performs the following operations before executing the process of acquiring the current running:
and acquiring all processes of the system, and dividing all the processes by adopting a derived control group strategy to generate a process group set.
In an embodiment, when the processor 1001 determines, in the process group set, a process group to which the process belongs, the following operation is specifically performed:
acquiring the attribute of the process;
matching the attributes of the processes with the attributes of each process group in the process group set in sequence to obtain target attributes matched with the attributes of the processes;
and determining a process group corresponding to the target attribute to which the process belongs.
In one embodiment, the set of process groups includes at least one of a foreground process group, a background process group, and a top level process group.
In an embodiment, when the process group is a top-level process group, the processor 1001 specifically performs the following operations when performing statistics on the current load of the process by using the target load tracking policy:
acquiring a specified number of historical loads corresponding to the process;
and acquiring the maximum load in the historical loads of the specified number, and determining the maximum load as the current load of the process.
In an embodiment, when the process group is a background process group, the processor 1001 specifically performs the following operations when performing statistics on the current load of the process by using the target load tracking policy:
acquiring a specified number of historical loads corresponding to the process;
and calculating the average load of the historical loads of the specified number, and determining the average load as the current load of the process.
In an embodiment, when the process group is a foreground process group, the processor 1001 specifically performs the following operations when performing statistics on the current load of the process by using the target load tracking policy:
acquiring a first historical load of a specified number corresponding to the process within a first time length from the current time and a second historical load corresponding to the process within a second time length from the current time, wherein the first time length is greater than the second time length;
and calculating the average load of the first historical loads with the specified number, acquiring the larger load of the average load and the second historical load, and determining the larger load as the current load of the process.
In the embodiment of the application, a process group to which a process belongs is determined in a process group set by acquiring a currently running process, a target load tracking strategy corresponding to the process group is determined based on the corresponding relation between different process groups and different load tracking strategies, and then the current load of the process is counted by adopting the target load tracking strategy. The process of the system is classified into different process groups in advance, different load tracking strategies are configured for the different process groups, so that when the current process is operated, the load of the process is counted by adopting the adaptive load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the process with high performance requirement can better meet the performance, the user experience of the application is further improved, and the load tracking strategy with low load calculated by applying the application with low performance requirement is used for the application with low performance requirement, so that the power consumption of the system is saved, and the endurance of the system is prolonged.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. A method of load statistics, the method comprising:
acquiring a currently running process, and determining a process group to which the process belongs in a process group set;
determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and adopting the target load tracking strategy to count the current load of the process.
2. The method of claim 1, wherein prior to obtaining the currently running process, further comprising:
and acquiring all processes of the system, and dividing all the processes by adopting a derived control group strategy to generate a process group set.
3. The method of claim 1, wherein determining the process group to which the process belongs in the set of process groups comprises:
acquiring the attribute of the process;
matching the attributes of the processes with the attributes of each process group in the process group set in sequence to obtain target attributes matched with the attributes of the processes;
and determining a process group corresponding to the target attribute to which the process belongs.
4. The method of claim 1, wherein the set of process groups comprises at least one of a foreground process group, a background process group, and a top level process group.
5. The method of claim 4, wherein when the process group is a top-level process group, the using the target load tracking policy to count the current load of the process comprises:
acquiring a specified number of historical loads corresponding to the process;
and acquiring the maximum load in the historical loads of the specified number, and determining the maximum load as the current load of the process.
6. The method of claim 4, wherein when the process group is a background process group, the using the target load tracking policy to count the current load of the process comprises:
acquiring a specified number of historical loads corresponding to the process;
and calculating the average load of the historical loads of the specified number, and determining the average load as the current load of the process.
7. The method of claim 4, wherein when the process group is a foreground process group, the counting the current load of the process using the target load tracking policy comprises:
acquiring a first historical load of a specified number corresponding to the process within a first time length from the current time and a second historical load corresponding to the process within a second time length from the current time, wherein the first time length is greater than the second time length;
and calculating the average load of the first historical loads with the specified number, acquiring the larger load of the average load and the second historical load, and determining the larger load as the current load of the process.
8. A load statistics apparatus, characterized in that the apparatus comprises:
the process group determining module is used for acquiring the currently running process and determining the process group to which the process belongs in the process group set;
the strategy determining module is used for determining a target load tracking strategy corresponding to a process group based on the corresponding relation between different process groups and different load tracking strategies;
and the load counting module is used for counting the current load of the process by adopting the target load tracking strategy.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to carry out the method steps according to any one of claims 1 to 7.
10. An electronic device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 7.
CN201911038787.XA 2019-10-29 2019-10-29 Load statistical method, device, storage medium and electronic equipment Pending CN110795323A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911038787.XA CN110795323A (en) 2019-10-29 2019-10-29 Load statistical method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911038787.XA CN110795323A (en) 2019-10-29 2019-10-29 Load statistical method, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN110795323A true CN110795323A (en) 2020-02-14

Family

ID=69441825

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911038787.XA Pending CN110795323A (en) 2019-10-29 2019-10-29 Load statistical method, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN110795323A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799848A (en) * 2021-02-10 2021-05-14 联想(北京)有限公司 Control method and device
CN112948127A (en) * 2021-03-30 2021-06-11 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal device and readable storage medium
CN113064677A (en) * 2021-02-23 2021-07-02 青岛海尔科技有限公司 Application running method and device, storage medium and electronic device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898870A (en) * 1995-12-18 1999-04-27 Hitachi, Ltd. Load balancing for a parallel computer system by employing resource utilization target values and states
CN102135917A (en) * 2010-11-30 2011-07-27 广东星海数字家庭产业技术研究院有限公司 Inter-Linux operating system progress communication information acquisition method
CN105528277A (en) * 2015-12-10 2016-04-27 北京奇虎科技有限公司 Method and equipment for monitoring target device
CN109101326A (en) * 2018-06-06 2018-12-28 三星电子(中国)研发中心 A kind of background process management method and device
CN109284174A (en) * 2018-09-07 2019-01-29 郑州云海信息技术有限公司 A kind of multi-service process performance statistical method, device and system
CN109542614A (en) * 2018-05-30 2019-03-29 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium
CN109992398A (en) * 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium
CN110032439A (en) * 2018-01-10 2019-07-19 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5898870A (en) * 1995-12-18 1999-04-27 Hitachi, Ltd. Load balancing for a parallel computer system by employing resource utilization target values and states
CN102135917A (en) * 2010-11-30 2011-07-27 广东星海数字家庭产业技术研究院有限公司 Inter-Linux operating system progress communication information acquisition method
CN105528277A (en) * 2015-12-10 2016-04-27 北京奇虎科技有限公司 Method and equipment for monitoring target device
CN109992398A (en) * 2017-12-29 2019-07-09 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium
CN110032439A (en) * 2018-01-10 2019-07-19 广东欧珀移动通信有限公司 Method for managing resource, device, mobile terminal and computer readable storage medium
CN109542614A (en) * 2018-05-30 2019-03-29 Oppo广东移动通信有限公司 Resource allocation method, device, terminal and storage medium
CN109101326A (en) * 2018-06-06 2018-12-28 三星电子(中国)研发中心 A kind of background process management method and device
CN109284174A (en) * 2018-09-07 2019-01-29 郑州云海信息技术有限公司 A kind of multi-service process performance statistical method, device and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
蔡京平等: "一种高可靠分布计算系统的适应性故障侦测方法", 《北京理工大学学报》, no. 01 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112799848A (en) * 2021-02-10 2021-05-14 联想(北京)有限公司 Control method and device
CN113064677A (en) * 2021-02-23 2021-07-02 青岛海尔科技有限公司 Application running method and device, storage medium and electronic device
CN113064677B (en) * 2021-02-23 2023-06-20 青岛海尔科技有限公司 Application running method and device, storage medium and electronic device
CN112948127A (en) * 2021-03-30 2021-06-11 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal device and readable storage medium
CN112948127B (en) * 2021-03-30 2023-11-10 北京滴普科技有限公司 Cloud platform container average load monitoring method, terminal equipment and readable storage medium

Similar Documents

Publication Publication Date Title
EP3245587B1 (en) Systems and methods for providing dynamic cache extension in a multi-cluster heterogeneous processor architecture
US9292068B2 (en) Controlling a turbo mode frequency of a processor
US8683476B2 (en) Method and system for event-based management of hardware resources using a power state of the hardware resources
US9411649B2 (en) Resource allocation method
KR102490908B1 (en) Resource scheduling method and terminal device
CN109906421B (en) Processor core partitioning based on thread importance
EP2725862A1 (en) Resource allocation method and resource management platform
CN109074331B (en) Power reduced memory subsystem with system cache and local resource management
CN109906437B (en) Processor core stall and frequency selection based on thread importance
WO2016115000A1 (en) Hybrid scheduler and power manager
CN110795323A (en) Load statistical method, device, storage medium and electronic equipment
JP2008505389A (en) Method, program storage device, and apparatus for automatically adjusting a virtual memory subsystem of a computer operating system
US20130060972A1 (en) Balancing usage of hardware devices among clients
JP2012118987A (en) Computer implementation method, computer program, and system for memory usage query governor (memory usage query governor)
US20120297216A1 (en) Dynamically selecting active polling or timed waits
CN110795238B (en) Load calculation method and device, storage medium and electronic equipment
US20170212581A1 (en) Systems and methods for providing power efficiency via memory latency control
CN112600761B (en) Resource allocation method, device and storage medium
Fernández-Cerero et al. Energy policies for data-center monolithic schedulers
CN111722697B (en) Interrupt processing system and interrupt processing method
CN111597044A (en) Task scheduling method and device, storage medium and electronic equipment
US8245229B2 (en) Temporal batching of I/O jobs
US20220291962A1 (en) Stack memory allocation control based on monitored activities
CN117546122A (en) Power budget management using quality of service (QOS)
Bhuiyan et al. Capability-aware energy-efficient virtual machine scheduling in heterogeneous datacenters

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination