[go: up one dir, main page]

CN113138909A - 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
CN113138909A
CN113138909A CN202010065063.0A CN202010065063A CN113138909A CN 113138909 A CN113138909 A CN 113138909A CN 202010065063 A CN202010065063 A CN 202010065063A CN 113138909 A CN113138909 A CN 113138909A
Authority
CN
China
Prior art keywords
window
time
load
duration
running
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
CN202010065063.0A
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 CN202010065063.0A priority Critical patent/CN113138909A/en
Publication of CN113138909A publication Critical patent/CN113138909A/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/3409Recording 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 for performance assessment
    • G06F11/3433Recording 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 for performance assessment for load management
    • 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/3409Recording 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 for performance assessment
    • G06F11/3419Recording 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 for performance assessment by assessing time
    • G06F11/3423Recording 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 for performance assessment by assessing time where the assessed time is active or idle time

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

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: when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window; and counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window. Therefore, by adopting the embodiment of the application, the statistical load can be closer to the real load when the process runs across the time window.

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 adopts a Window Assisted Load Tracking (WALT) Load Tracking calculation method, and counts the running time of each process in a certain time Window by dividing the time into a plurality of time windows, as shown in fig. 1, in a Window size period, the process continues to run for a time from s1 to e1 in a first time Window, and then the corresponding Load is (e1-s1)/Window _ size 100%.
Due to the boundary of the time window, when the running time of a process just crosses the boundary of the time window, the running time of the process is divided into two parts and respectively counted in different time windows, which causes the statistical load to be smaller.
Disclosure of Invention
The embodiment of the application provides a load statistical method and device, a storage medium and electronic equipment, and the statistical load can be closer to the real load when a process runs across a time window. 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:
when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
and counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window.
In a second aspect, an embodiment of the present application provides a load statistics apparatus, where the apparatus includes:
the running duration obtaining module is used for obtaining a first running duration of a process in a first time window and obtaining a second running duration of the process in a second time window when the process continuously runs across the first time window and the second time window;
and the load counting module is used for counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window.
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, when a process continuously runs across a first time window and a second time window, a first running time of the process in the first time window is obtained, a second running time of the process in the second time window is obtained, and based on the first running time, the second running time and a window time corresponding to the first time window, the load of the process in a target window is counted, wherein the target window is the first time window or the second time window. Even if the process runs across the windows, the load of a certain time window is calculated by combining the running time of the spanned time windows, and the load is not counted only according to the running time of the certain time window, so that the load calculation accuracy can be improved, and the counted load is closer to the real load.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced 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 any creative work.
Fig. 1 is an exemplary schematic diagram of a running duration of a process within a time window 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 flowchart of a load statistics method according to an embodiment of the present application;
FIG. 4 is an exemplary diagram illustrating a running duration of a process within a time window according to an embodiment of the present application;
FIG. 5 is an exemplary diagram illustrating a running duration of a process within a time window according to an embodiment of the present application;
fig. 6 is a schematic flowchart of a load statistics method according to an embodiment of the present application;
FIG. 7 is an exemplary diagram illustrating a duration of a process running within a time window according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a load statistics apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a load statistics apparatus according to an embodiment of the present application;
fig. 10 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 object, 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 provided by the embodiments of the present application will be described in detail below with reference to fig. 2 to 7. 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 of the present application may be a user terminal, where the user terminal includes, but is not limited to: a smartphone, personal computer, tablet, handheld device, wearable device, computing device, or other processing device connected to a wireless modem, and the like.
Fig. 2 is a schematic flow chart of a load statistics method according to an embodiment of the present application. As shown in fig. 2, the method of the embodiment of the present application may include the steps of:
s101, when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
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 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.
In the embodiment of the present application, a load tracking statistical method of walt (window existing load tracking) is used to count the load of each running process, and the main idea is to divide the time into a plurality of time windows with the size of window _ size (e.g. 20 ms). And counting the running time runtime of each task in each time window. Then the load of the task is: load is 100% runtime/window size.
It should be noted that, the statistics on the process load are in units of time windows, that is, the load of the process within a certain time window is counted.
However, in the embodiment of the present application, the process is a cross-window process, that is, the process continuously runs across a first time window and a second time window, there is a period of running time in the first time window, there is a period of running time in the second time window, and the first time window and the second time window are adjacent time windows.
Specifically, a time starting point of the process running in a first time window is recorded, a time ending point of the process running in a second time window is recorded, the time from the time starting point to a dividing point between the two windows is taken as a first running time length, and the time from the dividing point to the time ending point is taken as a second running time length. Of course, the number of the processes may be one or more, and the same processing manner as described above may be adopted for a plurality of running processes.
Optionally, the system includes multiple processes, each process has a different function, and therefore the process has different requirements for the CPU resource, so that the scheduling of the process has priority, and the priority of the process determines the priority allocation of the CPU resource of one process. The priority of CPU resource allocation refers to the priority of the process.
All processes included in the system are classified in advance, so that different process groups are generated. The specific classification may be based on attributes of each process, such as process name, application type, application identification, environment data, user data, priority, degree of demand on CPU frequency or degree of demand on response speed, etc. The application type refers to the type of application selected to be launched when the launch queue receives the trigger message. Different process groups correspond to different load tracking strategies in order to maintain a balance of system performance and power consumption.
For example, the process groups may include 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 a plurality of historical load tracking records; the background process has low performance requirement, and the corresponding load tracking strategy is the average value of a plurality of 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 and the latest record of the historical multiple load tracking records. Therefore, further subdivision control can be realized by applying different load tracking strategies, so that the performance of a process with high performance requirement can be better met, the user experience of the application is further improved, and the low-load tracking strategy 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.
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. For example, if the target load tracking policy is the maximum value of five historical load tracking records, five load values corresponding to the process randomly at historical time are obtained, and the maximum value is determined as the current load of the process.
TABLE 1
Figure BDA0002375722860000051
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 CPU set 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).
That is, cgroups can manage processes of each process group as a management container of the processes.
Also for example, for foreground processes, a UI thread, a Render thread, and all threads that communicate in real time with either the UI thread or the Render thread are included. The UI thread and the Render thread belong to the UX thread, and the corresponding load tracking policy may be a maximum value of the historical load tracking records, while for the non-UX thread, the corresponding load tracking policy is an average value or a minimum value of the historical load tracking records.
Wherein, a thread is a program which runs independently in one path in a certain 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 independent running and independent scheduling. Because the thread is smaller than the process and basically does not have 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.
S102, counting the load of the process in a target window based on the first operation duration, the second operation duration and the window duration corresponding to the first time window, wherein the target window is the first time window or the second time window.
It can be understood that the load is a Central Processing Unit (CPU) load occupied by the process in the time window. 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 window duration corresponding to each time window is the same, that is, the window duration corresponding to the first time window is the same as the window duration corresponding to the second time window.
Specifically, the first operation duration and the second operation duration are compared, a larger duration is determined, and then the sum of the first operation duration T1 and the second operation duration T2 is calculated to obtain a total operation duration T1+ T2; and calculating a quotient (T1+ T2)/windowsize of the total running time length T1+ T2 and the window time length windowsize corresponding to the first time window, and taking the quotient (T1+ T2)/windowsize as the load of the process in the target window corresponding to the larger time length. Wherein, when the first operation time length T1 is greater than the second operation time T2, the quotient is taken as the load of the process in the first time window W1; when the first operation duration is less than the second operation duration, taking the quotient as the load of the process in the second time window W2; when the first operation duration is equal to the second operation duration, the quotient is taken as the load of the process in the first time window W1 or the second time window W2.
Optionally, the loads of all processes in the target time window may be obtained according to the above manner, and then the CPU is frequency-modulated according to a Dynamic Voltage and Frequency Scaling (DVFS) policy and the load of each process in the target time window. The DVFS strategy in the Linux kernel is a key strategy related to the 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 the result of load tracking.
In the embodiment of the application, even if the process runs across the windows, the load of a certain time window is calculated by combining the running time of the spanned time windows, and the load is not counted only according to the running time of the certain time window, so that the accuracy of load calculation can be improved, the counted load is closer to the real load, and the problem of blocking caused by the smaller counted load can be further optimized. In addition, the processes of the system are classified into different process groups in advance, different load tracking strategies are configured for the different process groups, the loads of the running processes in a time window are counted by adopting the appropriately-matched load tracking strategies, the performance and the power consumption of the system can be effectively balanced, if the performance of the processes with high performance requirements can be better met, the user experience of the application is further improved, the load tracking strategies with lower loads are calculated by applying the applications with low performance requirements, the power consumption of the system is saved, and the endurance of the system is prolonged.
Fig. 3 is a schematic flow chart of a load statistics method according to an embodiment of the present application. The embodiment shown in fig. 3 differs from the embodiment shown in fig. 2 in that the load calculation process of the process across the time window is described with reference to the drawings, and the load statistical method may include the following steps:
s201, when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
in the embodiment of the present application, a load tracking statistical method of WALT is used to count the load of each running process, and a main idea of the method is to divide time into a plurality of time windows with a window _ size, as shown in fig. 4, (n-1) ws to n ws are first time windows, n ws to (n +1) ws are second time windows, and the two adjacent windows have window _ size (for example, 20ms) as a corresponding window duration. Of course, the time window is a periodic window, which includes a plurality.
The process is continuously run, i.e. continuously in time, across a first time window and a second time window, i.e. the total running time runtime is e1-s1, and the running time of each task is counted in each time window, i.e. the first running time of the process in the first time window is T1 and the second running time in the second time window is T2.
S202, acquiring the larger time length of the first operation time length and the second operation time length;
the larger of the T1 and T2 is determined by comparing their magnitudes. Three results of T1> T2, T1< T2 and T1 ═ T2 are included.
If T1> T2, determining the first time window as a running window of the process; if T1< T2, the second time window is determined as the running window of the process, and if T1 is T2, the first time window or the second time window is determined as the running window of the process.
S203, calculating the sum of the first operation time length and the second operation time length to obtain a total operation time length;
the total operating time runtime is e1-s 1T 1+ T2.
S204, when the total operation duration is longer than the window duration, setting the total operation duration as the window duration;
if T1+ T2> window _ size, then runtime is set to window _ size in order to avoid the calculated load being greater than 100%.
S205, calculating a quotient of the total operating duration and the window duration corresponding to the first time window, and taking the quotient as a load of a target window corresponding to the process in the larger duration, wherein the target window is the first time window or the second time window.
Specifically, load is (T1+ T2)/window _ size 100%, when T1+ T2< window _ size, load is < 100%, when T1+ T2> window _ size or T1+ T2 is window _ size, load is 100%.
Therefore, when the first operation duration T1 is greater than the second operation duration T2, the load is taken as the load of the process in the first time window (n-1) ws to n × ws; when the first running duration is less than the second running duration, taking the load as the load of the process in the second time windows n wss to (n +1) ws; when the first operating duration T1 is equal to the second operating duration T2, a load is taken as a load of the process in the first time window (n-1) ws to n ws or the second time window n ws to (n +1) ws.
Optionally, when the process continues to run across more than two time windows, as shown in fig. 5, the process spans the first time window (n-1) ws to n ws, the second time window n ws to (n +1) ws, and the third time window (n +1) ws to (n +2) ws, the corresponding running times are T1, T2, and T3, respectively, T2> T1 and T2> T3, and T2 is window _ size, so that the load of the process in the second time window can be understood as 100%.
In the embodiment of the application, even if the process runs across the windows, the load of the time window with longer running time is counted by calculating the sum of the running times of the plurality of crossed time windows, and the load is calculated in the same way as the process does not run across the windows instead of only counting the load according to the running time in the time window.
Fig. 6 is a schematic flow chart of a load statistics method according to an embodiment of the present application. The embodiment shown in fig. 6 differs from the embodiment shown in fig. 3 in that it is emphasized that the process also includes a non-continuous operation case in the case of cross-window operation, and the load statistical method may include the following steps:
s301, when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
s302, acquiring the larger time length of the first operation time length and the second operation time length;
s301 to S302 can refer to S201 to S202, which are not described herein.
S303, acquiring a third running time length of the process non-continuous running in the target window corresponding to the larger time length;
if T2> T1 and the process is still running for a duration of s2 to e2 for n × ws to (n +1) ws, as shown in fig. 7, then the third operating duration T3 is e2 to s 2.
S304, calculating the sum of the first operation time length, the second operation time length and the third operation time length to obtain a total operation time length;
total running time runtime T1+ T2+ T3 ═ e1-s1) + (e2-s2)
S305, when the total operation duration is longer than the window duration, setting the total operation duration as the window duration;
if (e1-s1) + (e2-s2) > window size, runtime is set to window size.
S306, calculating a quotient of the total operation time length and the window time length corresponding to the first time window, and taking the quotient as a load of a target window corresponding to the process in the larger time length, wherein the target window is the first time window or the second time window.
If T2> T1 and the process is running for a duration of s2 to e2 within n × ws to (n +1) ws, as shown in fig. 7, when (e1-s1) + (e2-s2) < window size, load ═ ((e1-s1) + (e2-s 2))/window _ size × 100%, when (e1-s1) + (e2-s2) > window size, load ═ window size/window _ size × 100%, and the calculated load is determined as the load for the process in the second time window.
If T2< T1, but the process is still running for a duration of s2 to e2 within n × ws to (n +1) ws, runtime ═ e1-s1 ═ T1+ T2, when e1-s1< window size, load ═ e1-s1)/window _ size × (100), when (e1-s1) > window size, load ═ window size/window _ size × (100), and the calculated load is determined as the load for the process in the first time window.
In the embodiment of the application, even if the process runs across the windows, the load in a certain time window is counted by calculating the sum of the running time of the plurality of time windows which are crossed, the load is not counted only according to the running time of the certain time window, the accuracy of load calculation can be improved, and in addition, when the process also comprises the load which does not run continuously in the running time window, the load statistical result of the process is also added, so that the accuracy of load calculation can be further improved. Therefore, the load of the process can be counted through a time window by adopting a WALT load tracking strategy, and the load of the process running across the time window can be accurately counted under the condition of ensuring fast load counting, so that the counted load is closer to the real load, and the problem of blocking caused by small counted load can be further optimized.
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.
Please refer to fig. 8, which shows a schematic structural diagram of a load statistics apparatus according to an exemplary embodiment of the present application. The load statistics means may be implemented as all or part of the user terminal by software, hardware or a combination of both. The device 1 comprises an operating duration acquisition module 10 and a load statistics module 20.
A running duration obtaining module 10, configured to obtain a first running duration of a process in a first time window when the process continuously runs across the first time window and a second time window, and obtain a second running duration of the process in the second time window;
a load counting module 20, configured to count a load of the process in a target window based on the first operation duration, the second operation duration, and a window duration corresponding to the first time window, where the target window is the first time window or the second time window.
Optionally, as shown in fig. 9, the load statistics module 20 includes:
a longer duration obtaining unit 21, configured to obtain a longer duration of the first operating duration and the second operating duration;
a total duration calculation unit 22, configured to calculate a sum of the first operation duration and the second operation duration to obtain a total operation duration;
and a load calculating unit 23, configured to calculate a quotient of the total operation duration and a window duration corresponding to the first time window, and use the quotient as a load of the process in a target window corresponding to the longer duration.
Optionally, the load calculating unit 23 is specifically configured to:
when the first running duration is longer than the second running duration, taking the quotient as the load of the process in the first time window;
when the first running duration is less than the second running duration, taking the quotient as the load of the process in the second time window;
and when the first operation duration is equal to the second operation duration, taking the quotient as the load of the process in the first time window or the second time window.
Optionally, the total duration calculating unit 22 is specifically configured to:
acquiring a third running time length of the process non-continuous running in a target window corresponding to the larger time length;
and calculating the sum of the first operation time length, the second operation time length and the third operation time length to obtain the total operation time length.
Optionally, as shown in fig. 9, the load statistics module 20 further includes a duration setting unit 24, configured to set the total operation duration as the window duration when the total operation duration is greater than the window duration.
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 functions may be distributed 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, when a process continuously runs across a first time window and a second time window, a first running time of the process in the first time window is obtained, a second running time of the process in the second time window is obtained, and based on the first running time, the second running time and a window time corresponding to the first time window, the load of the process in a target window is counted, wherein the target window is the first time window or the second time window. Even if the process runs across the windows, the load of a certain time window is counted by calculating the sum of the running time of a plurality of crossed time windows, the load is not counted only according to the running time of the certain time window, the accuracy of load calculation can be improved, and in addition, when the process also comprises the load which does not run continuously in the running time window, the load counting result of the process is also added, so that the accuracy of load calculation can be further improved. Therefore, the load of the process can be counted through a time window by adopting a WALT load tracking strategy, and the load of the process running across the time window can be accurately counted under the condition of ensuring fast load counting, so that the counted load is closer to a real load, and the problem of blocking caused by small counted load can be further optimized.
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. 2 to 7, and a specific execution process may refer to specific descriptions of the embodiments shown in fig. 2 to 7, which is not described herein again.
Please refer to fig. 10, which provides a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 10, 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, which is connected to various components throughout the electronic device 1000 using various interfaces and lines, performs various functions of the electronic device 1000 and processes 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 hardware using at least one 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. 10, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a load statistics application program.
In the electronic device 1000 shown in fig. 10, the user interface 1003 is mainly used as an interface for providing input for a user, and acquiring data input by the user; the processor 1001 may be configured to call the load statistics application stored in the memory 1005, and specifically perform the following operations:
when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
and counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window.
In an embodiment, when the processor 1001 performs statistics on the load of the process in the target window based on the first running duration, the second running duration, and the window duration corresponding to the first time window, the following operation is specifically performed:
acquiring the larger time length of the first operation time length and the second operation time length;
calculating the sum of the first operation time length and the second operation time length to obtain the total operation time length;
and calculating the quotient of the total operation time length and the window time length corresponding to the first time window, and taking the quotient as the load of the process in the target window corresponding to the larger time length.
In an embodiment, when the processor 1001 executes the load of the process with the quotient as the target window corresponding to the larger duration, specifically execute the following operations:
when the first running duration is longer than the second running duration, taking the quotient as the load of the process in the first time window;
when the first running duration is less than the second running duration, taking the quotient as the load of the process in the second time window;
and when the first operation duration is equal to the second operation duration, taking the quotient as the load of the process in the first time window or the second time window.
In an embodiment, when the process group is a top-level process group, the processor 1001 specifically performs the following operations when calculating the sum of the first running duration and the second running duration to obtain a total running duration:
acquiring a third running time length of the process non-continuous running in a target window corresponding to the larger time length;
and calculating the sum of the first operation time length, the second operation time length and the third operation time length to obtain the total operation time length.
In one embodiment, the processor 1001 further performs the following operations after obtaining the total running time length:
and when the total operation time length is greater than the window time length, setting the total operation time length as the window time length.
In the embodiment of the application, when a process continuously runs across a first time window and a second time window, a first running time of the process in the first time window is obtained, a second running time of the process in the second time window is obtained, and based on the first running time, the second running time and a window time corresponding to the first time window, the load of the process in a target window is counted, wherein the target window is the first time window or the second time window. Even if the process runs across the windows, the load of a certain time window is counted by calculating the sum of the running time of a plurality of crossed time windows, the load is not counted only according to the running time of the certain time window, the accuracy of load calculation can be improved, and in addition, when the process also comprises the load which does not run continuously in the running time window, the load counting result of the process is also added, so that the accuracy of load calculation can be further improved. Therefore, the load of the process can be counted through a time window by adopting a WALT load tracking strategy, and the load of the process running across the time window can be accurately counted under the condition of ensuring fast load counting, so that the counted load is closer to the real load, and the problem of blocking caused by small counted load can be further optimized.
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:
when a process continuously runs across a first time window and a second time window, acquiring a first running time of the process in the first time window, and acquiring a second running time of the process in the second time window;
and counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window.
2. The method of claim 1, wherein the counting the load of the process in the target window based on the first operation duration, the second operation duration and the window duration corresponding to the first time window comprises:
acquiring the larger time length of the first operation time length and the second operation time length;
calculating the sum of the first operation time length and the second operation time length to obtain the total operation time length;
and calculating the quotient of the total operation time length and the window time length corresponding to the first time window, and taking the quotient as the load of the process in the target window corresponding to the larger time length.
3. The method according to claim 2, wherein the using the quotient as the load of the process in the target window corresponding to the larger duration comprises:
when the first running duration is longer than the second running duration, taking the quotient as the load of the process in the first time window;
when the first running duration is less than the second running duration, taking the quotient as the load of the process in the second time window;
and when the first operation duration is equal to the second operation duration, taking the quotient as the load of the process in the first time window or the second time window.
4. The method of claim 2, wherein calculating the sum of the first operating time period and the second operating time period to obtain a total operating time period comprises:
acquiring a third running time length of the process non-continuous running in a target window corresponding to the larger time length;
and calculating the sum of the first operation time length, the second operation time length and the third operation time length to obtain the total operation time length.
5. The method of claim 2 or 4, wherein after obtaining the total operating time period, further comprising:
and when the total operation time length is greater than the window time length, setting the total operation time length as the window time length.
6. A load statistics apparatus, characterized in that the apparatus comprises:
the system comprises a running duration acquisition module, a running duration acquisition module and a running duration acquisition module, wherein the running duration acquisition module is used for acquiring a first running duration of a process in a first time window and acquiring a second running duration of the process in a second time window when the process continuously runs across the first time window and the second time window;
and the load counting module is used for counting the load of the process in a target window based on the first operation time length, the second operation time length and the window time length corresponding to the first time window, wherein the target window is the first time window or the second time window.
7. The apparatus of claim 6, wherein the load statistics module comprises:
a longer duration obtaining unit, configured to obtain a longer duration of the first operating duration and the second operating duration;
a total duration calculation unit, configured to calculate a sum of the first operation duration and the second operation duration to obtain a total operation duration;
and the load calculation unit is used for calculating the quotient of the total operation time length and the window time length corresponding to the first time window, and taking the quotient as the load of the process in the target window corresponding to the larger time length.
8. The apparatus according to claim 7, wherein the load calculating unit is specifically configured to:
when the first running duration is longer than the second running duration, taking the quotient as the load of the process in the first time window;
when the first running duration is less than the second running duration, taking the quotient as the load of the process in the second time window;
and when the first operation duration is equal to the second operation duration, taking the quotient as the load of the process in the first time window or the second time window.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to perform the method steps according to any of claims 1 to 5.
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 5.
CN202010065063.0A 2020-01-20 2020-01-20 Load statistical method, device, storage medium and electronic equipment Pending CN113138909A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010065063.0A CN113138909A (en) 2020-01-20 2020-01-20 Load statistical method, device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010065063.0A CN113138909A (en) 2020-01-20 2020-01-20 Load statistical method, device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN113138909A true CN113138909A (en) 2021-07-20

Family

ID=76809016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010065063.0A Pending CN113138909A (en) 2020-01-20 2020-01-20 Load statistical method, device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113138909A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2590081A2 (en) * 2011-11-03 2013-05-08 Fujitsu Limited Method, computer program, and information processing apparatus for analyzing performance of computer system
US20140052841A1 (en) * 2012-08-16 2014-02-20 The Georgia Tech Research Corporation Computer program, method, and information processing apparatus for analyzing performance of computer system
CN106020984A (en) * 2016-05-20 2016-10-12 青岛海信移动通信技术股份有限公司 Creation method and apparatus of processes in electronic device
CN106897203A (en) * 2017-03-29 2017-06-27 北京经纬恒润科技有限公司 A kind of cpu load rate computational methods and device
CN107436839A (en) * 2017-07-17 2017-12-05 广东欧珀移动通信有限公司 Process load acquisition method, electronic terminal and computer-readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2590081A2 (en) * 2011-11-03 2013-05-08 Fujitsu Limited Method, computer program, and information processing apparatus for analyzing performance of computer system
US20140052841A1 (en) * 2012-08-16 2014-02-20 The Georgia Tech Research Corporation Computer program, method, and information processing apparatus for analyzing performance of computer system
CN106020984A (en) * 2016-05-20 2016-10-12 青岛海信移动通信技术股份有限公司 Creation method and apparatus of processes in electronic device
CN106897203A (en) * 2017-03-29 2017-06-27 北京经纬恒润科技有限公司 A kind of cpu load rate computational methods and device
CN107436839A (en) * 2017-07-17 2017-12-05 广东欧珀移动通信有限公司 Process load acquisition method, electronic terminal and computer-readable storage medium

Similar Documents

Publication Publication Date Title
KR102490908B1 (en) Resource scheduling method and terminal device
CN108009006B (en) Scheduling method and device of I/O (input/output) request
RU2425412C2 (en) Requirement-multithreaded multimedia processor
US9411649B2 (en) Resource allocation method
CN110308982B (en) Shared memory multiplexing method and device
CN111597042A (en) Service thread running method and device, storage medium and electronic equipment
US9947068B2 (en) System and method for GPU scheduling
CN110532100B (en) Method, device, terminal and storage medium for scheduling resources
CN112925616A (en) Task allocation method and device, storage medium and electronic equipment
US9910704B1 (en) Run time task scheduling based on metrics calculated by micro code engine in a socket
CN111708642B (en) Processor performance optimization method and device in VR system and VR equipment
CN115269196A (en) Thread pool dynamic creation method, device, equipment and storage medium
CN110795238A (en) Load calculation method and device, storage medium and electronic equipment
CN106325996A (en) GPU resource distribution method and system
WO2024245116A1 (en) Task processing method and apparatus, and electronic device
US10042659B1 (en) Caching virtual contexts for sharing of physical instances of a hardware resource
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN113495787B (en) Resource allocation method, device, storage medium and electronic device
CN110795323A (en) Load statistical method, device, storage medium and electronic equipment
CN111597044A (en) Task scheduling method and device, storage medium and electronic equipment
CN111338803A (en) Thread processing method and device
KR102563648B1 (en) Multi-processor system and method of operating the same
CN112130977B (en) Task scheduling method, device, equipment and medium
CN113641476A (en) Task scheduling method, game engine, equipment and storage medium
CN113138909A (en) Load statistical method, device, storage medium and electronic equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210720