A method, system, device, and storage medium for measuring power consumption
By establishing communication between the server and the control end, and using the power temperature daemon to optimize the running timing of the power meter, the problems of frequent manual operations and inaccurate measurements in existing server power consumption tests are solved, and automated and accurate power consumption measurement is achieved.
Patent Information
- Application Number
- CN202210748339.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-06-29
AI Technical Summary
During the power consumption test of existing servers, there are problems such as frequent manual operations, low automation programs, and inaccurate power consumption information testing.
By establishing mutual communication between the server and the control end, the server-side operation control end collects information on the power meter, and sets test parameters and optimizes the running timing through the power temperature daemon to achieve automated power consumption measurement.
It realizes automated and accurate measurement of server power consumption, reduces labor costs, and improves the matching degree of server and power meter during the measurement process.
Smart Images

Figure CN115022983B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of servers, and more particularly, to a method, system, device, and storage medium for measuring power consumption. Background Art
[0002] With the rapid development of the national digital new infrastructure construction, the energy consumption problem brought about by the rapid growth of the data center scale has received extensive attention from the whole society. While the computing power of servers is continuously enhanced and the integration density is continuously increased, there is a problem of lack of accurate measurement and prediction of the actual operating power, resulting in waste of cabinet and energy resources in the planning, design, and operation processes of data centers.
[0003] In general server power consumption tests, there are three main components: a control end, a server end, and a power meter. Among them, the server end is the device to be measured, the power meter is used to test the power consumption of the server, and the control end is responsible for the debugging of the power meter and the collection of power consumption information. In previous tests, the control end first manually controls the power meter to run and collect the server power consumption, then runs the test program on the server end. After a period of power consumption testing, the server end test is closed, and then the control end closes the power meter test and collects information.
[0004] In the above process, there are several disadvantages:
[0005] (1) It is necessary to manually operate the control end and the server end, and constantly switch between the control end and the server end during the operation process, with a low degree of automation.
[0006] (2) Since the control end and the server end do not communicate, the time line of power consumption information collection by the power meter and the time line of the program running on the server end cannot be accurately matched, resulting in inaccurate power consumption information testing. Summary of the Invention
[0007] In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device, and computer-readable storage medium for measuring power consumption. The present invention establishes mutual communication between the server end and the control end, and the server end operates the control end to collect information of the power meter. At the same time, the control end will generate corresponding information and feedback it to the server end. By optimizing the operation timing of the server end, the control end, and the power meter, the measurement of the server power consumption can be accurately completed automatically.
[0008] For the above purposes, one aspect of the embodiments of the present invention provides a method for measuring power consumption, including the following steps: installing a power supply temperature daemon on the control end, and performing communication identification and time synchronization between the server end and the control end; performing communication identification between the control end and a power meter, and setting test parameters through the power supply temperature daemon and operating the power meter to measure power consumption; running a test program on the server end, and recording the voltage and current of the server end through the power meter; and in response to the completion of the operation of the test program, operating the control end through the server end to copy power consumption information to the server end.
[0009] In some embodiments, the performing communication identification and time synchronization between the server end and the control end includes: establishing a communication relationship between the server end and the control end through the socket method, and controlling the delay between the server end and the control end within a preset time.
[0010] In some embodiments, the setting test parameters through the power supply temperature daemon and operating the power meter to measure power consumption includes: setting the voltage range and current range of the power meter through the control end, and receiving the test status of the voltage range and current range fed back by the power meter.
[0011] In some embodiments, the operating the control end through the server end to copy power consumption information to the server end includes: in response to the control end receiving a command to stop the test sent by the server end, sending a command to stop running to the power meter and controlling the power meter to set the voltage and current ranges to the automatic range, and sending the information fed back by the power meter to the server end.
[0012] Another aspect of the embodiments of the present invention provides a system for measuring power consumption, including: a first communication module configured to install a power supply temperature daemon on the control end, and perform communication identification and time synchronization between the server end and the control end; a second communication module configured to perform communication identification between the control end and a power meter, and set test parameters through the power supply temperature daemon and operate the power meter to measure power consumption; a test module configured to run a test program on the server end, and record the voltage and current of the server end through the power meter; and a copying module configured to, in response to the completion of the operation of the test program, operate the control end through the server end to copy power consumption information to the server end.
[0013] In some embodiments, the first communication module is configured to: establish a communication relationship between the server end and the control end through the socket method, and control the delay between the server end and the control end within a preset time.
[0014] In some embodiments, the second communication module is configured to: set the voltage range and current range of the power meter through the control terminal, and receive the test status of the voltage range and current range fed back by the power meter.
[0015] In some embodiments, the replication module is configured to: in response to the control terminal receiving the command to stop the test sent by the server terminal, send a command to stop running to the power meter and control the power meter to set the voltage and current ranges to the automatic range, and send the information fed back by the power meter to the server terminal.
[0016] Another aspect of the embodiments of the present invention further provides a computer device, including: at least one processor; and a memory, where the memory stores computer instructions that can be run on the processor, and when the instructions are executed by the processor, the steps of the above method are implemented.
[0017] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program that implements the steps of the above method when executed by a processor.
[0018] The present invention has the following beneficial technical effects: By establishing the mutual communication between the server terminal and the control terminal, the server terminal is used to operate the control terminal to collect information of the power meter, and at the same time, the control terminal will generate corresponding information and feedback it to the server terminal. By designing and optimizing the operation timing of the server terminal, the control terminal and the power meter, the measurement work of the server power consumption can be accurately completed automatically. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other embodiments can be obtained based on these drawings without creative efforts.
[0020] Figure 1 It is a schematic diagram of an embodiment of the method for measuring power consumption provided by the present invention;
[0021] Figure 2 It is an architecture diagram of an embodiment of the method for measuring power consumption provided by the present invention;
[0022] Figure 3 It is a schematic diagram of communication between the server terminal and the control terminal;
[0023] Figure 4 It is a schematic diagram of communication between the control terminal and the power meter;
[0024] Figure 5 It is a timing diagram for starting the test;
[0025] Figure 6 It is a timing diagram after the test program finishes running;
[0026] Figure 7 It is a timing diagram for the power meter to complete the measurement work;
[0027] Figure 8 It is a schematic diagram of an embodiment of the system for measuring power consumption provided by the present invention;
[0028] Figure 9 It is a schematic diagram of the hardware structure of an embodiment of the computer device for measuring power consumption provided by the present invention;
[0029] Figure 10 It is a schematic diagram of an embodiment of the computer storage medium for measuring power consumption provided by the present invention. Specific embodiments
[0030] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the following further elaborates on the embodiments of the present invention in detail with reference to specific embodiments and the accompanying drawings.
[0031] It should be noted that all the expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two entities or parameters with the same name but different identities. It can be seen that "first" and "second" are only for the convenience of expression and should not be construed as a limitation on the embodiments of the present invention. This will not be elaborated one by one in the subsequent embodiments.
[0032] In the first aspect of the embodiments of the present invention, an embodiment of a method for measuring power consumption is proposed. Figure 1 The following shows a schematic diagram of an embodiment of the method for measuring power consumption provided by the present invention. As Figure 1 shown, the embodiments of the present invention include the following steps:
[0033] S1. Install a power supply temperature daemon on the control terminal, and perform communication identification and time synchronization between the server terminal and the control terminal;
[0034] S2. Perform communication identification between the control terminal and the power meter, and set test parameters through the power supply temperature daemon and operate the power meter to measure power consumption;
[0035] S3. Run a test program on the server terminal, and record the voltage and current of the server terminal through the power meter; and
[0036] S4. In response to the completion of the operation of the test program, operate the control terminal through the server terminal to copy the power consumption information to the server terminal.
[0037] In the embodiments of the present invention, by establishing communication between the server side and the control side, and reasonably designing the operation timing of the server side, the control side, and the power meter side in the power consumption test, the entire process can complete the automated power consumption measurement work led by the server side while ensuring the normal mutual connection of the server, the control side, and the power meter. On the one hand, it can automate the power consumption test process to reduce labor costs, and the entire test work can be completed with only one command. On the other hand, it can make the matching between the actual power consumption of the server and the test power consumption of the power meter during the measurement process more accurate.
[0038] Figure 2 It is an architecture diagram of an embodiment of the method for measuring power consumption provided by the present invention. As Figure 2 shown, the server is the device to be measured. During the measurement process, a specific test program will run, such as the inference or training program of an artificial intelligence server. During operation, the server will generate changes in voltage and current; the control side is the communication medium between the server side and the power meter side. The server side will send commands to start or end the test to the control side host. Similarly, the control side host will feedback the status of the power meter to the server side, so that the server side can determine whether the test can be carried out; the full name of PTDaemon is PowerTemperature Daemon, which is a program developed by the SPECML organization. Its main function is to communicate and control with the power meter on the control side, mainly including setting the range of the power meter, sending commands to start and end the test, collecting the test results of the power meter, etc. This program needs to be installed on the control side host; the power meter is a measuring device. The power meter needs to supply power to the server and at the same time measure information related to the power consumption of the server, mainly measuring information such as voltage, current, power, and recording time during the operation of the server.
[0039] Preliminary preparation:
[0040] Server side: It is necessary to install an operating system, access the network, install and run a Python operating environment, and install sshpass. Control side: It is necessary to install a Windows operating system, join the network, install a Python operating environment, and install PTDaemon. Power meter: It needs to be connected to a power source and supply power to the server. At the same time, it needs to be connected to the control side through a serial port.
[0041] Install a power temperature daemon program on the control side, and perform communication identification and time synchronization between the server side and the control side.
[0042] In some embodiments, the performing communication identification and time synchronization between the server side and the control side includes: establishing a communication relationship between the server side and the control side through the socket method, and controlling the delay between the server side and the control side within a preset time.
[0043] Figure 3 It is a schematic diagram of the communication between the server side and the control side. As Figure 3 shown, the communication relationship between the server side and the control side is established through the socket method, and at the same time, the synchronization time delay is controlled within 200 ms. If the time difference between the server side and the control side is greater than 200 ms, then both the control side and the server side need to synchronize time with the NTP server. Through the above process, the initial communication relationship can be established, laying a prerequisite for the subsequent actual power measurement.
[0044] The control side is communicated and identified with the power meter, and the test parameters are set through the power supply temperature daemon program and the power meter is operated to measure the power consumption.
[0045] In some embodiments, setting the test parameters through the power supply temperature daemon program and operating the power meter to measure the power consumption includes: setting the voltage range and current range of the power meter through the control side, and receiving the test status of the voltage range and current range fed back by the power meter.
[0046] Figure 4 It is a schematic diagram of the communication between the control side and the power meter. As Figure 4 shown, the communication identification between the control side and the power meter is established, and the test parameters are set. The control side operates the power meter to start measuring the power consumption. After the communication identification between the server side and the control side is established, the server side will send a command to start the power meter test to the control side, and then the control side will set the voltage range of the power meter. The power meter will also feedback the test status of the voltage range, and then the same process will be carried out for the current. After the range setting is completed, the control side will control the power meter to start running. Similarly, the power meter will feedback the information whether it starts running to the control side. After receiving the feedback from the power meter, the control side will feedback an instruction that the program can run to the server side.
[0047] The test program is run on the server side, and the voltage and current of the server side are recorded through the power meter.
[0048] After the processing of the previous two steps, at this time the power meter has started to measure the server power consumption information. Therefore, the server side needs to run the test program, and at the same time the power meter records information such as the voltage and current of the server side. For the specific timing, see Figure 5 .
[0049] In response to the completion of the operation of the test program, the control side is operated through the server side to copy the power consumption information to the server side.
[0050] In some embodiments, the operation of copying the power consumption information from the control end to the server end by the server end includes: in response to the control end receiving the command to stop the test sent by the server end, sending a command to stop running to the power meter and controlling the power meter to set the voltage and current ranges to the automatic range, and sending the information fed back by the power meter to the server end.
[0051] Figure 6 It is a timing diagram after the test program runs to completion, as Figure 6 shown. First, the server end will send a command to stop the test to the control end, then the control end will send an instruction to stop running to the power meter, then the control end will control the power meter to set the voltage and current ranges to the automatic range, and finally the power meter will feed back the stopped running status to the control end, and at the same time the control end will feed back a message to the server end about the information that the power meter has stopped running.
[0052] Figure 7 It is a timing diagram for the power meter to complete the measurement work, as Figure 7 shown. First, the server end will send the status of completing the test to the control end, the control end will complete the work of collecting the end power consumption information, then the server end will send a command to copy the added file to the control end, the control end will transfer the result file to the server end through the socket method, and finally complete the test work of the entire process.
[0053] Through the above steps, the communication between the server end and the control end can be established, and the operation timing of the server end, the control end, and the power meter end in the power consumption test can be reasonably designed. The whole process can complete the power consumption automation measurement work led by the server end under the condition that the server, the control end, and the power meter are Figure 2 shown in the normal mutual connection. On the one hand, the power consumption test process can be automated to reduce labor costs, and the entire test work can be completed with only one command. On the other hand, the actual power consumption of the server and the test power consumption of the power meter can be more accurately matched during the measurement process.
[0054] It should be particularly noted that each step in each embodiment of the above method for measuring power consumption can be mutually crossed, replaced, added, or deleted. Therefore, these reasonable permutations and combinations should also fall within the protection scope of the present invention for the method of measuring power consumption, and the protection scope of the present invention should not be limited to the embodiments.
[0055] Based on the above purpose, the second aspect of the embodiments of the present invention proposes a system for measuring power consumption. As Figure 8As shown, system 200 includes the following modules: a first communication module configured to install a power temperature daemon on the control end and perform communication identification and time synchronization between the server end and the control end; a second communication module configured to perform communication identification between the control end and a power meter, set test parameters through the power temperature daemon, and operate the power meter to measure power consumption; a test module configured to run a test program on the server end and record the voltage and current of the server end through the power meter; and a replication module configured to, in response to the completion of the operation of the test program, operate the control end through the server end to copy power consumption information to the server end.
[0056] In some embodiments, the first communication module is configured to: establish a communication relationship between the server end and the control end through the socket method and control the latency between the server end and the control end within a preset time.
[0057] In some embodiments, the second communication module is configured to: set the voltage range and current range of the power meter through the control end and receive the test status of the voltage range and current range fed back by the power meter.
[0058] In some embodiments, the replication module is configured to: in response to the control end receiving a command to stop the test sent by the server end, send a command to stop running to the power meter, control the power meter to set the voltage and current ranges to the automatic range, and send the information fed back by the power meter to the server end.
[0059] For the above purpose, a third aspect of the embodiments of the present invention provides a computer device, including: at least one processor; and a memory storing computer instructions executable on the processor, and the instructions are executed by the processor to implement the following steps: S1, install a power temperature daemon on the control end and perform communication identification and time synchronization between the server end and the control end; S2, perform communication identification between the control end and a power meter, set test parameters through the power temperature daemon, and operate the power meter to measure power consumption; S3, run a test program on the server end and record the voltage and current of the server end through the power meter; and S4, in response to the completion of the operation of the test program, operate the control end through the server end to copy power consumption information to the server end.
[0060] In some embodiments, the performing communication identification and time synchronization between the server end and the control end includes: establishing a communication relationship between the server end and the control end through the socket method and controlling the latency between the server end and the control end within a preset time.
[0061] In some embodiments, setting the test parameters through the power supply temperature daemon and operating the power meter to measure power consumption includes: setting the voltage range and current range of the power meter through the control terminal, and receiving the test status of the voltage range and current range fed back by the power meter.
[0062] In some embodiments, operating the control terminal through the server side to copy the power consumption information to the server side includes: in response to the control terminal receiving the command to stop the test sent by the server side, sending a command to stop running to the power meter and controlling the power meter to set the voltage and current ranges to the automatic range, and sending the information fed back by the power meter to the server side.
[0063] As Figure 9 shown, it is a schematic diagram of the hardware structure of an embodiment of the computer device for measuring power consumption provided by the present invention.
[0064] Taking the device as Figure 9 shown as an example, in this device, there is a processor 301 and a memory 302.
[0065] The processor 301 and the memory 302 can be connected through a bus or other means, Figure 9 and taking the connection through the bus as an example.
[0066] The memory 302, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the method for measuring power consumption in the embodiments of the present application. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 302, that is, implements the method for measuring power consumption.
[0067] The memory 302 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the method for measuring power consumption, etc. In addition, the memory 302 can include a high-speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 302 can optionally include a memory remotely set relative to the processor 301, and these remote memories can be connected to the local module through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0068] Computer instructions 303 corresponding to one or more methods for measuring power consumption are stored in a memory 302, and when executed by a processor 301, the methods for measuring power consumption in any of the above method embodiments are executed.
[0069] Any embodiment of a computer device that executes the above method for measuring power consumption can achieve the same or similar effects as any of the foregoing method embodiments corresponding thereto.
[0070] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, executes a method for measuring power consumption.
[0071] As Figure 10 shown, it is a schematic diagram of an embodiment of the above computer storage medium for measuring power consumption provided by the present invention. Taking the computer storage medium as shown in Figure 10 as an example, a computer-readable storage medium 401 stores a computer program 402 that, when executed by a processor, executes the above method.
[0072] Finally, it should be noted that those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The program for the method of measuring power consumption can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium of the program can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc. The embodiments of the above computer program can achieve the same or similar effects as any of the foregoing method embodiments corresponding thereto.
[0073] The above are exemplary embodiments disclosed by the present invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed by the present invention as defined by the claims. The functions, steps, and / or actions of the method claims according to the disclosed embodiments herein do not need to be executed in any specific order. In addition, although the elements disclosed in the embodiments of the present invention can be described or claimed in an individual form, they can also be understood as multiple unless explicitly limited to the singular.
[0074] It should be understood that, as used herein, unless the context clearly supports an exception, the singular form "one" is also intended to include the plural form. It should also be understood that "and / or" as used herein refers to any and all possible combinations including one or more of the associated listed items.
[0075] The above serial numbers of the disclosed embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0076] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, an optical disk, etc.
[0077] Those of ordinary skill in the art should understand that the discussion of any above embodiment is only exemplary, and is not intended to imply that the scope (including the claims) disclosed by the embodiments of the present invention is limited to these examples; under the idea of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other variations in different aspects of the above embodiments of the present invention, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention shall be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for measuring power consumption, characterized in that, it includes the following steps: Install a power temperature daemon program at the control end, and perform communication identification and time synchronization between the server end and the control end; Perform communication identification between the control end and the power meter, and set test parameters through the power temperature daemon program and operate the power meter to measure power consumption; Run a test program at the server end, and record the voltage and current of the server end through the power meter; and In response to the completion of the operation of the test program, operate the control end through the server end to copy the power consumption information to the server end. Wherein, in response to the control end receiving the stop test command sent by the server end, send a stop operation command to the power meter and control the power meter to set the voltage and current ranges to the automatic range, and send the information fed back by the power meter to the server end in the way of socket.
2. The method according to claim 1, characterized in that, The performing communication identification and time synchronization between the server end and the control end includes: Establish a communication relationship between the server end and the control end through the socket method, and control the delay between the server end and the control end within a preset time.
3. The method according to claim 1, characterized in that, The setting test parameters through the power temperature daemon program and operating the power meter to measure power consumption includes: Set the voltage range and current range of the power meter through the control end, and receive the test status of the voltage range and current range fed back by the power meter.
4. A system for measuring power consumption, characterized in that, it includes: A first communication module configured to install a power temperature daemon program at the control end, and perform communication identification and time synchronization between the server end and the control end; A second communication module configured to perform communication identification between the control end and the power meter, and set test parameters through the power temperature daemon program and operate the power meter to measure power consumption; A test module configured to run a test program at the server end, and record the voltage and current of the server end through the power meter; and A copying module configured to, in response to the completion of the operation of the test program, operate the control end through the server end to copy the power consumption information to the server end. Wherein, in response to the control end receiving the stop test command sent by the server end, send a stop operation command to the power meter and control the power meter to set the voltage and current ranges to the automatic range, and send the information fed back by the power meter to the server end in the way of socket.
5. The system according to claim 3, characterized in that, The first communication module is configured to: Establish a communication relationship between the server end and the control end through the socket method, and control the delay between the server end and the control end within a preset time.
6. The system according to claim 3, characterized in that, The second communication module is configured to: Set the voltage range and current range of the power meter through the control terminal, and receive the test status of the voltage range and current range fed back by the power meter.
7. A computer device, Characterized in that, Comprising: At least one processor; And A memory storing computer instructions executable on the processor, and when the instructions are executed by the processor, the steps of the method according to any one of claims 1-3 are implemented.
8. A computer-readable storage medium storing a computer program, Characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1-3 are implemented.
Citation Information
Patent Citations
Method for testing dynamic power consumption of servers
CN104572419A