CN114661139A - Method, device and equipment for reducing power consumption and computer readable storage medium - Google Patents
Method, device and equipment for reducing power consumption and computer readable storage medium Download PDFInfo
- Publication number
- CN114661139A CN114661139A CN202011540344.3A CN202011540344A CN114661139A CN 114661139 A CN114661139 A CN 114661139A CN 202011540344 A CN202011540344 A CN 202011540344A CN 114661139 A CN114661139 A CN 114661139A
- Authority
- CN
- China
- Prior art keywords
- stage
- equipment
- resource
- power consumption
- operating system
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 78
- 238000003860 storage Methods 0.000 title claims abstract description 12
- 230000008569 process Effects 0.000 claims abstract description 31
- 238000004590 computer program Methods 0.000 claims description 11
- 230000009467 reduction Effects 0.000 claims description 9
- 230000000694 effects Effects 0.000 abstract description 3
- 230000006870 function Effects 0.000 description 10
- 238000012545 processing Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000001514 detection method Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 239000000523 sample Substances 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/26—Power supply means, e.g. regulation thereof
- G06F1/32—Means for saving power
- G06F1/3203—Power management, i.e. event-based initiation of a power-saving mode
- G06F1/3234—Power saving characterised by the action undertaken
- G06F1/3287—Power saving characterised by the action undertaken by switching off individual functional units in the computer system
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Computing Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Power Sources (AREA)
Abstract
The invention provides a method, a device, equipment and a computer readable storage medium for reducing power consumption. The method of the invention determines the current starting stage of the equipment according to the driving execution stage mark before the equipment driving detects the equipment resource; when the current starting stage is determined to be the specific starting stage, unused equipment resources are determined according to system configuration, the unused equipment resources are closed, the unused equipment resources of the system can be flexibly selected to be closed based on the system configuration, and therefore the closed equipment resources cannot be detected by equipment driving in the starting process of the operating system, starting and running cannot be achieved, power consumption of unnecessary equipment resources is avoided, and the effect of reducing overall power consumption based on embedded operating system software is achieved.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for reducing power consumption.
Background
With the rapid development of embedded technology, embedded systems are widely used in various fields such as industrial control, oil exploration, medical equipment, smart meters, portable computers, and the like. The embedded devices continuously change people's lives, such as automatic automobile control unmanned based on embedded systems, and craniocerebral skeletal repair operations performed by doctors remotely operating mechanical arms. The power required by these embedded systems is often supplied by batteries that are limited in volume and energy. In this case, reducing the power consumption of the embedded system is more significant for the use of the product.
Disclosure of Invention
The invention provides a method, a device, equipment and a computer readable storage medium for reducing power consumption.
One aspect of the present invention provides a method for reducing power consumption, which is applied to an embedded operating system, and includes:
before the equipment driver detects the equipment resource, determining the current starting stage of the equipment according to the driving execution stage mark;
when the current starting stage is determined to be a specific starting stage, judging whether the equipment resource is used or not according to system configuration;
and if the judgment result is that the equipment resource is not used, closing the equipment resource.
In one possible embodiment, the turning off the unused device resource includes:
if the device resource is a General-purpose input/output (GPIO), the GPIO is set to the input mode, and the input level of the GPIO set to the input mode is set to 0.
In one possible embodiment, the turning off the unused device resource includes:
if the equipment resource has an enabling end, closing the enabling end of the equipment resource;
and if the equipment resource has the corresponding module clock, closing the module clock corresponding to the equipment resource.
In a possible implementation manner, in the starting process of the operating system, the current starting stage is determined according to the driving execution stage mark; wherein the boot phase of the operating system comprises: the method comprises a drive registration stage, a drive execution initialization first stage, a drive execution initialization second stage and a drive execution hooking interruption stage;
when the current starting stage is determined to be a specific starting stage, judging whether the equipment resource is used or not according to system configuration, wherein the judging step comprises the following steps:
and if the current starting stage is determined to be the drive registration stage, judging whether the equipment resource is used or not according to system configuration.
In one possible implementation, after the operating system is started, the idle rate of the CPU is obtained; and adjusting the frequency of the CPU according to the idle rate of the CPU.
Another aspect of the present invention is to provide an apparatus for reducing power consumption, which is applied to an embedded operating system, and includes:
the device comprises a drive execution stage determining module, a starting execution stage determining module and a starting execution stage determining module, wherein the drive execution stage determining module is used for determining the current starting stage of the device according to a drive execution stage mark before the device driver detects the device resource;
the power consumption reduction module is used for judging whether the equipment resources are used or not according to system configuration when the current starting stage is determined to be a specific starting stage; and if the judgment result is that the equipment resource is not used, closing the equipment resource.
In one possible implementation, the power consumption reduction module is further configured to:
and if the device resource is a GPIO, setting the GPIO to be in an input mode, and setting the input level of the GPIO set to be in the input mode to be 0.
In one possible implementation, the power consumption reduction module is further configured to:
if the equipment resource has an enabling end, closing the enabling end of the equipment resource;
and if the equipment resource has the corresponding module clock, closing the module clock corresponding to the equipment resource.
In one possible implementation, the driving execution phase determination module is further configured to:
in the starting process of an operating system, determining a current starting stage according to a drive execution stage mark; wherein the start-up phase of the operating system comprises: the method comprises a drive registration stage, a drive execution initialization first stage, a drive execution initialization second stage and a drive execution hooking interruption stage;
the reduced power consumption module is further to:
and if the current starting stage is determined to be the drive registration stage, judging whether the equipment resource is used or not according to system configuration.
In one possible implementation, the power consumption reduction module is further configured to:
after an operating system is started, acquiring the idle rate of a CPU; and adjusting the frequency of the CPU according to the idle rate of the CPU.
Another aspect of the present invention is to provide an apparatus for reducing power consumption, including:
a processor, a memory, and a computer program stored on the memory and executable on the processor;
wherein the processor implements the method for reducing power consumption described above when running the computer program.
Another aspect of the present invention is to provide a computer-readable storage medium, in which a computer program is stored, and the computer program is executed by a processor to implement the method for reducing power consumption.
According to the method, the device, the equipment and the computer readable storage medium for reducing the power consumption, the current starting stage of the equipment is determined according to the driving execution stage mark before the equipment driving detects the equipment resource; when the current starting stage is determined to be the specific starting stage, unused equipment resources are determined according to system configuration, the unused equipment resources are closed, the unused equipment resources of the system can be flexibly selected to be closed based on the system configuration, and therefore the closed equipment resources cannot be detected by equipment driving in the starting process of the operating system, starting and running cannot be achieved, power consumption of unnecessary equipment resources is avoided, and the effect of reducing overall power consumption based on embedded operating system software is achieved.
Drawings
FIG. 1 is a flowchart of a method for reducing power consumption according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for reducing power consumption according to a second embodiment of the present invention;
fig. 3 is a schematic diagram of an execution timing for turning off unused device resources according to a second embodiment of the present invention;
FIG. 4 is a diagram illustrating a process of reducing power consumption according to a second embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus for reducing power consumption according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of a device for reducing power consumption according to a fifth embodiment of the present invention.
With the above figures, certain embodiments of the invention have been illustrated and described in more detail below. The drawings and the description are not intended to limit the scope of the inventive concept in any way, but rather to illustrate it by those skilled in the art with reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in 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 invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terms "first", "second", etc. referred to in the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.
The method for reducing power consumption provided by the embodiment of the invention can be particularly applied to embedded operating systems, such as vxWorks operating systems. The embedded os is often applied to customized applications, such as a router (network transceiver), a display control computer (graphic display), and an intelligent audio device (audio input/output). The embedded operating system configures the required device resources according to specific application occasions, and the configured device resources can be different for different application occasions. The embedded operating system usually contains abundant device resources, so that a considerable amount of device resources are not used in various application scenarios, and unused device resources consume system energy, resulting in high overall system power consumption.
For example, taking a certain processor platform as an example, the following resources may be included:
1 GPU (Graphics Processing Unit);
the display controller supports two paths of DVO (Data Voice Outlet, Data Voice lead) display;
2 x4 PCIE (Peripheral Component Interconnect Express, high-speed serial computer expansion bus standard) 2.0 interfaces, which can be split into 6 independent x1 interfaces;
1 SATA (Serial Advanced Technology attachment)2.0 interface;
4 USB2.0 interfaces;
2 RGMII (Reduced Gigabit Media Independent Interface ) Gigabit network interfaces;
1 HDA (High Definition Audio) interface;
1I 2S (Inter-IC Sound, integrated circuit built-in audio bus) interface;
an RTC (Real-Time Clock)/HPET (High Precision Timer) module;
12 UART (Universal Asynchronous Receiver/Transmitter) controllers;
1 NAND (NAND flash memory device) controller;
2 CAN (Controller Area Network) controllers;
1 SDIO (Secure Digital Input and Output card) controller;
2I 2C (Inter-Integrated Circuit) controllers;
1 VPU (Video Processing Unit) decoder;
1 CAMERA (Camera Interface, video input conversion memory module) Interface controller;
1 temperature sensor;
60 GPIOs (General Purpose Input Output, Chinese General Purpose Input Output);
1 PWM (Pulse Width Modulation) controller.
Suppose that an application that has one controlling computer might require 1 HPET controller, 1 SATA interface, 1 x4 PCIE interface, 2 gigabit ports, 4 USB interfaces. The remaining unused device resources also contribute to power consumption.
In the process of implementing the present invention, the inventor finds that, in the prior art, people generally pay more attention to hardware for reducing power consumption, and various technologies are applied to change the power consumption of the hardware, such as chip manufacturing process and internal design structure, screening of resistance and capacitance of hardware design, and the like. In fact, the operation management of the whole system is embodied by software, and under the condition of certain hardware basis, the whole system can be reduced to the optimal state only by reducing the energy loss of the software system to the minimum. Currently, there is no effective way for software to reduce power consumption for embedded operating systems.
The method for reducing the power consumption aims to close unnecessary system resources which are not used according to the current system configuration, thereby realizing the reduction of the power consumption of the embedded operating system software and effectively reducing the power consumption of the whole system.
The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Example one
Fig. 1 is a flowchart of a method for reducing power consumption according to an embodiment of the present invention. The method in this embodiment is applied to an embedded operating system, such as a vxWorks operating system, and in other embodiments, the method may also be applied to other devices, and this embodiment takes the embedded operating system as an example for schematic illustration. As shown in fig. 1, the method comprises the following specific steps:
and S101, before the device driver detects the device resource, determining the current starting stage of the device according to the driving execution stage mark.
Generally, the vxWorks operating system boot process is divided into four phases: in the drive registration phase, a first phase of drive execution initialization (i.e., the phase of drive execution Init 1), a second phase of drive execution initialization (i.e., the phase of drive execution Init 2), and a phase of drive execution hooking interruption (Connect) are performed.
In the first phase of initialization of driver execution (i.e., the phase of Init1 driver execution), the device driver will detect (probe) the device, and if the device is not turned off, the device will be detected.
In order to avoid that the unused device resource is detected by the device driver in the Init1 phase of driver execution, in this embodiment, in the driver registration phase before the device driver detects the device resource, whether each device resource is used is sequentially determined according to the system configuration, and the unused device resource may be determined. The device driver is a driver corresponding to different functional interfaces of the CPU; exemplarily, when the functional interface of the CPU is a display interface, the corresponding device driver is a display driver; when the functional interface of the CPU is an audio interface, the corresponding equipment driver is a sound card driver; when the functional interface of the CPU is the SATA interface, the corresponding device driver is the SATA driver. Or, the device driver may be a driver connecting different device resources; based on the above processor platform example, the device driver may be a GPU driver, a display driver, a SATA driver, a USB device driver, an ethernet device driver, a sound card driver, and so on. Based on this, the device resources corresponding to each device driver can be detected through different device drivers, and the system configuration is obtained, so as to determine the current use state of each device resource.
In the starting process of the embedded operating system, the current starting process stage, namely the current starting stage, can be determined according to the driving execution stage mark.
Illustratively, taking vxWorks operating system as an example, in the vxWorks operating system, the drive execution phase flag is a global variable vxbInitphase. The starting process of the vxWorks operating system is divided into four stages, and the four stages are divided by the value of a global variable vxbInitphase. The four phases of the startup procedure are related to the value of the global variable vxbInitPhase as follows:
(1) the value of vxbInitphase ranges from 0 to 1 (excluding 1), and in order to drive the registration phase, a closing function of the unused device resource is called here to close the unused device resource.
(2) The value of vxbInitPhase is from 1 to 2 (excluding 2), and the first phase of initialization is executed for driving (i.e. the phase of driving and executing Init 1), where the device driver will detect (probe) the device, and if the device is not turned off, the device can be detected.
(3) The value of vxbInitPhase is from 2 to 3 (excluding 3), and the second phase of initialization is executed for driving (i.e. the phase of Init2 is executed for driving).
(4) The value of vxbInitPhase is from 3 onwards (including 3), and a hook interrupt (Connect) phase is performed for the driver.
Based on the boot process of the operating system, the current boot stage of the operating system can be determined according to the value of vxbInitPhase.
In another implementation manner of this embodiment, in the starting process of the embedded operating system, the current starting stage of the operating system may also be determined in other manners, and this embodiment is not limited in this embodiment.
And S102, judging whether to use equipment resources or not according to system configuration when the current starting stage is determined to be a specific starting stage.
The specific start-up phase may be any phase before the device driver probes the device resource.
The system configuration includes device resources required to be used in the current application scenario, and whether any one of the device resources is used or not can be determined according to the system configuration.
For example, the system configuration may record configuration information of each device resource, where the configuration information of each device resource includes whether the operating system uses the device resource. In this step, the configuration information of each device resource may be queried according to the system configuration, and whether the operating system uses the device resource is determined according to the configuration information of the device resource.
Illustratively, identification information of device resources required to be used by the operating system is recorded in a certain configuration item in the system configuration. In this step, for each device resource, by determining whether the configuration item in the system configuration includes the identification information of the device resource; if the configuration item contains the identification information of the equipment resource, determining to use the equipment resource; and if the configuration item does not contain the identification information of the equipment resource, determining not to use the equipment resource.
And step S103, if the judgment result is that the equipment resource is not used, closing the equipment resource.
And according to the judgment result, if any one equipment resource is not used, closing the equipment resource.
In this embodiment, before the device driver detects the device, the device resources that are not used in the current system configuration are turned off, so that after the operating system is started, the device resources are not started and run, and thus the power consumption of the device resources can be reduced.
The method comprises the steps that before equipment resources are detected by an equipment driver, the current starting stage of the equipment is determined according to a driver execution stage mark; when the current starting stage is determined to be the specific starting stage, unused equipment resources are determined according to system configuration, the unused equipment resources are closed, the unused equipment resources of the system can be flexibly selected to be closed based on the system configuration, and therefore the closed equipment resources cannot be started and operated in the starting process of the operating system, power consumption of unnecessary equipment resources is avoided, and the effect of reducing overall power consumption based on embedded operating system software is achieved.
Example two
Fig. 2 is a flowchart of a method for reducing power consumption according to a second embodiment of the present invention. On the basis of the first embodiment, in this embodiment, in the process of starting the operating system, the current starting stage is determined according to the driving execution stage flag; and if the current starting stage is determined to be the drive registration stage, judging whether to use the equipment resources or not according to the system configuration. The present embodiment exemplifies a method for reducing power consumption by applying to a vxWorks operating system. As shown in fig. 2, the method comprises the following specific steps:
step S201, in the starting process of the operating system, determining the current starting stage according to the driving execution stage mark.
In this embodiment, in the starting process of the embedded operating system, before the device driver detects each device resource, the device resource that is not used in the current system configuration is closed, so that the closed device resource is not operated after the operating system is started, and power consumption of the device resource can be reduced.
In the starting process of the embedded operating system, the current starting stage can be determined according to the driving execution stage mark, after the current starting stage enters the driving registration stage, step S202 is executed, and in the driving registration stage, unused equipment resources are closed.
Illustratively, taking the vxWorks operating system as an example, in the vxWorks operating system, the drive execution phase flag is a global variable vxbInitphase. The starting process of the vxWorks operating system is divided into four stages, and the four stages are divided by the value of a global variable vxbInitphase. The relationship between the four phases of the startup procedure and the value of the global variable vxbInitPhase is as follows:
(1) the value of vxbInitPhase is from 0 to 1 (excluding 1), and in order to drive the registration phase, a closing function of unused equipment resources is called here, and the unused equipment resources are closed.
(2) The value of vxbInitPhase is from 1 to 2 (excluding 2), and the first phase of initialization is executed for driving (i.e. the phase of driving and executing Init 1), where the device driver will detect (probe) the device, and if the device is not turned off, the device can be detected.
(3) The value of vxbInitPhase is from 2 to 3 (excluding 3), and the second phase of initialization is executed for driving (i.e. the phase of Init2 is executed for driving).
(4) The value of vxbInitPhase is from 3 onwards (including 3), and a hook interrupt (Connect) phase is performed for the driver.
Based on the above-mentioned boot process of the operating system, as shown in fig. 3, when vxbninitphase is 0, a shutdown function of the unused device resource may be called, the unused device resource may be determined according to the system configuration, and the unused device resource may be shut down.
In another implementation manner of this embodiment, in a start-up flow of the embedded operating system, a start-up stage of the operating system may also be determined in another manner, and before the device drives the detection device, the device resource that is not used in the current system configuration is closed, which is not specifically limited in this embodiment.
Step S202, if the current starting stage is determined to be the driving registration stage, whether the equipment resource is used is judged according to the system configuration.
In this embodiment, in the start-up process of the embedded operating system, at a drive registration stage before the device drive detection device, the unused device resource may be determined, and the unused device resource may be closed.
In a possible implementation manner, whether to use the device resource is determined according to the system configuration, which may specifically be implemented as follows:
and sequentially processing each equipment resource as follows: and judging whether to use the equipment resource according to the system configuration.
For example, the system configuration may record configuration information of each device resource, where the configuration information of each device resource includes whether the operating system uses the device resource. In this step, the configuration information of each device resource may be queried according to the system configuration information, and whether the operating system uses the device resource is determined according to the configuration information of the device resource.
Illustratively, identification information of device resources required to be used by the operating system is recorded in a certain configuration item in the system configuration. In this step, for each device resource, by determining whether the configuration item in the system configuration includes the identification information of the device resource; if the configuration item contains the identification information of the equipment resource, determining to use the equipment resource; and if the configuration item does not contain the identification information of the equipment resource, determining not to use the equipment resource.
And step S203, if the judgment result is that the equipment resource is not used, closing the equipment resource.
After determining unused device resources, in this step, the unused device resources are turned off.
In particular, the manner in which device resources are turned off may be different for different device resources.
Illustratively, when the unused device resource is turned off, if the device resource is a GPIO, the GPIO is set to the input mode for the unused GPIO, and the input level of the GPIO set to the input mode is set to 0.
For example, setting GPIOs to be input modes may be implemented by a function provided in the following code, where the input parameter of the function is the number of GPIOs:
when the unused device resource is closed, for the device resource with the enabling end, such as the display device, the unused device resource is closed in a manner of closing the device resource enabling end, so that the device resource does not work, and the power consumption of the system is reduced.
In addition, for the device resources with the corresponding module clocks, such as the network module, the GPU, the audio module, and the like, the device resources may be turned off in a manner of turning off the module clocks corresponding to the device resources, so that the device resources do not work, thereby reducing the system power consumption.
For example, based on the vxWorks operating system, the process of reducing power consumption may be as shown in fig. 4, including the following process flows:
(1) checking system configuration, judging whether the operating system does not use the first path display, and if the operating system does not use the first path display, closing the output enabling of the first path display;
(2) checking the system configuration, judging whether the operating system does not use the second path display, and if the operating system does not use the second path display, closing the output enabling of the second path display;
(3) checking the system configuration, judging whether the operating system does not use the GPU, and if the operating system does not use the GPU, closing a module clock of the GPU;
(4) checking the system configuration, when a plurality of GPIOs exist, the operating system may use a part of the GPIOs, and then setting the unused GPIOs into an input mode, and setting the input level of the GPIOs set into the input mode to 0, namely setting the unused GPIOs into the input mode and a state that the input level is pulled down;
(5) checking the system configuration, judging whether the operating system does not use the audio module, and if the operating system does not use the audio module, closing a module clock of the audio module;
(6) checking the system configuration, judging whether the operating system does not use the network module, and if the operating system does not use the network module, closing the module clock of the network module.
Illustratively, for example, suppose that in the bit field of the frame buffer configuration register of the display controller, the register offset positions of the frame buffer configuration registers of the two-way display device display controller are respectively: 0x1240 and 0x 1250. The 8 th bit (bit8) in the frame buffer configuration register controls whether the display is output to enable or not, when the display device is not used, the enable of the display device can be closed by clearing 0 from the 8 th bit (bit8) in the frame buffer configuration register, and therefore the display device is closed.
Alternatively, the bus number, the device number, and the function number of the display controller of each display device may be acquired first, then the base address of the display controller is acquired, the address of the frame buffer configuration register of the display controller is determined according to the base address of the display controller and the register offset position of the frame buffer configuration register of the display controller, the frame buffer configuration register bit8 of the display controller is cleared 0 according to the address of the frame buffer configuration register of the display controller, and the first path of display output is closed. The second output may be turned off in a similar manner.
It should be noted that, in fig. 4, only the processing of the device resources such as the two-way display output, the GPU, the GPIO, the audio device, and the network module is taken as an example to exemplarily describe the process of turning off each device resource, where the number and the type of the device resources included in the embedded operating system are not specifically limited, and the number and the type of the unused device resources to be turned off are also not specifically limited.
In addition, fig. 4 shows an example of the processing order of each device resource, and the processing order of each device resource is not particularly limited here.
In another possible implementation manner, according to the system configuration, determining unused device resources, and closing the unused device resources may specifically be implemented in the following manner:
all unused device resources are determined and then turned off, depending on the system configuration.
In practical application, the CPU is a chip with relatively large power consumption, and the operating frequency of the CPU and the power consumption are in a direct proportion change relationship, and the higher the operating frequency of the CPU, the higher the power consumption.
In another embodiment of this embodiment, after the operating system is started, the idle rate of the CPU may be obtained through steps S204 to S205, and the frequency of the CPU is adjusted according to the idle rate of the CPU, so as to reduce the power consumption of the CPU to a certain extent.
And step S204, acquiring the idle rate of the CPU after the operating system is started.
In this step, the idle rate of the CPU in a time period may be counted, where the counted time period may be set and adjusted according to an actual application scenario, and this embodiment is not specifically limited herein.
Illustratively, the CPU idle rate may be obtained by a tool that counts CPU idle rate or occupancy.
For example, in a vxWorks operating system, the CPU idle rate, i.e., the percentage of CPU idle over a period of time, may be counted by the SPY tool. The larger the idle rate (percentage of idle) of the CPU, the smaller the load of the CPU to execute the task, and the smaller the idle rate of the CPU, the larger the load of the CPU to execute the task.
And S205, adjusting the frequency of the CPU according to the idle rate of the CPU.
In this embodiment, the frequency of the CPU may be adjusted according to the idle rate of the CPU. Specifically, when the idle rate of the CPU is high, the frequency of the CPU is reduced; when the idle rate of the CPU is low, the frequency of the CPU is increased.
For example, the CPU frequency may be divided into three stages, i.e., high, medium, and low, and the frequency corresponding to each stage is preset. When the CPU idle rate is in a first range (e.g., 50% -80%) that is relatively central, the CPU frequency is set to the middle gear. When the CPU idle rate is in a second, higher range (e.g., 80% -100%), the CPU frequency is set to low. When the CPU idle rate is in a third lower range (e.g., below 50%), the CPU frequency is set to high.
In this embodiment, the power consumption of the CPU can be reduced by adjusting the frequency of the CPU in real time according to the idle rate of the CPU.
The embodiment of the invention can realize that the unused equipment resources are determined and the unused equipment resources are closed according to the system configuration before the equipment drives the detection equipment by determining the current starting stage according to the driving execution stage mark in the starting process of the operating system and determining the unused equipment resources and closing the unused equipment resources according to the system configuration in the driving registration stage, and can flexibly select the unused equipment resources of the system to close based on the system configuration.
EXAMPLE III
Fig. 5 is a schematic structural diagram of a device for reducing power consumption according to a third embodiment of the present invention. The device for reducing power consumption provided by the embodiment of the invention can execute the processing flow provided by the method for reducing power consumption. As shown in fig. 5, the apparatus 30 for reducing power consumption includes: a drive execution phase determination module 301 and a reduced power consumption module 302.
Specifically, the driver execution stage determining module 301 is configured to determine, according to the driver execution stage flag, a current start stage of the device before the device driver detects the device resource.
The reduced power consumption module 302 is configured to: when the current starting stage is determined to be the specific starting stage, judging whether equipment resources are used or not according to system configuration; and if the judgment result is that the equipment resources are not used, closing the equipment resources.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the first embodiment, and specific functions are not described herein again.
The embodiment of the invention determines the current starting stage of the equipment according to the system configuration and the drive execution stage mark before the equipment drive detects the equipment resource; when the current starting stage is determined to be the specific starting stage, unused equipment resources are determined according to system configuration, the unused equipment resources are closed, and the unused equipment resources of the system can be flexibly selected to be closed based on the system configuration.
Example four
On the basis of the third embodiment, in this embodiment, the power consumption reduction module is further configured to:
if the device resource is a GPIO, the GPIO is set to be in an input mode, and the input level of the GPIO set to be in the input mode is set to be 0.
In one possible implementation, the power consumption reduction module is further configured to:
if the equipment resource has an enabling end, closing the enabling end of the equipment resource; and if the equipment resource has the corresponding module clock, closing the module clock corresponding to the equipment resource.
In one possible implementation, the driving execution phase determination module is further configured to:
in the starting process of an operating system, determining a current starting stage according to a drive execution stage mark; wherein, the starting phase of the operating system comprises the following steps: the method comprises a drive registration stage, a drive execution initialization first stage, a drive execution initialization second stage and a drive execution hooking interruption stage.
The reduced power consumption module is further to:
and if the current starting stage is determined to be the drive registration stage, judging whether to use the equipment resources or not according to the system configuration.
In one possible implementation, the power consumption reduction module is further configured to:
after an operating system is started, acquiring the idle rate of a CPU; and adjusting the frequency of the CPU according to the idle rate of the CPU.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the second embodiment, and specific functions are not described herein again.
The embodiment of the invention can realize that the unused equipment resources are determined and the unused equipment resources are closed according to the system configuration before the equipment drives the detection equipment by determining the current starting stage according to the driving execution stage mark in the starting process of the operating system and determining the unused equipment resources and closing the unused equipment resources according to the system configuration in the driving registration stage, and can flexibly select the unused equipment resources of the system to close based on the system configuration.
EXAMPLE five
Fig. 6 is a schematic structural diagram of a device for reducing power consumption according to a fifth embodiment of the present invention. As shown in fig. 6, the apparatus 100 for reducing power consumption includes: a processor 1001, a memory 1002, and computer programs stored on the memory 1002 and executable on the processor 1001.
When the processor 1001 runs the computer program, the method for reducing power consumption provided by any one of the above method embodiments is implemented.
Before the device driver detects the device resource, the current starting stage of the device is determined according to the system configuration and the driver execution stage mark; when the current starting stage is determined to be the specific starting stage, unused equipment resources are determined according to system configuration, the unused equipment resources are closed, and the unused equipment resources of the system can be flexibly selected to be closed based on the system configuration.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for reducing power consumption provided by any of the above method embodiments is implemented.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (10)
1. A method for reducing power consumption is applied to an embedded operating system, and comprises the following steps:
before the equipment driver detects the equipment resources, determining the current starting stage of the equipment according to the driving execution stage mark;
when the current starting stage is determined to be a specific starting stage, judging whether the equipment resource is used or not according to system configuration;
and if the judgment result is that the equipment resource is not used, closing the equipment resource.
2. The method of claim 1, wherein the shutting down the device resource comprises:
and if the device resource is a GPIO, setting the GPIO to be in an input mode, and setting the input level of the GPIO set to be in the input mode to be 0.
3. The method of claim 1, wherein the shutting down the device resource comprises:
if the equipment resource has an enabling end, closing the enabling end of the equipment resource;
and if the equipment resource has the corresponding module clock, closing the module clock corresponding to the equipment resource.
4. The method according to any one of claims 1-3, further comprising:
in the starting process of an operating system, determining a current starting stage according to a drive execution stage mark; wherein the boot phase of the operating system comprises: the method comprises a drive registration stage, a drive execution initialization first stage, a drive execution initialization second stage and a drive execution hooking interruption stage;
when the current starting stage is determined to be a specific starting stage, judging whether the equipment resource is used or not according to system configuration, wherein the judging step comprises the following steps:
and if the current starting stage is determined to be the drive registration stage, judging whether the equipment resource is used or not according to system configuration.
5. The method of claim 4, further comprising:
after an operating system is started, acquiring the idle rate of a CPU;
and adjusting the frequency of the CPU according to the idle rate of the CPU.
6. An apparatus for reducing power consumption, applied to an embedded operating system, comprising:
the device comprises a drive execution stage determining module, a starting execution stage determining module and a starting execution stage determining module, wherein the drive execution stage determining module is used for determining the current starting stage of the device according to a drive execution stage mark before the device driver detects the device resource;
the power consumption reduction module is used for judging whether the equipment resources are used or not according to system configuration when the current starting stage is determined to be a specific starting stage; and if the judgment result is that the equipment resource is not used, closing the equipment resource.
7. The apparatus of claim 6, wherein the drive execution phase determination module is further configured to:
in the starting process of an operating system, determining a current starting stage according to a drive execution stage mark; wherein the boot phase of the operating system comprises: the method comprises a drive registration stage, a drive execution initialization first stage, a drive execution initialization second stage and a drive execution hooking interruption stage;
the reduced power consumption module is further to:
and if the current starting stage is determined to be the drive registration stage, judging whether the equipment resources are used or not according to system configuration.
8. The apparatus of claim 7, wherein the reduced power consumption module is further configured to:
after an operating system is started, acquiring the idle rate of a CPU; and adjusting the frequency of the CPU according to the idle rate of the CPU.
9. An apparatus for reducing power consumption, comprising:
a processor, a memory, and a computer program stored on the memory and executable on the processor;
wherein the processor, when executing the computer program, implements the method of any of claims 1 to 5.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011540344.3A CN114661139B (en) | 2020-12-23 | 2020-12-23 | Method, apparatus, device and computer readable storage medium for reducing power consumption |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011540344.3A CN114661139B (en) | 2020-12-23 | 2020-12-23 | Method, apparatus, device and computer readable storage medium for reducing power consumption |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114661139A true CN114661139A (en) | 2022-06-24 |
CN114661139B CN114661139B (en) | 2024-02-13 |
Family
ID=82024536
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011540344.3A Active CN114661139B (en) | 2020-12-23 | 2020-12-23 | Method, apparatus, device and computer readable storage medium for reducing power consumption |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114661139B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050050369A1 (en) * | 2003-08-29 | 2005-03-03 | Texas Instruments Incorporated | Thread scheduling mechanisms for processor resource power management |
CN103186223A (en) * | 2011-12-27 | 2013-07-03 | 英业达股份有限公司 | Detection method of computer device and external sub-board |
CN110278603A (en) * | 2019-06-20 | 2019-09-24 | 重庆邮电大学 | A method for dynamic power consumption adjustment of a mobile terminal |
CN110308934A (en) * | 2018-03-22 | 2019-10-08 | 龙芯中科技术有限公司 | HPET driving method and device, readable storage medium storing program for executing and electronic equipment |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107203418B (en) * | 2016-03-16 | 2021-02-02 | 斑马智行网络(香港)有限公司 | Method and device for selecting resources according to system configuration |
-
2020
- 2020-12-23 CN CN202011540344.3A patent/CN114661139B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050050369A1 (en) * | 2003-08-29 | 2005-03-03 | Texas Instruments Incorporated | Thread scheduling mechanisms for processor resource power management |
CN103186223A (en) * | 2011-12-27 | 2013-07-03 | 英业达股份有限公司 | Detection method of computer device and external sub-board |
CN110308934A (en) * | 2018-03-22 | 2019-10-08 | 龙芯中科技术有限公司 | HPET driving method and device, readable storage medium storing program for executing and electronic equipment |
CN110278603A (en) * | 2019-06-20 | 2019-09-24 | 重庆邮电大学 | A method for dynamic power consumption adjustment of a mobile terminal |
Non-Patent Citations (7)
Title |
---|
傲世阿龍: "《vxWorks系统中vxbus机制总结》", 《HTTPS://BLOG.CSDN.NET/U010383937/ARTICLE/DETAILS/72123955》 * |
冯博琴 等: "《计算机文化基础》", 30 September 1995, 西安交通大学出版社 * |
刘杰: "《基于固件的DSP开发及虚拟实现》", 31 March 2014, 北京航空航天大学出版社 * |
张文洁 等: "《机械电子工程导论》", 21 May 2015, 北京理工大学出版社 * |
徐建之 等: "《微型计算机应用技术》", 上海科学技术出版社 * |
樊卫华: "《嵌入式控制系统原理及设计》", 31 July 2020, 机械工业出版社 * |
顾藏知 等: "《数字电路与逻辑设计》", 31 March 2000, 电子科技大学出版社 * |
Also Published As
Publication number | Publication date |
---|---|
CN114661139B (en) | 2024-02-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10969849B2 (en) | Method and apparatus for implementing power modes in microcontrollers using power profiles | |
CN107526665B (en) | Chassis management system and chassis management method | |
KR100990188B1 (en) | A method of booting a host device from an MMC / SD device, a host device bootable from an MMC / SD device, and a method of an MMC / SD device booted from the host device | |
CN107346293B (en) | Method and system for dynamically reconfiguring at least one peripheral bus switch of a system | |
CN1742458B (en) | Method and device for controlling a data processing system during commissioning | |
US20160179648A1 (en) | System to detect charger and remote host for type-c connector | |
EP3367538B1 (en) | Smart power supply management for high standby power system | |
US20130117489A1 (en) | Usb host wake from sleep state for mobile devices | |
JPH08180013A (en) | Computer system,method for reconfiguration of configuration register of pci bus device in response to change in pci bus clock signal frequency and method in which pci bus interfacenotifies operator of operating speed different from pci bus | |
WO2018034796A1 (en) | Method, apparatus and system for role transfer functionality for a bus master | |
WO2012088530A2 (en) | Dynamic and idle power reduction sequence using recombinant clock and power gating | |
EP3062216A1 (en) | Network bios management | |
US9395799B2 (en) | Power management techniques for USB interfaces | |
CN112631414A (en) | Fan control method, system and medium | |
CN101196819B (en) | Method for chip self-adapting start equipment of system on chip | |
CN113656076A (en) | BIOS starting method and device based on hardware multiplexing channel | |
CN107070548A (en) | A kind of device and method for automatically adjusting QSFP+ optical module power grades | |
TWI515553B (en) | A method, apparatus, and system for energy efficiency and energy conservation including configurable maximum processor current | |
CN102759980B (en) | Multi-core electronic system and rate adjustment device thereof | |
US8990461B2 (en) | On-The-Go (OTG) USB devices configuration method for identifying configuration of other connected devices by reacting to change in resistance value on a resistive line | |
CN109375543B (en) | DVS voltage management device, DVS voltage management system, DVS voltage management method, storage medium, and computer device | |
CN101441497A (en) | Information processing apparatus having memory clock setting function and memory clock setting method | |
WO2012143945A2 (en) | Power management in multi host computing systems | |
CN114661139B (en) | Method, apparatus, device and computer readable storage medium for reducing power consumption | |
KR100687925B1 (en) | Computer systems |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |