Task power consumption estimation method and device and electronic equipment

By acquiring the number of task instructions and average energy consumption, and combining this with the processor's energy consumption characteristics, the power consumption of tasks can be precisely estimated, solving the problem of assigning tasks to processors with the lowest energy consumption, and achieving more accurate energy management and minimizing device energy consumption.

CN121166497APending Publication Date: 2025-12-19VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410788975.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2025-12-19

AI Technical Summary

Technical Problem

In existing technologies, terminal devices cannot accurately allocate tasks to the processor with the lowest power consumption, resulting in inaccurate power consumption estimates.

Method used

By obtaining the estimated runtime of the task to be run, the number of task instructions, and the average energy consumption of each type of instruction, and combining this with the actual energy consumption characteristics of the processor, the task power consumption is estimated in a refined manner, including dynamic and static power consumption, and then the processor with the lowest task power consumption is selected for task allocation.

Benefits of technology

It achieves more accurate task power consumption estimation, ensuring that tasks run on processors with minimal power consumption, and reducing the overall task power consumption of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121166497A_ABST
    Figure CN121166497A_ABST
Patent Text Reader

Abstract

The invention discloses a task power consumption estimation method and device and electronic equipment, and belongs to the technical field of terminals. The method comprises the steps that the predicted running time length of a to-be-run task, the instruction number of all kinds of first task instructions in N kinds of first task instructions included in the to-be-run task and the instruction average energy consumption of each kind of first task instructions in the N kinds of first task instructions are obtained, N is a positive integer, and the number of the first task instructions is smaller than the number of the first task instructions; various first task instructions in the N types of first task instructions are different in function type; task power consumption is determined according to the predicted operation duration of the to-be-operated task, the instruction number of all kinds of first task instructions in the to-be-operated task and the instruction average energy consumption of each kind of first task instructions, and the task power consumption is an estimated value of power consumption of the to-be-operated task when the to-be-operated task operates on a processor in the electronic equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of terminal technology, specifically relating to a method, apparatus, and electronic device for estimating the power consumption of a task. Background Technology

[0002] When a terminal device has at least two processors, if the terminal device receives a new task, the terminal device's operating system will estimate the energy consumption of allocating the task to each processor and assign the task to the processor with the lowest estimated power consumption.

[0003] However, estimating the energy consumption of each processor based solely on its operating frequency, voltage, and equivalent capacitance is not an accurate method. Summary of the Invention

[0004] The purpose of this application is to provide a method, apparatus, and electronic device for estimating the power consumption of a task, which can solve the technical problem of not being able to accurately allocate tasks to the processor with the lowest power consumption.

[0005] In a first aspect, embodiments of this application provide a power consumption estimation method for a task, the method comprising:

[0006] The estimated runtime of the task to be run is obtained, the number of instructions of each type of first task instruction in the N types of first task instructions included in the task to be run, and the average energy consumption of each type of first task instruction in the N types of first task instructions, where N is a positive integer and the functional categories of each type of first task instruction in the N types of first task instructions are different.

[0007] The task power consumption is determined based on the expected runtime of the task to be run, the number of instructions of each type of first task instruction in the task to be run, and the average power consumption of each type of first task instruction, wherein the task power consumption is an estimated value of the power consumption of the task to be run on the processor in the electronic device.

[0008] Secondly, embodiments of this application provide a power consumption estimation apparatus for a task, the apparatus comprising:

[0009] The acquisition module is used to acquire the estimated runtime of the task to be run, the number of instructions of each type of first task instruction in the N types of first task instructions included in the task to be run, and the average energy consumption of each type of first task instruction in the N types of first task instructions, where N is a positive integer and the functional categories of the various types of first task instructions in the N types of first task instructions are different.

[0010] The determining module is used to determine the task power consumption based on the expected runtime of the task to be run, the number of instructions of each type of first task instruction in the task to be run, and the average energy consumption of each type of first task instruction, wherein the task power consumption is an estimated value of the power consumption of the task to be run on the processor in the electronic device.

[0011] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions executable on the processor, the program or instructions being executed by the processor to implement the steps of the method provided in the first aspect.

[0012] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, and which, when executed by a processor, implement the steps of the method provided in the first aspect.

[0013] Fifthly, embodiments of this application provide a chip, which includes a processor and a communication interface, the communication interface and the processor being coupled together, the processor being used to run programs or instructions to implement the method provided in the first aspect.

[0014] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method as provided in the first aspect.

[0015] In the power consumption estimation method, apparatus, and electronic device of this application, the task instructions in the task to be run can be classified, and the task power consumption can be estimated by the expected runtime of the task to be run, the number of each type of instruction, and the average energy consumption of each type of instruction. This method can capture the energy consumption characteristics of the task to be run when it runs on the processor in a fine manner. This method not only considers the instruction composition of the task, but also combines the actual energy consumption characteristics of the processor, so it can provide a more accurate power consumption estimate. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating a power consumption estimation method for a task provided in one embodiment of this application;

[0017] Figure 2 This is a flowchart illustrating a power consumption estimation method for a task provided in another embodiment of this application;

[0018] Figure 3 This is a schematic diagram of the structure of a processor core provided in one embodiment of this application;

[0019] Figure 4 This is a schematic diagram of the processor core provided in another embodiment of this application;

[0020] Figure 5This is a schematic diagram of the power consumption estimation device for a task provided in another embodiment of this application;

[0021] Figure 6 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application;

[0022] Figure 7 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0023] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0024] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, the first object can be one or at least two. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0025] To address the aforementioned technical problems, this application provides a method for estimating the power consumption of a task. The power consumption estimation method provided by this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0026] like Figure 1 As shown, Figure 1 This is a flowchart illustrating a power consumption estimation method for a task according to an embodiment of this application. This application provides a power consumption estimation method for a task, which is executed by an electronic device including at least two processors. The method may include:

[0027] S101, obtain the estimated runtime of the task to be run, the number of instructions of each type of first task instruction in the N types of first task instructions included in the task to be run, and the average energy consumption of each type of first task instruction in the N types of first task instructions, where N is a positive integer, and the functional categories of each type of first task instruction in the N types of first task instructions are different.

[0028] In this embodiment, the task to be run is the task to be assigned to an electronic device for execution. If the electronic device includes multiple processors, the task to be run can be assigned to any one of the processors on the electronic device. Due to differences in manufacturing processes, architecture designs, etc., the operating frequencies of the processors will differ when the task to be run is executed on different processors. Therefore, the power consumption of the task to be run will also differ when it is assigned to different processors. Therefore, before assigning the task to be run, the power consumption of each processor when it is assigned to different processors can be estimated.

[0029] After acquiring the task to be run, the task instructions can be categorized into N first-task instruction classes based on their functional types. Taking N=4 as an example, the task instructions can be divided into 4 first-task instruction classes: integer calculation instructions, branch instructions, memory access instructions, and floating-point calculation instructions. After categorizing the task instructions into N classes, the number of instructions in each class and the average energy consumption of each class can be determined. The average energy consumption is calculated by dividing the total energy consumption of that class of first-task instructions by the number of instructions in that class. Furthermore, the estimated runtime of the task to be run can be predicted.

[0030] S102, the task power consumption is determined based on the expected runtime of the task to be run, the number of instructions of each type of first task instruction in the task to be run, and the average energy consumption of each type of first task instruction, wherein the task power consumption is an estimated value of the power consumption of the task to be run on the processor in the electronic device.

[0031] In this embodiment, power consumption is the energy consumption per unit time. Since the task instructions in the task to be run can be divided into N types of first task instructions according to different functional categories, after obtaining the average energy consumption and number of instructions of each type of first task instruction, the energy consumption of each type of first task instruction in the task to be run can be calculated, and the task power consumption of the task to be run can be further determined by the energy consumption of each type of first task instruction and the expected running time.

[0032] In some embodiments, the task power consumption includes dynamic power consumption and static power consumption, and S102 above includes:

[0033] Obtain the static power consumption of the processor when the task to be run is executed in the processor;

[0034] The dynamic power consumption of the processor is determined based on the estimated runtime, the number of instructions of each type of first task instruction in the task to be run, and the average energy consumption of each type of first task instruction. The dynamic power consumption of the task to be run corresponds to one dynamic power consumption during the processor operation at each of the operating frequencies.

[0035] The task power consumption of the processor is determined based on the dynamic power consumption and the static power consumption.

[0036] In this embodiment, when the task to be run is running in the processor, the processor's power consumption includes dynamic power consumption and static power consumption. Dynamic power consumption is the power consumption incurred by the task to be run during processor operation, including switching capacitors, short-circuit current, etc. Static power consumption is the power consumption consumed by the processor when it is not performing any operation, mainly caused by leakage current.

[0037] For each processor in this electronic device, the dynamic power consumption of the processor during the execution of the task can be determined based on the expected runtime of the task to be run on the processor, the number of instructions of each type of first task instruction in the task to be run, and the average energy consumption per instruction. In addition, the static power consumption of the processor can also be obtained. The sum of the dynamic power consumption and the static power consumption is then determined as the task power consumption of the processor.

[0038] The above methods can be used to calculate the power consumption of the task running on the processor from both dynamic and static power consumption perspectives, so as to achieve more accurate energy management.

[0039] In some embodiments, determining the processor's dynamic power consumption based on the estimated runtime, the number of instructions for each type of first task instruction in the task to be run, and the average power consumption per instruction for each type of first task instruction includes:

[0040] The sum of the first energy consumption of each type of first task instruction in the N types of first task instructions is determined as the total dynamic energy consumption. The first energy consumption corresponding to the i-th type of first task instruction is the product of the number of first instructions of the i-th type of first task instruction and the average energy consumption of the instructions of the i-th type of first task instruction, where i is any positive integer less than or equal to N.

[0041] The quotient of the total dynamic energy consumption divided by the expected runtime is determined as the dynamic power consumption.

[0042] In this embodiment, dynamic power consumption is the dynamic energy consumption caused by the running of the task to be run in the processor per unit time. Therefore, the dynamic energy consumption of each type of first task instruction can be calculated separately, and then the dynamic power consumption of the processor can be determined based on the dynamic energy consumption of each type of first task instruction and the expected running time of the task to be run.

[0043] Specifically, taking the processor running at a first operating frequency as an example, after calculating the first energy consumption corresponding to each of the N types of first task instructions, the first energy consumption of the N types of first task instructions can be added together to obtain the total dynamic energy consumption consumed by the task to be run on the processor at the first operating frequency. Then, dividing the total dynamic energy consumption by the expected runtime of the task to be run yields the dynamic power consumption of the task running on the processor at the first operating frequency.

[0044] For example, the first task instructions are integer calculation (DP) instructions, branch instructions, memory access (LDST) instructions, and floating-point (FP) calculation instructions. The formula for calculating the task power consumption can be:

[0045] P=(E_dp*N_dp+E_br*N_br+E_ldst*N_ldst+E_fp*N_fp) / T+P_static

[0046] Where P represents task power consumption, P_static represents static power consumption, E_dp represents the average power consumption of integer calculation instructions, N_dp represents the first instruction count of integer calculation instructions; E_br represents the average power consumption of branch instructions, N_br represents the first instruction count of branch instructions; E_ldst represents the average power consumption of memory access instructions, N_ldst represents the first instruction count of memory access instructions; and E_dp represents the average power consumption of floating-point instructions, N_dp represents the first instruction count of floating-point instructions.

[0047] By using the above method, given an accurate estimate of the total power consumption of the task to be run on the processor, the dynamic power consumption of the processor when processing the task can be accurately estimated based on the total power consumption and the expected runtime of the task.

[0048] In some embodiments, the task to be run includes P types of second task instructions, and the various second task instructions among the P types of second task instructions have different operation methods;

[0049] The step of obtaining the average energy consumption of each of the N types of first task instructions in the task to be run includes:

[0050] Obtain the operating frequency of the processor when the task to be run is executed on the processor;

[0051] The single instruction energy consumption of each of the P types of second task instructions in the task to be run is determined based on the running frequency, wherein the single instruction energy consumption of the same type of second task instruction is the same.

[0052] Determine a first ratio corresponding to the first type of first task instruction in the N types of first task instructions in the task to be run. The first ratio is the ratio of the first number of the first type of first task instructions to the second number of all task instructions in the task to be run.

[0053] The first instruction average energy consumption of the first type of first task instruction is determined based on the single instruction energy consumption of various second task instructions in the P types of second task instructions and the first ratio.

[0054] In this embodiment, the task instructions can be divided into P types of second task instructions according to the different operation methods of the task instructions in the task to be run. Taking P as 6 as an example, the P types of second task instructions may include ADD (addition) instruction, SUB (subtraction) instruction, LDR (load) instruction, AND (and) instruction, ORR (or) instruction, and MOVZ (zero-extended move) instruction.

[0055] Since the energy consumption of task instructions is related to their operation method and the processor's operating frequency—that is, within each of the P types of second task instructions, the energy consumption of each instruction of the same type is the same when running at the same frequency—we can first obtain the processor's operating frequency, and then determine the energy consumption of each individual instruction among the P types of second task instructions in the task to be executed at that operating frequency. Specifically, at that processor operating frequency, the energy consumption of each individual instruction of the same type of second task instruction is the same.

[0056] Then, based on the single-instruction energy consumption of each type of second task instruction, the average instruction energy consumption of each type of first task instruction can be determined. Taking the first type of first task instruction among N types of first task instructions as an example: First, determine the first ratio corresponding to the first type of first task instruction. Based on the first ratio and the single-instruction energy consumption of each type of second task instruction among P types of second task instructions, the first average instruction energy consumption of the first type of first task instruction when the task to be run is executed on the processor at this operating frequency can be determined.

[0057] Using the above method, the average power consumption of each task instruction in the task to be run can be accurately determined based on the single instruction power consumption of each task instruction in the task to be run during the operation of the first processor at the first operating frequency, and the proportion of each type of task instruction in the N types of task instructions.

[0058] In some embodiments, determining the first instruction average energy consumption of the first type of first task instruction based on the single instruction energy consumption of various second task instructions in the P types of second task instructions and the first ratio includes:

[0059] Determine the second ratio corresponding to each of the various second task instructions in the P types of second task instructions in the task to be run. The second ratio is the ratio of the third quantity of each of the various second task instructions in the P types of second task instructions to the second quantity of all task instructions in the task to be run.

[0060] The average energy consumption of the first instruction is obtained by dividing the sum of the products of the second ratios of various second task instructions among the P types of second task instructions and the energy consumption of a single instruction by the first ratio.

[0061] In this embodiment, since the energy consumption of each individual second task instruction in the P types of second task instructions is the same, the proportion of each type of second task instruction in the total dynamic energy consumption of the task to be run can be obtained by multiplying the energy consumption of each type of second task instruction in the P types of second task instructions by the second ratio of each type of task instruction. The sum of the products of the second ratio of each type of second task instruction and the energy consumption of each individual instruction is the total dynamic energy consumption of the task to be run. Dividing the sum of the products of the second ratio of each type of second task instruction and the energy consumption of each individual instruction by the first ratio yields the first instruction average energy consumption of the first type of task instructions.

[0062] For example, if the first task instruction of the first type can be an integer calculation instruction (dp), then the formula for calculating the average energy consumption of the first instruction can be:

[0063] E_dp=((E_add*P_add)+(E_sub*P_sub)+(E_ldr*P_ldr)+(E_and*P_and)+(E_orr*P_orr)+(E_movz*P_movz)) / P_dp;

[0064] Wherein, E_add is the energy consumption of a single addition instruction, and P_add is the second ratio corresponding to the addition instruction; E_sub is the energy consumption of a single subtraction instruction, and P_sub is the second ratio corresponding to the subtraction instruction; E_ldr is the energy consumption of a single load instruction, and P_ldr is the second ratio corresponding to the load instruction; E_and is the energy consumption of a single addition instruction, and P_and is the second ratio corresponding to the addition instruction; E_orr is the energy consumption of a single OR instruction, and P_orr is the second ratio corresponding to the OR instruction; E_movz is the energy consumption of a single zero-extended move instruction, and P_movz is the second ratio corresponding to the zero-extended move instruction; E_dp is the energy consumption of a single integer calculation instruction, and P_dp is the first ratio corresponding to the integer calculation instruction.

[0065] In this embodiment, the total dynamic energy consumption of the task to be run can be calculated based on the energy consumption of each task instruction in the task to be run. Then, based on the different proportions of task instructions of different operation types in the task to be run, the average energy consumption of various task instructions can be accurately calculated.

[0066] In some embodiments, determining the single-instruction energy consumption of various second task instructions among the P types of second task instructions in the task to be run when running in the first processor according to the first operating frequency includes:

[0067] Obtain a test code segment, which includes K first-type second task instructions, wherein the first-type second task instructions are any one of the P types of second task instructions, and K is a positive integer greater than 1;

[0068] Determine the average power consumption of the test code segment when it runs on a processor at the first operating frequency, and the actual runtime of the test code segment;

[0069] The energy consumption of a single instruction of the first type of second task instruction is determined based on the average power consumption, K, and the actual runtime.

[0070] In this embodiment, taking the first type of second task instruction among P types of task instructions as an example, a test code segment including K first type second task instructions can be pre-written. This test code segment can be run in the processor. If the test code segment runs in a processor with a first operating frequency, the processor will output the average power consumption and the actual runtime of the test code segment after the execution is completed.

[0071] Since the energy consumption of each instruction in the first type of task instruction is the same, the product of the average power consumption and the actual runtime can be used to determine the total power consumption of the test code segment running at the first operating frequency. Then, the quotient of the total power consumption divided by K is the energy consumption of a single instruction in the first type of second task instruction.

[0072] Using the above method, the energy consumption of a single instruction in each of the P types of second task instructions can be calculated.

[0073] In some embodiments, determining the average power consumption of the test code segment when running on a processor at the first operating frequency includes:

[0074] The processor's operating condition parameters are determined based on the first operating frequency;

[0075] Determine the simulation information corresponding to the operating condition parameters and the first operating frequency;

[0076] A simulated processor is generated based on the simulation information, and power consumption simulation is performed on the test code segment on the simulated processor. The average power consumption is determined based on the results of the power consumption simulation.

[0077] In this embodiment, simulation tools can be used to simulate the execution of the test code segment. Specifically, if testing is required, the average power consumption of the code segment at a first operating frequency can be tested. The corresponding processor operating condition parameters, such as voltage and temperature, can be determined based on the first operating frequency. Subsequently, simulation information, such as process libraries and timing files matching these operating condition parameters, is imported to generate a simulation environment. Then, the simulation tool can be used to drive a simulated processor within the simulation environment to perform power consumption simulation on the test code segment, thereby measuring the average power consumption of the test code segment at the first operating frequency.

[0078] The above power consumption simulation method can obtain the average power consumption of the test code segment without the need for a real processor. Since the constructed simulation environment not only eliminates the influence of chip static power consumption and operating system interference on the measurement results, it can also solve the problem caused by mutual interference between the processor power domain and other module power domains, thus improving the accuracy of the average power consumption.

[0079] In some embodiments, the task to be run includes P types of second task instructions, and the various second task instructions among the P types of second task instructions have different operation methods;

[0080] The method further includes:

[0081] The processor's operating frequency, static power consumption, estimated runtime of the task to be run, and calculation method of each task instruction in the task to be run are obtained when the task to be run is running in the processor.

[0082] The number of second instructions for each type of second task instruction in the P types of second task instructions in the task to be run is determined based on the number of instructions in the task instruction and the operation method of each task instruction.

[0083] The single instruction energy consumption of each of the P types of second task instructions in the task to be run is determined based on the processor's operating frequency.

[0084] The dynamic power consumption of the processor is determined based on the expected runtime and the second power consumption corresponding to the P types of second task instructions, wherein the second power consumption corresponding to the j-th type of second task instruction is the product of the number of second instructions of the j-th type of second task instruction and the power consumption of a single instruction, and j is any positive integer less than or equal to P.

[0085] The power consumption of the task to be run on the processor is determined based on the processor's dynamic power consumption and static power consumption.

[0086] In this embodiment, after classifying all task instructions into P types of second task instructions, the number of second instructions for each type of second task instruction in the task to be run can be obtained in real time through an instruction counter. Taking P as 6 as an example, the P types of second task instructions may include ADD (addition) instruction, SUB (subtraction) instruction, LDR (load) instruction, AND (and) instruction, ORR (or) instruction, and MOVZ (zero-extended move) instruction.

[0087] Then, taking the first processor as an example, if the first processor runs at the first operating frequency when the task to be run is running on the first processor, then the single instruction energy consumption of each of the P types of second task instructions can be queried at the first operating frequency.

[0088] After knowing the number of second instructions for each type of second task instruction in P types of second task instructions, as well as the energy consumption of a single instruction, the product of the number of second instructions and the energy consumption of a single instruction for each type of second task instruction can be calculated to obtain the second energy consumption of that type of task instruction. Based on the expected runtime and the second energy consumption, the dynamic power consumption required for the task to be run on the first processor can be determined. Then, the sum of the dynamic power consumption and the static power consumption can be determined as the task power consumption of the task to be processed running on the processor.

[0089] For example, the formula for calculating task power consumption can be:

[0090] P=(E_add*N_add+E_sub*N_sub+E_ldr*N_ldr+E_fmul*N_fmul+......) / T+P_static

[0091] Where P represents task power consumption, P_static represents static power consumption, E_add represents the power consumption of a single addition instruction, and N_add represents the number of second instructions in the addition instruction set; E_sub represents the power consumption of a single subtraction instruction, and N_sub represents the number of second instructions in the branch instruction set; E_ldr represents the power consumption of a single load instruction, and N_ldr represents the number of second instructions in the load instruction set; E_fmul represents the power consumption of a single floating-point instruction, and N_fmul represents the number of second instructions in the floating-point instruction set.

[0092] In this embodiment, the average power consumption of any type of operation task instruction in the task to be run can be estimated by combining the processor's hardware parameters and the task information of the task to be run. Furthermore, the dynamic power consumption of the processor and the final task power consumption during the operation of the task to be run can be calculated, which can more accurately estimate the power consumption of different processors when processing tasks.

[0093] In some embodiments, when the electronic device includes at least two processors, the task power consumption includes at least two task power consumptions that correspond one-to-one with the at least two processors; the task power consumption corresponding to a processor is an estimated value of the power consumption of the task to be run on that processor.

[0094] After determining the power consumption of the processor in the electronic device for the task to be run, the method further includes:

[0095] The target processor with the lowest task power consumption among the at least two processors will be selected to run the task.

[0096] In this embodiment, the electronic device includes at least two processors. When the task to be run is executed on each of the at least two processors, the operating frequency and other parameters of the processor are different. Therefore, the power consumption of the task to be run is different when it is executed on different processors.

[0097] The power consumption of the task to be run can be calculated separately on each processor. After the power consumption of the task to be run on each processor is determined by the above method, the power consumption of at least two processors can be compared to determine the target processor with the lowest power consumption. The task to be run is then assigned to the target processor to ensure that the task to be run can be completed on the electronic device with the lowest power consumption.

[0098] By using the above method, we can ensure that tasks are accurately allocated to the processor with the lowest power consumption, thereby minimizing the total power consumption of electronic devices.

[0099] As an optional embodiment, Figure 2 This demonstrates a process for selecting the most energy-efficient processor (CPU) based on a Performance Monitoring Unit (PMU). The specific process is as follows:

[0100] like Figure 2 As shown, firstly, during the process of creating or waking up a process, a blocked process is created, that is, the try_to_wake_up() function in core.c is called to wake up a blocked process; a new fork process is created, that is, the wake_up_new_task() function in core.c is called to wake up a newly created fork process; and a terminated process is executed, that is, the sched_exec() function in core.c is called to execute the exec operation of a process.

[0101] Then, a task queue is selected. After process creation or wake-up, the `select_task_rq()` function in `core.c` is called. This function selects a suitable task queue to place the tasks to be scheduled. The task queue determines which processor the tasks will be assigned to for execution. Specifically, scheduling tasks can be done by calling the `p->sched_class->select_task_rq()` function, which selects the specific task queue based on the scheduling class. If the `fair` scheduling class is used, the `select_task_rq_fair()` function in `fair.c` is called to select a suitable task queue.

[0102] like Figure 2 As shown, the processor (CPU) includes a performance monitoring unit (PMU) and an energy efficiency scheduling system (EAS). As shown in step 01, the PMU collects instruction execution information such as the number of instructions executed by the processor within a certain period of time. Then, as shown in step 02, the PMU transmits the collected information to the energy efficiency scheduling system (EAS). As shown in step 03, the energy efficiency scheduling system (EAS) uses the find_energy_efficient_cpu() function in fair.c, combined with the instruction execution information collected by the performance monitoring unit (PMU), to calculate the task power consumption of each processor using the task power consumption estimation method in this application. Finally, the processor with the lowest task power consumption is selected to run the task to be run.

[0103] As an optional embodiment, Figure 3 This demonstrates the internal structure of a processor core, which includes a Performance Monitoring Unit (PMU) and a Static Power Estimator. The processor core contains a pipeline structure comprising three main stages:

[0104] Fetch: Retrieves instructions from memory.

[0105] Decode: Translate the acquired instructions into micro-operations.

[0106] Execute: Executes the decoded instructions.

[0107] The Performance Monitoring Unit (PMU) obtains information such as the estimated runtime of the task to be run and the processor's operating frequency from the Fetch stage, and then transmits this information to the Static Power Estimator, which estimates the static power consumption of the processor in different states.

[0108] In addition, as another alternative embodiment, Figure 4 This diagram illustrates the internal structure of a processor core, which includes a dynamic power estimator and a static power estimator. In this embodiment, the processor core also performs a series of processes including instruction fetching, decoding, and execution.

[0109] However, in this embodiment, the dynamic power consumption of the task running on the processor can be directly estimated by the Dynamic Power Estimator, and the static power consumption of the task running on the processor can be estimated by the Static Power Estimator. The sum of the dynamic power consumption and the static power consumption can then be determined as the task power consumption.

[0110] Figure 5 This is a schematic diagram of the power consumption estimation device for a task provided in another embodiment of this application, as shown below. Figure 5 As shown, the power consumption estimation device for this task may include:

[0111] The acquisition module 501 is used to acquire the estimated runtime of the task to be run, the number of instructions of each type of first task instruction in the N types of first task instructions included in the task to be run, and the average energy consumption of each type of first task instruction in the N types of first task instructions, where N is a positive integer and the functional categories of each type of first task instruction in the N types of first task instructions are different.

[0112] The determining module 502 is used to determine the task power consumption based on the expected runtime of the task to be run, the number of instructions of each type of first task instruction in the task to be run, and the average power consumption of each type of first task instruction, wherein the task power consumption is an estimated value of the power consumption of the task to be run on the processor in the electronic device.

[0113] In this application, the task instructions in the task to be run can be classified, and the task power consumption can be estimated by the expected runtime of the task to be run, the number of each type of instruction, and the average energy consumption of each type of instruction. This method can capture the energy consumption characteristics of the task to be run when it runs on the processor in a finer way. This method not only considers the instruction composition of the task, but also combines the actual energy consumption characteristics of the processor, so it can provide a more accurate power consumption estimate.

[0114] In another alternative example, the power consumption estimation device for the task may further include:

[0115] The execution module is used to select the target processor with the lowest task power consumption among the at least two processors to run the task to be executed.

[0116] In another alternative example, the determining module 502 may further include:

[0117] The first acquisition unit is used to acquire the static power consumption of the processor when the task to be run is running in the processor;

[0118] The first determining unit is used to determine the dynamic power consumption of the processor based on the expected runtime, the number of instructions of various first task instructions in the task to be run, and the average energy consumption of each type of first task instruction, wherein each task to be run at the operating frequency corresponds to a dynamic power consumption during the processor's operation.

[0119] The second determining unit is used to determine the task power consumption of the processor based on the dynamic power consumption and the static power consumption.

[0120] In another alternative example, the first determining unit is also used for:

[0121] The sum of the first energy consumption of each type of first task instruction in the N types of first task instructions is determined as the total dynamic energy consumption. The first energy consumption corresponding to the i-th type of first task instruction is the product of the number of first instructions of the i-th type of first task instruction and the average energy consumption of the instructions of the i-th type of first task instruction, where i is any positive integer less than or equal to N.

[0122] The quotient of the total dynamic energy consumption divided by the expected runtime is determined as the dynamic power consumption.

[0123] In another alternative example, the acquisition module 501 further includes:

[0124] The first acquisition unit is used to acquire the operating frequency of the processor when the task to be run is running in the processor;

[0125] The third determining unit is used to determine the single instruction energy consumption of various second task instructions among the P types of second task instructions in the task to be run when they are run in the processor, based on the running frequency, wherein the single instruction energy consumption of the same type of second task instruction is the same.

[0126] The fourth determining unit is used to determine a first ratio corresponding to the first type of first task instruction in the N types of first task instructions in the task to be run, wherein the first ratio is the ratio of the first number of the first type of first task instructions to the second number of all task instructions in the task to be run;

[0127] The fifth determining unit is used to determine the first instruction average energy consumption of the first type of first task instruction based on the single instruction energy consumption of various second task instructions in the P types of second task instructions and the first ratio.

[0128] In another alternative example, the fifth determining unit is also used for:

[0129] Determine the second ratio corresponding to each of the various second task instructions in the P types of second task instructions in the task to be run. The second ratio is the ratio of the third quantity of each of the various second task instructions in the P types of second task instructions to the second quantity of all task instructions in the task to be run.

[0130] The average energy consumption of the first instruction is obtained by dividing the sum of the products of the second ratios of various second task instructions among the P types of second task instructions and the energy consumption of a single instruction by the first ratio.

[0131] In another alternative example, the third determining unit is also used for:

[0132] Obtain a test code segment, which includes K first-type second task instructions, wherein the first-type second task instructions are any one of the P types of second task instructions, and K is a positive integer greater than 1;

[0133] Determine the average power consumption of the test code segment when it runs on a processor at the first operating frequency, and the actual runtime of the test code segment;

[0134] The energy consumption of a single instruction of the first type of second task instruction is determined based on the average power consumption, K, and the actual runtime.

[0135] In another alternative example, the third determining unit is also used for:

[0136] The processor's operating condition parameters are determined based on the first operating frequency;

[0137] Determine the simulation information corresponding to the operating condition parameters and the first operating frequency;

[0138] A simulated processor is generated based on the simulation information, and power consumption simulation is performed on the test code segment on the simulated processor. The average power consumption is determined based on the results of the power consumption simulation.

[0139] In another alternative example, the power consumption estimation device for the task is also used for:

[0140] The processor's operating frequency, static power consumption, estimated runtime of the task to be run, and calculation method of each task instruction in the task to be run are obtained when the task to be run is running in the processor.

[0141] The number of second instructions for each type of second task instruction in the P types of second task instructions in the task to be run is determined based on the number of instructions in the task instruction and the operation method of each task instruction.

[0142] The single instruction energy consumption of each of the P types of second task instructions in the task to be run is determined based on the processor's operating frequency.

[0143] The dynamic power consumption of the processor is determined based on the expected runtime and the second power consumption corresponding to the P types of second task instructions, wherein the second power consumption corresponding to the j-th type of second task instruction is the product of the number of second instructions of the j-th type of second task instruction and the power consumption of a single instruction, and j is any positive integer less than or equal to P.

[0144] The task power consumption of the processor is determined based on the processor's dynamic power consumption and static power consumption.

[0145] The power consumption estimation device for the task in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0146] The power consumption estimation device for the task in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.

[0147] The power consumption estimation device for the task provided in this application embodiment can achieve... Figure 1 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0148] Optionally, such as Figure 6 As shown, this application embodiment also provides an electronic device 100, including a processor 110, a memory 119, and a program or instructions stored in the memory 119 and executable on the processor 110. The program or instructions are executed by the processor 110 to implement the various processes of the power consumption estimation method embodiment of the above-mentioned task and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0149] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0150] Please refer to the following: Figure 7 , Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. The electronic device 100 includes, but is not limited to, components such as: a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.

[0151] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 120 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0152] The processor 120 is used to obtain the estimated runtime of the task to be run, the number of instructions of each type of first task instruction in the N types of first task instructions included in the task to be run, and the average energy consumption of each type of first task instruction in the N types of first task instructions, where N is a positive integer and the functional categories of each type of first task instruction in the N types of first task instructions are different.

[0153] The processor 120 is configured to determine the task power consumption based on the expected runtime of the task to be run, the number of instructions of each type of first task instruction in the task to be run, and the average power consumption of each type of first task instruction, wherein the task power consumption is an estimated value of the power consumption of the task to be run on the processor in the electronic device.

[0154] In this application, the task instructions in the task to be run can be classified, and the task power consumption can be estimated by the expected runtime of the task to be run, the number of each type of instruction, and the average energy consumption of each type of instruction. This method can capture the energy consumption characteristics of the task to be run when it runs on the processor in a finer way. This method not only considers the instruction composition of the task, but also combines the actual energy consumption characteristics of the processor, so it can provide a more accurate power consumption estimate.

[0155] In another alternative example, the processor 120 is further configured to select a target processor with the lowest task power consumption among the at least two processors to run the task to be run.

[0156] In another alternative example, the processor 120 is further configured to obtain the static power consumption of the processor when the task to be run is running in the processor;

[0157] The dynamic power consumption of the processor is determined based on the estimated runtime, the number of instructions of each type of first task instruction in the task to be run, and the average energy consumption of each type of first task instruction. The dynamic power consumption of the task to be run corresponds to one dynamic power consumption during the processor operation at each of the operating frequencies.

[0158] The task power consumption of the processor is determined based on the dynamic power consumption and the static power consumption.

[0159] In another alternative example, the processor 120 is also used for

[0160] The sum of the first energy consumption of each type of first task instruction in the N types of first task instructions is determined as the total dynamic energy consumption. The first energy consumption corresponding to the i-th type of first task instruction is the product of the number of first instructions of the i-th type of first task instruction and the average energy consumption of the instructions of the i-th type of first task instruction, where i is any positive integer less than or equal to N.

[0161] The quotient of the total dynamic energy consumption divided by the expected runtime is determined as the dynamic power consumption.

[0162] In another optional example, the processor 120 is further configured to obtain the operating frequency of the processor when the task to be run is executed in the processor;

[0163] The single instruction energy consumption of each of the P types of second task instructions in the task to be run is determined based on the running frequency, wherein the single instruction energy consumption of the same type of second task instruction is the same.

[0164] Determine a first ratio corresponding to the first type of first task instruction in the N types of first task instructions in the task to be run. The first ratio is the ratio of the first number of the first type of first task instructions to the second number of all task instructions in the task to be run.

[0165] The first instruction average energy consumption of the first type of first task instruction is determined based on the single instruction energy consumption of various second task instructions in the P types of second task instructions and the first ratio.

[0166] In another alternative example, the processor 120 is further configured to:

[0167] Determine the second ratio corresponding to each of the various second task instructions in the P types of second task instructions in the task to be run. The second ratio is the ratio of the third quantity of each of the various second task instructions in the P types of second task instructions to the second quantity of all task instructions in the task to be run.

[0168] The average energy consumption of the first instruction is obtained by dividing the sum of the products of the second ratios of various second task instructions among the P types of second task instructions and the energy consumption of a single instruction by the first ratio.

[0169] In another alternative example, the processor 120 is further configured to:

[0170] Obtain a test code segment, which includes K first-type second task instructions, wherein the first-type second task instructions are any one of the P types of second task instructions, and K is a positive integer greater than 1;

[0171] Determine the average power consumption of the test code segment when it runs on a processor at the first operating frequency, and the actual runtime of the test code segment;

[0172] The energy consumption of a single instruction of the first type of second task instruction is determined based on the average power consumption, K, and the actual runtime.

[0173] In another alternative example, the processor 120 is further configured to:

[0174] The processor's operating condition parameters are determined based on the first operating frequency;

[0175] Determine the simulation information corresponding to the operating condition parameters and the first operating frequency;

[0176] A simulated processor is generated based on the simulation information, and power consumption simulation is performed on the test code segment on the simulated processor. The average power consumption is determined based on the results of the power consumption simulation.

[0177] In another alternative example, the processor 120 is further configured to:

[0178] The processor's operating frequency, static power consumption, estimated runtime of the task to be run, and calculation method of each task instruction in the task to be run are obtained when the task to be run is running in the processor.

[0179] The number of second instructions for each type of second task instruction in the P types of second task instructions in the task to be run is determined based on the number of instructions in the task instruction and the operation method of each task instruction.

[0180] The single instruction energy consumption of each of the P types of second task instructions in the task to be run is determined based on the processor's operating frequency.

[0181] The dynamic power consumption of the processor is determined based on the expected runtime and the second power consumption corresponding to the P types of second task instructions, wherein the second power consumption corresponding to the j-th type of second task instruction is the product of the number of second instructions of the j-th type of second task instruction and the power consumption of a single instruction, and j is any positive integer less than or equal to P.

[0182] The task power consumption of the processor is determined based on the processor's dynamic power consumption and static power consumption.

[0183] It should be understood that, in this embodiment, the input unit 124 may include a graphics processing unit (GPU) 1241 and a microphone 1242. The GPU 1241 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 126 may include a display panel 1261, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 127 includes at least one of a touch panel 1271 and other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0184] The memory 129 can be used to store software programs and various data. The memory 129 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 129 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 129 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0185] Processor 120 may include one or at least two processing units; optionally, processor 120 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 120.

[0186] This application also provides a readable storage medium storing a program or instructions that, when run by a processor, implement the various processes of the power consumption estimation method embodiment for the above-mentioned task and achieve the same technical effect. To avoid repetition, these will not be described again here.

[0187] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0188] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the power consumption estimation method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0189] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0190] This application provides a computer program product stored in a storage medium. The program product is run by at least one processor to implement the various processes of the power consumption estimation method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0191] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to operating functions in the order shown or discussed, but may also include operating functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be operated in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0192] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to run the methods described in the various embodiments of this application.

[0193] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method of estimating power consumption of a task, the method comprising: The method is executed by an electronic device, comprising: obtaining an estimated running duration of a to-be-run task, an instruction quantity of each type of first task instruction in N types of first task instructions included in the to-be-run task, and an instruction average energy consumption of each type of first task instruction in the N types of first task instructions, wherein N is a positive integer, and the N types of first task instructions are different in function category; determining a task power consumption according to the estimated running duration of the to-be-run task, the instruction quantity of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction, wherein the task power consumption is an estimated value of a power consumption of the to-be-run task when running on a processor in the electronic device.

2. The method of claim 1, wherein, In the case that the electronic device comprises at least two processors, the task power consumption comprises at least two task power consumptions corresponding to the at least two processors respectively, and the task power consumption corresponding to a processor is an estimated value of a power consumption of the to-be-run task when running on the processor; after the determination of the task power consumption of the to-be-run task by the processor in the electronic device, the method further comprises: selecting a target processor with the minimum task power consumption among the at least two processors to run the to-be-run task.

3. The method of claim 1, wherein, The task power consumption comprises a dynamic power consumption and a static power consumption, the determination of the task power consumption according to the estimated running duration, the instruction quantity of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction comprises: obtaining a static power consumption of the processor when the to-be-run task runs in the processor; determining a dynamic power consumption of the processor according to the estimated running duration, the instruction quantity of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction, wherein each running frequency of the to-be-run task corresponds to a dynamic power consumption during the running of the to-be-run task in the processor; determining the task power consumption of the processor according to the dynamic power consumption and the static power consumption.

4. The method of claim 3, wherein, the determination of the dynamic power consumption of the processor according to the estimated running duration, the instruction quantity of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction comprises: determining a sum of first energy consumptions of each type of first task instruction in the N types of first task instructions as a total dynamic energy consumption, wherein a first energy consumption corresponding to an i-th type of first task instruction is a product of a first instruction quantity of the i-th type of first task instruction and an instruction average energy consumption of the i-th type of first task instruction, i is any positive integer less than or equal to N; determining a quotient of the total dynamic energy consumption divided by the estimated running duration as the dynamic power consumption.

5. The method of claim 1, wherein, The to-be-run task comprises P types of second task instructions, and each type of second task instruction in the P types of second task instructions is different in operation mode; the obtaining of the instruction average energy consumption of each type of first task instruction in the N types of first task instructions of the to-be-run task comprises: obtaining a running frequency of the processor when the to-be-run task runs in the processor; determining single instruction energy consumption of each second task instruction in the P second task instructions in the to-be-run task when running in the processor according to the running frequency, wherein the single instruction energy consumption of the same second task instruction is the same; determining a first ratio corresponding to the first type of first task instruction in the N types of first task instructions in the to-be-run task, wherein the first ratio is a ratio of a first number of the first type of first task instruction to a second number of all task instructions in the to-be-run task; determining the first instruction average energy consumption of the first type of first task instruction according to the single instruction energy consumption of each second task instruction in the P second task instructions and the first ratio.

6. The method of claim 5, wherein, The method further comprises: determining a second ratio corresponding to each second task instruction in the P second task instructions in the to-be-run task, wherein the second ratio is a ratio of a third number of each second task instruction in the P second task instructions to the second number of all task instructions in the to-be-run task; obtaining the first instruction average energy consumption by dividing a sum of products of the second ratio and the single instruction energy consumption of each second task instruction in the P second task instructions by the first ratio.

7. The method of claim 5, wherein, The method further comprises: obtaining a test code segment, wherein the test code segment comprises K first type of second task instructions, the first type of second task instruction is any one of the P second task instructions, and K is a positive integer greater than 1; determining average power consumption of the test code segment when running in the processor at the first running frequency and an actual running duration of the test code segment; determining the single instruction energy consumption of the first type of second task instruction according to the average power consumption, the K, and the actual running duration.

8. The method of claim 7, wherein, The method further comprises: determining a working condition parameter of the processor according to the first running frequency; determining simulation information corresponding to the working condition parameter and the first running frequency; generating a simulation processor based on the simulation information, performing power consumption simulation on the test code segment in the simulation processor, and determining the average power consumption according to a result of the power consumption simulation.

9. The method of claim 1, wherein, The to-be-run task comprises P second task instructions, and each second task instruction in the P second task instructions has a different operation mode. The method further comprises: obtaining a running frequency of the processor when the to-be-run task runs in the processor, a static power consumption of the processor, an expected running duration of the to-be-run task, and an operation mode of each task instruction in the to-be-run task; determining a second instruction number of each second task instruction in the P second task instructions in the to-be-run task according to the instruction number of the task instruction and the operation mode of each task instruction. determining, according to the running frequency of the processor, single instruction energy consumption of each second task instruction in the P second task instructions in the to-be-run task; determining, according to the predicted running time length, the second energy consumption corresponding to each of the P second task instructions, dynamic power consumption of the processor, wherein the second energy consumption corresponding to the jth second task instruction is the product of the second instruction number of the jth second task instruction and the single instruction energy consumption, and j is any positive integer less than or equal to P; determining, according to the dynamic power consumption and the static power consumption of the processor, task power consumption of the processor.

10. A task power consumption estimation device, characterized by comprising: comprising: an acquisition module, configured to acquire a predicted running time length of a to-be-run task, instruction numbers of each type of first task instruction in N types of first task instructions included in the to-be-run task, and instruction average energy consumption of each type of first task instruction in the N types of first task instructions, wherein N is a positive integer, and the N types of first task instructions are different in function category; a determination module, configured to determine, according to the predicted running time length of the to-be-run task, the instruction numbers of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction, task power consumption, wherein the task power consumption is an estimated value of power consumption of the to-be-run task when running on a processor of the electronic device.

11. An electronic device, comprising: comprising a processor and a memory, wherein the memory stores programs or instructions that can run on the processor, and the programs or instructions, when run by the processor, implement steps of the task power consumption estimation method according to any one of claims 1-9.

12. A processor, comprising: the processor comprises: a performance monitoring module, configured to acquire a predicted running time length of a to-be-run task, instruction numbers of each type of first task instruction in N types of first task instructions included in the to-be-run task, and instruction average energy consumption of each type of first task instruction in the N types of first task instructions; a static power consumption estimator, configured to acquire static power consumption of the to-be-run task on a processor; a power consumption determination module, configured to determine, according to the predicted running time length, the instruction numbers of each type of first task instruction in the to-be-run task, and the instruction average energy consumption of each type of first task instruction and the static power consumption, task power consumption.