Summary of the invention
The invention provides a kind of computing machine power consumption calculation method and device, can help the user to calculate more accurately and rapidly the computer power consumption.
In order to address the above problem, the invention discloses a kind of computing machine power consumption calculation method, comprising:
Obtain the configuration information of each hardware device in computing machine;
The inquiry power consumption data corresponding with the configuration information of each hardware device from preset database;
Power consumption data addition by each hardware device, calculate the computing machine total power consumption.
Wherein, described from preset database the inquiry power consumption data corresponding with the configuration information of each hardware device, comprise: if comprise model in the configuration information of hardware device,, according to model preset in database and the mapping relations of power consumption, directly search the power consumption data corresponding with this model; Otherwise, the first model corresponding with the mapping relationship searching of model according to configuration information preset in database, and then according to model preset in database the power consumption data corresponding with the mapping relationship searching of power consumption.
Preferably, to meeting the hardware device of preset type of hardware, according to the model of hardware device, search corresponding power consumption data from database; To not meeting the hardware device of described preset type of hardware, the power consumption data corresponding with the mapping relationship searching of power consumption according to the type of hardware of database initialize.
Wherein, described preset type of hardware comprises: the type of hardware that surpasses preset range with different its power consumption difference of ardware model number; The described hardware device that does not meet preset type of hardware comprises: with the type of hardware of different its power consumption differences of ardware model number within described preset range.
Preferably, the fixing hardware device for power consumption, the average power consumption data that in described database, the power consumption data corresponding with the type hardware device is the type hardware device.
Preferably, to meeting the hardware device of preset ardware model number, according to the model of described hardware device, search corresponding power consumption data from database; To not meeting the hardware device of described preset ardware model number, the power consumption data corresponding with the mapping relationship searching of power consumption according to the hardware device type of database initialize.
Preferably, before the described configuration information that obtains each hardware device in computing machine, also comprise: the configuration information that automatically detects each hardware device in current computer; The described configuration information that obtains each hardware device that described detection obtains that is retrieved as.
Preferably, before the described configuration information that obtains each hardware device in computing machine, also comprise: the configuration information of each hardware device in any computing machine of free setting; The described configuration information that is retrieved as each hardware device that obtains described setting.
Preferably, described method also comprises: according to the computing machine total power consumption calculated, select the power supply be complementary.
Preferably, described method also comprises: the energy saver mode that User is selected, lower power consumption data that comprises hardware device of this energy saver mode of inquiry from preset database; The power consumption data obtained according to described inquiry, the power consumption of showing selected energy saver mode to the user, and/or show to the user power consumption that selected energy saver mode can be saved.
The present invention also provides a kind of computing machine power consumption calculation device, comprising:
The hardware configuration acquisition module, for obtaining the configuration information of each hardware device of computing machine;
The power consumption enquiry module, for the inquiry of the database from the preset power consumption data corresponding with the configuration information of each hardware device;
The power consumption calculation module, the power consumption data addition for by each hardware device, calculate the computing machine total power consumption.
Wherein, if comprise model in the configuration information of hardware device, described power consumption enquiry module, according to model preset in database and the mapping relations of power consumption, is directly searched the power consumption data corresponding with this model; Otherwise described power consumption enquiry module is the model corresponding with the mapping relationship searching of model according to configuration information preset in database first, and then according to model preset in database the power consumption data corresponding with the mapping relationship searching of power consumption.
Preferably, to meeting the hardware device of preset type of hardware, described power consumption enquiry module is searched corresponding power consumption data according to the model of hardware device from database; To not meeting the hardware device of described preset type of hardware, the power consumption data that described power consumption enquiry module is corresponding with the mapping relationship searching of power consumption according to the hardware device type of database initialize.
Wherein, described preset type of hardware comprises: the type of hardware that surpasses preset range with different its power consumption difference of ardware model number; The described hardware device that does not meet preset type of hardware comprises: with the type of hardware of different its power consumption differences of ardware model number within described preset range.
Preferably, the fixing hardware device for power consumption, the average power consumption data that in described database, the power consumption data corresponding with the type hardware device is the type hardware device.
Preferably, to meeting the hardware device of preset ardware model number, described power consumption enquiry module is searched corresponding power consumption data according to the model of described hardware device from database; To not meeting the hardware device of described preset ardware model number, the power consumption data that described power consumption enquiry module is corresponding with the mapping relationship searching of power consumption according to the type of hardware of database initialize.
Preferably, described device also comprises: hardware detecting module, for automatically detecting the configuration information of each hardware device of current computer; Described hardware configuration acquisition module is to obtain the configuration information that described hardware detecting module detects each hardware device obtained.
Preferably, described device also comprises: module is selected in configuration, for the configuration information of any each hardware device of computing machine of free setting; Described hardware configuration acquisition module is to obtain the configuration information that each hardware device of module setting is selected in described configuration.
Preferably, described device also comprises: power adaptation module, for the computing machine total power consumption calculated according to the power consumption calculation module, select the power supply be complementary.
Preferably, described device also comprises: energy saving calculation module, the energy saver mode of selecting for User, lower power consumption data that comprises hardware device of this energy saver mode of inquiry from preset database; And the power consumption data obtained according to described inquiry, the power consumption of showing selected energy saver mode to the user, and/or show to the user power consumption that selected energy saver mode can be saved.
Compared with prior art, the present invention includes following advantage:
The first, the present invention has collected various computer hardware equipments corresponding power consumption data under various configuring conditions in advance, and is stored in database.When the user need to understand the computing machine power consumption, the present invention can detect the configuration information of each hardware device of computing machine automatically, and then Query Database obtains the power consumption data of each hardware device, and all power consumption data additions calculate the total power consumption of computing machine.This method can help the user and obtain fast the power consumption of computer in the situation that do not understand the computer configuration.
In addition, the present invention also can be by the configuration of selected each hardware device of user, and the configuration information of setting according to the user calculate total power consumption, facilitate the user when choosing computer as a reference.
The second, the present invention, for the relatively-stationary hardware device of power consumption, as mouse, keyboard etc., adopts the average power consumption value to be calculated; And, for the hardware device differed greatly with different its power consumptions of ardware model number, as CPU, hard disk, mainboard etc., the Main Basis ardware model number is inquired about corresponding power consumption.
The 3rd, after automatically obtaining the computing machine total power consumption, the power supply that the user can select power to be complementary according to this power consumption data, or it is selective also the power supply be complementary directly can be recommended to the user, is very easy to the user.
The 4th, the present invention can also calculate the saving power consumption under different energy saver modes, facilitates the user to select different energy saver modes.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
The invention provides a kind of computing machine power consumption calculation method and device, can obtain fast the power consumption of current computer or other any computing machines, and offer the user, facilitate the user to understand in time the power consumption of own computer, or facilitate the user to understand the power consumption situation under various configurations when choosing computer.
Below by embodiment, be elaborated.
With reference to Fig. 1, it is the process flow diagram of a kind of described computing machine power consumption calculation method of the embodiment of the present invention.
Step 101, obtain the configuration information of each hardware device in computing machine;
Wherein, described configuration information comprises the information such as brand, model, size or size of hardware device, and for example, the configuration of certain computer is as follows:
Processor: the Celeron of Intel (Celeron) D 3.20GHz
Mainboard: the 0A48 of Microstar (ATI RS400/200)
Internal memory: 1GB (remember scientific and technological DDR2667MHz/ gold scholar pause DDR2667MHz)
Primary Hard Drive: the HDS721680PLA380 of Hitachi (80GB)
Video card: ATI Radeon Xpress 200Series (RC410) (128MB/ Microstar)
Display: the HWP26E0HPw17e of Hewlett-Packard (17.2 inches)
CD-ROM drive: the ATAPI DVD D DH16DYP of Hewlett-Packard DVD drive
Sound card: Realtek ALC862@ATI IXP SB450 HD Audio
Network interface card: Atheros AR5005G Wireless Network Adapter
Step 102, the inquiry power consumption data corresponding with the configuration information of each hardware device from preset database;
The embodiment of the present invention has been collected various computer hardware equipments corresponding power consumption data under various configuring conditions in advance, and this mapping relations of configuration information and power consumption data are stored in database.When carrying out power consumption calculation, if obtained the configuration information of hardware device, just can from database, directly inquire about and obtain corresponding power consumption data.Wherein, described power consumption data is the theoretical power consumption peak value of hardware device under maximum working load.
Concrete, in actual applications, the mapping relations of unit type and the power consumption data of can prestoring in database, if comprise model in the configuration information of the hardware device obtained, can, according to model preset in database and the mapping relations of power consumption, directly search the power consumption data corresponding with this model.
But, do not comprise model in some configuration information obtained, but the information such as some vendor ids, device id, in this case, the mapping relations of also prestored in the described database of the embodiment of the present invention described configuration information (referring to the information such as vendor id, device id) and model.According to these mapping relations, can find the unit type corresponding with configuration informations such as vendor id, device ids, and then arrive corresponding power consumption according to unit type with the mapping relationship searching of power consumption data.
Step 103, the power consumption data addition by each hardware device, calculate the computing machine total power consumption.
After obtaining the power consumption data of each hardware device, carry out the total power consumption that addition can obtain computing machine.
Content based on above-described embodiment, in another preferred embodiment, step 102 further can also comprise following content:
(1) to meeting the hardware device of preset type of hardware, according to the model of described hardware device, search corresponding power consumption data from database; To not meeting the hardware device of described preset type of hardware, the power consumption data corresponding with the mapping relationship searching of power consumption according to the type of hardware of database initialize.
Wherein, described type of hardware refers to the hardware class such as CPU, hard disk, mainboard, and the model of described hardware device refers to acer0219 model display, the E5300 of Intel processor etc.Usually, the hardware of same type all includes Multiple Type.
Described preset type of hardware comprises: the type of hardware that surpasses preset range with different its power consumption difference of ardware model number; Accordingly, the described hardware device that does not meet preset type of hardware comprises: with the hardware device of different its power consumption differences of ardware model number within described preset range, the i.e. relatively-stationary hardware device of power consumption.
Therefore, the fixing hardware device for power consumption, can not distinguish ardware model number and adopt the average power consumption value, directly search power consumption corresponding with the hardware of the type in database, the average power consumption data that in wherein said database, the power consumption data corresponding with the type hardware device is the type hardware device.For example, for power consumptions such as CD-ROM drive, mouse, keyboards, less and relatively-stationary hardware device, can adopt the average power consumption value to be calculated.
(2) to meeting the hardware device of preset ardware model number, according to the model of described hardware device, search corresponding power consumption data from database; To not meeting the hardware device of described preset ardware model number, the power consumption data corresponding with the mapping relationship searching of power consumption according to the type of hardware of database initialize.
Generally, described database only can be listed several models commonly used to the hardware of one type, can not list all models, and therefore for the ardware model number had in database, directly Query Database obtains the power consumption corresponding with this model; And for the ardware model number do not had in database, can Query Database in the power consumption of hardware of the type, now this power consumption can be the average power consumption of the hardware of the type.For example, the CPU model that can directly inquire in database has tri-kinds of A, B, C, if calculate the power consumption of the CPU that model is D, database provides the average power consumption data of CPU.
Based on above-mentioned power consumption calculation flow process, the embodiment of the present invention provides following two kinds of application:
Application one: the power consumption of calculating current computer
The present embodiment can calculate the power consumption of current computer automatically, detailed process is: the configuration information that at first automatically detects each hardware device in current computer, and then execution step 101-103, obtain this hardware detection result, obtain the power consumption of single hardware device according to this hardware detection result queries database, and the power consumption addition of single hardware device is obtained to total power consumption.
Wherein, the hardware device difference, the method that automatically detects configuration information is also different, for example:
If automatically detect the configuration information of CPU, to CPU bottom program, send instruction, comprised character string information in the return data of this instruction, may comprise type information in this character string information.
If automatically detect the configuration information of video card, first travel through boards all in computing machine (mainboard, video card, sound card, network interface cards etc. are referred to as board), then find the board (being video card) for showing, read the configuration information (as information such as vendor id, device ids) of this video card.
With reference to Fig. 2, it is the schematic diagram of power consumption calculation in the described application one of the embodiment of the present invention.Demonstrate the specific configuration information of computing machine main hardware equipment as mainboard, processor, video card, hard disk, internal memory, display in this figure, and power consumption corresponding to each hardware device and the total power consumption value of total.
The method of this automatic calculating current computer power consumption, can help the user to understand more exactly the power consumption situation of computer; And, configuration information and the corresponding power consumption data of searching one by one each hardware device without the user.
Application two: the power consumption of calculating other any computing machines
The user also can be according to oneself need to freely select other hardware devices to carry out power consumption calculation according to device type.Detailed process is: the configuration information of each hardware device in any computing machine of first free setting, and then execution step 101-103, obtain each hardware configuration information that the user sets, obtain the power consumption of single hardware device according to the hardware configuration information Query Database of this setting, and the power consumption addition of single hardware device is obtained to total power consumption.
With reference to Fig. 3, it is the schematic diagram of power consumption calculation in the described application two of the embodiment of the present invention.For each hardware device, the option that relevant configuration all is provided is freely selected for the user, and user's different hardware configuration of can arbitrarily arranging in pairs or groups is calculated the power consumption situation under this configuration.After setting up the configuration of each hardware, click " automatically calculating power consumption " button, on interface, can demonstrate the total power consumption value.In Fig. 3, because the configuration of mainboard, processing and video card has not arranged, therefore can't be calculated.
Above-mentioned application two can help the user to understand the power consumption situation under different configurations before choosing computer, in order to select more suitable computer according to the needs of oneself.
Further, preferred, according to the computing machine total power consumption calculated, can also help the user to select the power supply of power match.And the database of all right preset storage computing machine power consumption of system and power supply corresponding relation after calculating the computing machine power consumption, is automatically inquired about the power supply be complementary, and is presented on the interface shown in Fig. 2 or Fig. 3 in this database, recommends the user and selects.Wherein, the power information of recommendation can be listed the details such as model, manufacturer, can recommend multiple power sources to select for user priority simultaneously.
Because computer power supply is being brought into play vital effect to the premium properties of a computing machine, whether the operation of machine stablizes depends on matched power supply to a great extent, waste a little if buy a powerful power supply, if buy a low power power supply, can not meet again need for electricity.And the described method of the embodiment of the present invention can help the user to choose suitable power supply, thus using electricity wisely.
Preferably, the power consumption calculation method based on above-mentioned, can also calculate the power consumption (or electric weight) of saving to different energy saver modes.Concrete, the energy saver mode that User is selected, lower power consumption data that comprises hardware device of this energy saver mode of inquiry from preset database; And the power consumption data obtained according to described inquiry, calculate the power consumption of user-selected energy saver mode, and show to the user; And, by before starting energy saver mode and the power consumption data started after energy saver mode subtract each other, can obtain the power consumption that user-selected energy saver mode can be saved, and show to the user.
Wherein, described energy saver mode can have multiple, as closes the energy saver mode of display, lightens or dim the energy saver mode of display, and the energy saver mode of dormancy/standby starts the pattern of energy-conservation wallpaper, etc.Under different energy saver modes, the hardware started or the state of hardware are all different.For example closing under the energy saver mode of display, display is closed automatically, now can be from database the power consumption of query display device under starting state, this power consumption data is exactly to close the power consumption of saving under the pattern of display.
Again for example, lightening display and dimming under two kinds of energy saver modes of display, the display brightness of display (being described hardware state) is different, and wherein under a kind of pattern, display is in lightening state, and under another kind of pattern, display is in dimming state.The power consumption of display under different display brightness in Query Database, and compare with the power consumption before starting energy saver mode, just can calculate the power consumption of saving under the energy saver mode that lightens or dim display.
Content based on said method embodiment, the present invention also provides corresponding device embodiment.
With reference to Fig. 4, it is the structural drawing of the described a kind of computing machine power consumption calculation device of the embodiment of the present invention.
Described computing machine power consumption calculation device comprises with lower module:
Hardware configuration acquisition module 41, for obtaining the configuration information of each hardware device of computing machine;
Power consumption enquiry module 42, for the inquiry of the database from the preset power consumption data corresponding with the configuration information of each hardware device;
Power consumption calculation module 43, the power consumption data addition for by each hardware device, calculate the computing machine total power consumption.
Wherein, if comprise model in the configuration information of the hardware device that hardware configuration acquisition module 41 obtains, power consumption enquiry module 42 can, according to model preset in database and the mapping relations of power consumption, directly be searched the power consumption data corresponding with this model; But, if do not comprise model in the configuration information obtained, but the information such as some vendor ids, device id, power consumption enquiry module 42 can be first according to configuration information preset in database (referring to the information such as vendor id, the device id) model corresponding with the mapping relationship searching of model, and then according to model preset in database the power consumption data corresponding with the mapping relationship searching of power consumption.
Further preferred, to meeting the hardware device of preset type of hardware, described power consumption enquiry module 42 is searched corresponding power consumption data according to the model of hardware device from database; To not meeting the hardware device of described preset type of hardware, the power consumption data that described power consumption enquiry module 42 is corresponding with the mapping relationship searching of power consumption according to the hardware device type of database initialize.Wherein, described preset type of hardware comprises: the type of hardware that surpasses preset range with different its power consumption difference of ardware model number; The described hardware device that does not meet preset type of hardware comprises: with the type of hardware of different its power consumption differences of ardware model number within described preset range.For example, the fixing hardware device for power consumption, in described database, the power consumption data corresponding with the type hardware device is the average power consumption data of the type hardware device.
Further preferred, to meeting the hardware device of preset ardware model number, described power consumption enquiry module 42 is searched corresponding power consumption data according to the model of described hardware device from database; To not meeting the hardware device of described preset ardware model number, the power consumption data that described power consumption enquiry module 42 is corresponding with the mapping relationship searching of power consumption according to the type of hardware of database initialize.
Preferably, if for the application one in said method embodiment, described computing machine power consumption calculation device can also comprise:
Hardware detecting module 44, for automatically detecting the configuration information of each hardware device of current computer;
Accordingly, described hardware configuration acquisition module 41 is to obtain the configuration information that described hardware detecting module 44 detects each hardware device obtained.
If for the application two in said method embodiment, described computing machine power consumption calculation device can also comprise:
Module 45 is selected in configuration, for the configuration information of any each hardware device of computing machine of free setting;
Accordingly, described hardware configuration acquisition module 41 is to obtain the configuration information that each hardware device of module 45 settings is selected in described configuration.
In actual applications, described device can only comprise hardware detecting module 44 or module 45 is selected in configuration, also can comprise described two modules simultaneously, can be used for applying one and the situation of application two simultaneously.
Further preferred, described computing machine power consumption calculation device can also comprise:
Power adaptation module 46, for the computing machine total power consumption calculated according to power consumption calculation module 43, select the power supply be complementary.
Further preferred, described computing machine power consumption calculation device can also comprise:
Energy saving calculation module 47, the energy saver mode of selecting for User, lower power consumption data that comprises hardware device of this energy saver mode of inquiry from preset database; And the power consumption data obtained according to described inquiry, the power consumption of showing selected energy saver mode to the user, and/or show to the user power consumption that selected energy saver mode can be saved.
Above-mentioned computing machine power consumption calculation device can be used in numerous general or special purpose computingasystem environment or configuration.For example: personal computer, server computer, handheld device or portable set, plate equipment, multicomputer system, the system based on microprocessor, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, comprise distributed computing environment of above any system or equipment etc.
For said apparatus embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, the part explanation of relevant part embodiment of the method shown in Figure 1 gets final product.
In sum, above-mentioned computing machine power consumption calculation device is installed in computing machine, after starting the power consumption calculation function, this device can be according to the hardware detection power consumption information of the main hardware equipment of Auto-matching current computer as a result, and show and add up to the power consumption calculation value; What perhaps, the user also can be according to oneself need to freely select other hardware devices to carry out power consumption calculation according to device type.And this device can also provide the power supply be complementary recommendation function, for the user, select.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is and the difference of other embodiment that between each embodiment, identical similar part is mutually referring to getting final product.
Above to a kind of computing machine power consumption calculation method provided by the present invention and device, be described in detail, applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention simultaneously.