CN116431412A - Method and device for testing power consumption performance of hard disk and electronic equipment - Google Patents

Method and device for testing power consumption performance of hard disk and electronic equipment Download PDF

Info

Publication number
CN116431412A
CN116431412A CN202310443102.XA CN202310443102A CN116431412A CN 116431412 A CN116431412 A CN 116431412A CN 202310443102 A CN202310443102 A CN 202310443102A CN 116431412 A CN116431412 A CN 116431412A
Authority
CN
China
Prior art keywords
hard disk
power consumption
tested
data transmission
testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310443102.XA
Other languages
Chinese (zh)
Inventor
刘方健
靳嘉晖
李允阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202310443102.XA priority Critical patent/CN116431412A/en
Publication of CN116431412A publication Critical patent/CN116431412A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2268Logging of test results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/26Functional testing
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy 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)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a method and a device for testing the power consumption performance of a hard disk, and electronic equipment, wherein the method comprises the following steps: obtaining hard disk information and bandwidth step length of a hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length; generating a test script according to the configuration file, and testing the power consumption of the hard disk to be tested when the hard disk to be tested is connected with a plurality of loads respectively according to the test script to obtain a power consumption value corresponding to each data transmission bandwidth, wherein the data transmission bandwidths of the hard disk to be tested when the hard disk to be tested is connected with the loads for data transmission are sequentially increased according to the bandwidth step length in the test process; fitting a plurality of data transmission bandwidths in the test process with a plurality of corresponding power consumption values to obtain an energy consumption relation. By the method and the device, the problem that the relation between the power consumption and the bandwidth of the hard disk cannot be tested in the prior art is solved.

Description

Method and device for testing power consumption performance of hard disk and electronic equipment
Technical Field
The embodiment of the application relates to the field of hard disk performance testing, in particular to a method and a device for testing power consumption performance of a hard disk, a computer readable storage medium and electronic equipment.
Background
At present, the power consumption test of an SSD (Solid State Disk, SSD for short) is generally carried out by the following steps: and controlling SSD to be electrified, respectively measuring SSD power consumption when no load exists, measuring SSD power consumption when maximum load exists according to spec values, collecting test results and analyzing. This approach can accomplish the power consumption test, but the following problems remain in actual use: only the power consumption value of the hard disk under no load and maximum load can be obtained, the test intermediate value is lacking, the relation between the power consumption of the hard disk and the bandwidth can not be obtained, the power consumption performance can not be optimized, and the energy consumption ratio can be improved.
Therefore, a method for testing the power consumption of the hard disk under different load conditions is needed to obtain the relation between the power consumption and the transmission bandwidth, so as to facilitate the optimization of the power consumption performance.
Disclosure of Invention
The embodiment of the application provides a method and a device for testing the power consumption performance of a hard disk, a computer readable storage medium and electronic equipment, so as to at least solve the problem that the relation between the power consumption and the bandwidth of the hard disk cannot be tested in the related technology.
According to one embodiment of the present application, there is provided a method for testing power consumption performance of a hard disk, including: obtaining hard disk information and bandwidth step length of a hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length, wherein the hard disk information at least comprises a hard disk code number; generating a test script according to the configuration file, and sequentially testing the power consumption of the hard disk to be tested when the hard disk to be tested is respectively connected with a plurality of loads for data transmission according to the test script to obtain a power consumption value corresponding to each data transmission bandwidth, wherein in the test process, the data transmission bandwidths of the hard disk to be tested when the hard disk to be tested is connected with the plurality of loads for data transmission are sequentially increased according to the bandwidth step length; fitting a plurality of data transmission bandwidths and a plurality of corresponding power consumption values in the testing process to obtain an energy consumption relation, wherein the energy consumption relation represents the corresponding relation between the data transmission bandwidths and the power consumption values of the hard disk to be tested.
In an exemplary embodiment, before testing the power consumption of the hard disk to be tested when data transmission is performed on the hard disk to be tested and a plurality of load connections respectively according to the test script, the method further includes: identifying the hard disk information of the hard disk to be tested through a lspci command and an nvme list command; and determining whether the hard disk information obtained through recognition is consistent with the hard disk information in the configuration file.
In an exemplary embodiment, before testing the power consumption of the hard disk to be tested when data transmission is performed on the hard disk to be tested and a plurality of load connections respectively according to the test script, the method further includes: identifying the hard disk information of the hard disk to be tested through a lspci command and an nvme list command; and determining whether the hard disk information obtained through recognition is consistent with the hard disk information in the configuration file.
In an exemplary embodiment, testing power consumption when the hard disk to be tested is connected with a plurality of loads respectively in sequence according to the test script includes: and sequentially testing the power consumption of the hard disk to be tested when the hard disk to be tested is respectively connected with a plurality of loads for data transmission according to the test script by using a fio tool.
In an exemplary embodiment, the method further comprises: obtaining total time for testing power consumption when the hard disk to be tested is connected with a plurality of loads respectively for data transmission, and obtaining total test time, wherein the total test time is obtained by calculation of a time calculation script; and determining the current test progress according to the ratio of the current test time to the total test time in the test process, and displaying the current test progress.
In an exemplary embodiment, before obtaining the hard disk information and the bandwidth step size of the hard disk to be tested, the method further includes: and connecting the hard disk to be tested with a power consumption measuring device so that the power consumption measuring device obtains the power consumption value output by the test script.
In an exemplary embodiment, obtaining a power consumption value corresponding to each data transmission bandwidth includes: and acquiring the power consumption value in the power consumption measuring device by using a power consumption acquisition script.
In an exemplary embodiment, the method further comprises: and outputting each power consumption value and each data transmission bandwidth corresponding to each power consumption value to a log file.
In an exemplary embodiment, after obtaining the energy consumption relation equation of the hard disk to be tested, the method further includes: and storing the hard disk information, each power consumption value, each data transmission bandwidth corresponding to each power consumption value and the energy consumption relation of the hard disk to be tested to a target physical address.
According to another embodiment of the present application, there is provided a device for testing power consumption performance of a hard disk, including: the generating module is used for acquiring the hard disk information and the bandwidth step length of the hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length, wherein the hard disk information at least comprises a hard disk code number; the testing module is used for generating a testing script according to the configuration file, testing the power consumption when the hard disk to be tested is connected with a plurality of loads respectively in sequence according to the testing script to obtain a power consumption value corresponding to each data transmission bandwidth, and the data transmission bandwidths when the hard disk to be tested is connected with the loads for data transmission are sequentially increased according to the bandwidth step length in the testing process; the fitting module is used for fitting the plurality of data transmission bandwidths and the corresponding plurality of power consumption values in the testing process to obtain an energy consumption relation, wherein the energy consumption relation represents the corresponding relation between the data transmission bandwidths of the hard disk to be tested and the power consumption values.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments.
According to the method and the device, firstly, information with a tested hard disk and bandwidth step length are obtained, power consumption when the hard disk to be tested is connected with a plurality of loads for data transmission is tested, the data transmission bandwidth when the hard disk to be tested is connected with each load for data transmission is sequentially increased according to the bandwidth step length, each data transmission bandwidth and a corresponding power consumption value are obtained, and the plurality of data transmission bandwidths and the corresponding plurality of power consumption values are fitted, so that an energy consumption relation is obtained. In the prior art, only the power consumption value of the hard disk under no load and maximum load can be measured, so that the relation between the power consumption and the bandwidth cannot be known.
Drawings
FIG. 1 is a flow chart of a method for testing power consumption performance of a hard disk according to an embodiment of the present application;
FIG. 2 is a block diagram of a device for testing power consumption performance of a hard disk according to an embodiment of the present application;
FIG. 3 is a flow chart of a specific method of testing power consumption performance of a hard disk according to an embodiment of the present application;
fig. 4 is a block diagram of a device for testing power consumption performance of a hard disk according to an embodiment of the present application.
Wherein the above figures include the following reference numerals:
102. a processor; 104. a memory; 106. a transmission device; 108. and an input/output device.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal according to a method for testing the power consumption performance of a hard disk according to an embodiment of the present application. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a method for testing power consumption performance of a hard disk in an embodiment of the present application, and the processor 102 executes the computer program stored in the memory 104, thereby performing various functional applications and data processing, that is, implementing the method described above. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
For convenience of description, the terms used in the present application are explained as follows:
testing machine: the PC or server where the SSD resides.
Bandwidth, namely the data quantity transmitted in unit time when SSD and load carry out data transmission.
Power consumption: the amount of energy consumed per unit time, unit W, when SSD and load perform data transfer.
Power consumption measuring device: and the intermediate device is connected with the SSD and the testing machine, and the power consumption value is calculated by acquiring voltage and current, or is provided by an internal interface of the SSD.
In this embodiment, a method for testing the power consumption performance of a hard disk running on the mobile terminal is provided, and fig. 2 is a flowchart of a test of the power consumption performance of the hard disk according to an embodiment of the present application, as shown in fig. 2, where the flowchart includes the following steps:
step S202, obtaining hard disk information and bandwidth step length of a hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length, wherein the hard disk information at least comprises a hard disk code number;
specifically, taking an SSD (Solid State Disk) as an example, in order to test the power consumption value of the SSD under different load conditions, the different loads and the bandwidth of the SSD to be tested when data transmission is performed are different, firstly, a bandwidth step is obtained, hard Disk information of the SSD to be tested is obtained, the hard Disk information at least includes a hard Disk code number, the different hard disks have unique hard Disk code numbers in a lspci (a command for checking information of a Pice device), pice is a high-speed serial computer expansion bus standard used in the application, a load type, a test start-stop load bandwidth and a load bandwidth step or a specified intermediate load bandwidth are selected, the configuration information and the bandwidth step are generated into a configuration file, and an address of a testing machine (a PC or a server where the SSD is located) to be tested and corresponding hard Disk information can also be manually input into the configuration file.
Step S204, generating a test script according to the configuration file, and sequentially testing the power consumption when the hard disk to be tested is connected with a plurality of loads respectively according to the test script to obtain a power consumption value corresponding to each data transmission bandwidth, wherein in the test process, the data transmission bandwidths when the hard disk to be tested is connected with the loads are sequentially increased according to the bandwidth step;
specifically, a test script is automatically generated according to the configuration file, and power consumption when a plurality of loads are connected with the hard disk to be tested is tested according to the data transmission bandwidth, so that the power consumption test of the hard disk is automatically completed, and the problems of errors, missed detection, human resource waste and the like caused by manual testing are reduced. The data transmission bandwidth of each load and the hard disk to be tested in data transmission is sequentially increased according to the bandwidth step length, so that the purpose of testing the power consumption of a plurality of loads, namely under the condition of multiple data transmission bandwidths, is achieved, and the power consumption value corresponding to each data transmission bandwidth is obtained. For example: and if the bandwidth step size is 10Mbps, the data transmission bandwidth of each load and the hard disk to be tested when data transmission is carried out sequentially increases according to 10 Mbps.
Step S206, fitting the data transmission bandwidths and the corresponding power consumption values in the testing process to obtain an energy consumption relation, wherein the energy consumption relation represents the corresponding relation between the data transmission bandwidths and the power consumption values of the hard disk to be tested.
Specifically, the obtained multiple groups of data transmission bandwidths and the corresponding power consumption values are fitted, in a specific application process, a matplotlib command and a numpy command in a python code can be used for fitting, a fitting equation is obtained, and drawing and displaying are carried out. For example: taking the simplest linear relationship as an example: and the data transmission bandwidths are represented by X, the power consumption value corresponding to each data transmission bandwidth is represented by Y, the linear relation expression between the data transmission bandwidths and the power consumption value is Y=kX+b, and the values of k and b are obtained by fitting the X and Y through related instructions in the python code, so that the corresponding relation between the data transmission bandwidths and the power consumption value, namely the energy consumption relation of the hard disk to be tested, can be obtained. In the practical application process, the corresponding relation between the data transmission bandwidth and the power consumption value may be any other feasible relation expression, that is, the application does not specifically limit the expression representing the energy consumption relation.
Through the steps, firstly, information with a tested hard disk and bandwidth step length are obtained, power consumption when the hard disk to be tested is connected with a plurality of loads is tested, data transmission bandwidth when the hard disk to be tested is connected with each load is sequentially increased according to the bandwidth step length, each data transmission bandwidth and a corresponding power consumption value are obtained, and fitting is carried out on the plurality of data transmission bandwidths and the corresponding plurality of power consumption values, so that an energy consumption relation is obtained. In the prior art, only the power consumption value of the hard disk under no load and maximum load can be measured, so that the relation between the power consumption and the bandwidth cannot be known.
The main execution body of the above steps may be a server, a terminal, or the like, but is not limited thereto.
In some optional embodiments, before the step S204, the method further includes: identifying the hard disk information of the hard disk to be tested through a lspci command and an nvme list command; and determining whether the identified hard disk information is consistent with the hard disk information in the configuration file. The method first judges whether the hard disk information is correct before testing the hard disk, thus ensuring that the accurate energy consumption relation is obtained according to the correct hard disk information.
Specifically, the hard disk information of the hard disk to be tested is identified through the lspci command and the nvme list command, and compared with the hard disk information of the hard disk to be tested in the configuration file, whether the hard disk information is consistent is determined, because different hard disks have unique codes in the lspci information, whether the parameters such as mps (maximum number of net bytes capable of being transmitted by each message), mrrs (maximum number of bytes capable of being read by each read request), speed (transmission rate), width (data transmission bandwidth) and the like in the PCie (a high-Speed serial computer expansion bus standard) are consistent is detected through the lspci command, and if the parameters are consistent, whether the hard disk information and the test software can be normally operated is detected through running a pre-test for 30 seconds.
In order to accurately and conveniently perform the power consumption test on the hard disk to be tested, in some alternative embodiments, the step S204 may be implemented by: and sequentially testing the power consumption of the hard disk to be tested when the hard disk to be tested is respectively connected with a plurality of loads for data transmission according to the test script by using a fio tool.
Specifically, fio is a very flexible disk IO (input/output) testing tool, and IO (input/output) operation of a disk can be simulated through multithreading or processes.
In some alternative embodiments, the above method may be further implemented by: obtaining total time for testing power consumption when the hard disk to be tested is connected with a plurality of loads respectively for data transmission, and obtaining total test time, wherein the total test time is obtained by calculation through a time calculation script; and determining the current test progress according to the ratio of the current test time to the total test time in the test process, and displaying the current test progress. According to the method, the testing time is estimated firstly before the power consumption test is carried out, and the testing progress is obtained and displayed according to the current testing time in the testing process, so that a tester can know the testing progress, and the testing progress is managed conveniently.
Specifically, the method for testing the power consumption performance of the hard disk further comprises a time calculation script, the time calculation script can calculate and obtain the total test time required in the power consumption testing process according to the configuration file, the current testing progress can be obtained by calculating the ratio of the current testing time to the total test time in the testing process after the total test time is obtained, and the current testing progress is displayed, so that a tester can know the testing progress in time, and the tester can conveniently process the current testing progress in time under the condition that the current testing progress is abnormal.
In order to conveniently obtain the power consumption value corresponding to each data transmission bandwidth, in some optional embodiments, the method further includes the following steps before the step S202: and connecting the hard disk to be tested with a power consumption measuring device so that the power consumption measuring device obtains the power consumption value output by the test script.
Specifically, the power consumption measuring device is an intermediate device connected with the hard disk to be tested and the testing machine, and calculates the power consumption value by acquiring voltage and current, or acquires the power consumption value provided by the internal interface of the SSD, so that in order to conveniently and accurately acquire the power consumption value corresponding to each data transmission bandwidth, one end of the power consumption measuring device is connected with the hard disk to be tested, the other end of the power consumption measuring device is connected with the testing machine, and after the power consumption value of the hard disk to be tested is acquired, the power consumption value is transmitted to the testing machine.
In some alternative embodiments, obtaining the power consumption value corresponding to each data transmission bandwidth includes: and acquiring the power consumption value in the power consumption measuring device by using a power consumption acquisition script. The method obtains the power consumption value through the script, so that the power consumption value can be accurately obtained.
Specifically, the test script, the power consumption acquisition script and the time calculation script are stored in the test machine, and therefore, the power consumption acquisition device acquires the power consumption value transmitted by the power consumption measurement device through the power consumption acquisition script after transmitting the power consumption value to the test machine.
In order to save the measured power consumption values for a subsequent fitting to obtain a relation between the power consumption values and the data transmission bandwidth, in some alternative embodiments the method further comprises the steps of: and outputting each power consumption value and each data transmission bandwidth corresponding to each power consumption value to a log file.
Specifically, the log file is used for recording operation events of the system, so that each power consumption value obtained in the test process and the corresponding data transmission bandwidth are output to the log file for storage, the log file is conveniently called subsequently, and fitting is carried out on the data transmission bandwidth and the power consumption value, so that the energy consumption relation is obtained.
In some optional embodiments, after obtaining the energy consumption relation equation of the hard disk to be tested, the method further includes: and storing the hard disk information, each power consumption value, each data transmission bandwidth corresponding to each power consumption value and the energy consumption relation of the hard disk to be tested to a target physical address. The method stores the result obtained by the test and the energy consumption relation result obtained by fitting to the target address, so that the result can be stored for subsequent use.
Specifically, after the test is completed, the hard disk information, the environment information (related configuration information in the test process) and the test result of the hard disk to be tested are collected, packaged together and placed at a designated position of the tester, and generally defaults to be/home/result. Therefore, when the power consumption performance of the hard disk is optimized later, related information can be called, and detailed information of the energy consumption of the hard disk can be known.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present application.
The embodiment of the application also provides a specific method for testing the power consumption performance of the hard disk, as shown in fig. 3, comprising the following steps:
step S1: firstly, obtaining hard disk information and bandwidth step length of a hard disk to be tested, generating a configuration file according to the hard disk information and the bandwidth step length, and performing time calculation on a test process to obtain total test time;
step S2: identifying the hard disk information of the hard disk to be tested through the lspci command and the nvme list command, and comparing the hard disk information with the hard disk information obtained by analyzing the configuration file (file analysis) to determine whether the hard disk information is consistent;
step S3: setting parameters in a test script, checking whether mps, mrrs, speed, width parameters in the PCie are consistent, if the parameters are consistent and checked to be correct, and detecting whether the hard disk to be tested and the test software can normally run by running a pre-test for 30 seconds;
step S4: script generation: generating a test script according to the configuration file;
step S5: test execution and power consumption measurement: executing a test script, completing power consumption test when data transmission is carried out on the hard disk to be tested and a plurality of loads, and acquiring a power consumption value transmitted to a testing machine by a power consumption measuring device by the power consumption measuring script;
step S6: analysis of results: fitting the measured power consumption value and the corresponding data transmission bandwidth to obtain an energy consumption relation, storing the configuration information, the power consumption value, the data transmission bandwidth corresponding to the power consumption value and an equation representing the energy consumption relation to a target address, and ending.
In this embodiment, a device for testing power consumption performance of a hard disk is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, which have been described and will not be repeated. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 4 is a block diagram of a device for testing power consumption performance of a hard disk according to an embodiment of the present application, as shown in fig. 4, the device includes:
the generating module 22 is configured to obtain hard disk information and a bandwidth step length of a hard disk to be tested, and generate a configuration file according to the hard disk information and the bandwidth step length, where the hard disk information at least includes a hard disk code number;
specifically, taking an SSD (Solid State Disk) as an example, in order to test the power consumption value of the SSD under different load conditions, the different loads and the bandwidth of the SSD to be tested when data transmission is performed are different, firstly, a bandwidth step is obtained, hard Disk information of the SSD to be tested is obtained, the hard Disk information at least includes a hard Disk code number, the different hard disks have unique hard Disk code numbers in a lspci (a command for checking information of a Pice device), pice is a high-speed serial computer expansion bus standard used in the application, a load type, a test start-stop load bandwidth and a load bandwidth step or a specified intermediate load bandwidth are selected, the configuration information and the bandwidth step are generated into a configuration file, and an address of a testing machine (a PC or a server where the SSD is located) to be tested and corresponding hard Disk information can also be manually input into the configuration file.
The test module 24 is configured to generate a test script according to the configuration file, test power consumption of the to-be-tested hard disk when the to-be-tested hard disk is connected with a plurality of loads respectively in sequence according to the test script, obtain a power consumption value corresponding to each data transmission bandwidth, and sequentially increment the data transmission bandwidth when the to-be-tested hard disk is connected with the plurality of loads for data transmission according to the bandwidth step length in the test process;
specifically, a test script is automatically generated according to a configuration file, power consumption when a plurality of loads are connected with a hard disk to be tested is tested according to data transmission bandwidths, the data transmission bandwidths of the loads and the hard disk to be tested when data transmission is performed are sequentially increased according to bandwidth step sizes, the purpose of testing the power consumption of the plurality of loads, namely under the condition of multiple data transmission bandwidths, is achieved, and a power consumption value corresponding to each data transmission bandwidth is obtained. For example: and if the bandwidth step size is 10Mbps, the data transmission bandwidth of each load and the hard disk to be tested when data transmission is carried out sequentially increases according to 10 Mbps.
And the fitting module 26 is configured to fit the plurality of data transmission bandwidths and the corresponding plurality of power consumption values in the testing process to obtain an energy consumption relationship, where the energy consumption relationship represents a corresponding relationship between the data transmission bandwidths and the power consumption values of the hard disk to be tested.
Specifically, the obtained multiple groups of data transmission bandwidths and the corresponding power consumption values are fitted, in a specific application process, a matplotlib command and a numpy command in a python code can be used for fitting, a fitting equation is obtained, and drawing and displaying are carried out. For example: taking the simplest linear relationship as an example: and the data transmission bandwidths are represented by X, the power consumption value corresponding to each data transmission bandwidth is represented by Y, the linear relation expression between the data transmission bandwidths and the power consumption value is Y=kX+b, and the values of k and b are obtained by fitting the X and Y through related instructions in the python code, so that the corresponding relation between the data transmission bandwidths and the power consumption value, namely the energy consumption relation of the hard disk to be tested, can be obtained. In the practical application process, the corresponding relation between the data transmission bandwidth and the power consumption value may be any other feasible relation expression, that is, the application does not specifically limit the expression representing the energy consumption relation.
By the device, information with the tested hard disk and bandwidth step length are acquired, power consumption when the hard disk to be tested is connected with a plurality of loads is tested, data transmission bandwidth when the hard disk to be tested is connected with each load is sequentially increased according to the bandwidth step length, each data transmission bandwidth and a corresponding power consumption value are obtained, and the plurality of data transmission bandwidths and the corresponding plurality of power consumption values are fitted, so that an energy consumption relation is obtained. In the prior art, only the power consumption value of the hard disk under no load and maximum load can be measured, so that the relation between the power consumption and the bandwidth cannot be known.
The main execution body of the above steps may be a server, a terminal, or the like, but is not limited thereto.
In some optional embodiments, the apparatus further includes an identification module and a determination module, where the identification module is configured to identify the hard disk information of the hard disk to be tested through a lspci command and an nvme list command; the determining module is used for determining whether the identified hard disk information is consistent with the hard disk information in the configuration file. The device firstly judges whether the hard disk information is correct before testing the hard disk, so that accurate energy consumption relation can be ensured according to the correct hard disk information.
Specifically, the hard disk information of the hard disk to be tested is identified through the lspci command and the nvme list command, and compared with the hard disk information of the hard disk to be tested in the configuration file, whether the hard disk information is consistent is determined, because different hard disks have unique codes in the lspci information, whether the parameters such as mps (maximum number of net bytes capable of being transmitted by each message), mrrs (maximum number of bytes capable of being read by each read request), speed (transmission rate), width (data transmission bandwidth) and the like in the PCie (a high-Speed serial computer expansion bus standard) are consistent is detected through the lspci command, and if the parameters are consistent, whether the hard disk information and the test software can be normally operated is detected through running a pre-test for 30 seconds.
In order to accurately and conveniently perform power consumption testing on the hard disk to be tested, in some optional embodiments, the testing module includes a testing sub-module, configured to sequentially test power consumption when the hard disk to be tested is connected to a plurality of loads respectively by using a fio tool according to the testing script.
Specifically, fio is a very flexible disk IO (input/output) testing tool, and IO (input/output) operation of a disk can be simulated through multithreading or processes.
In some optional embodiments, the apparatus further includes a first obtaining submodule and a display module, where the first obtaining submodule is configured to obtain a total time for testing power consumption when the hard disk to be tested is connected with the plurality of loads respectively for data transmission, so as to obtain a total test time, where the total test time is obtained by calculating through a time calculation script; the display sub-module is used for determining the current test progress according to the ratio of the current test time to the total test time in the test process and displaying the current test progress. Through the device, the testing time is estimated firstly before the power consumption test is carried out, and the testing progress is obtained and displayed according to the current testing time in the testing process, so that a tester can know the testing progress, and the testing progress is managed conveniently.
Specifically, the testing device for the power consumption performance of the hard disk further comprises a time calculation script, the time calculation script can calculate and obtain the total testing time required in the power consumption testing process according to the configuration file, after the total testing time is obtained, the current testing progress can be obtained by calculating the ratio of the current testing time to the total testing time in the testing process, and the current testing progress is displayed, so that a tester can know the testing progress in time, and the tester can conveniently process the current testing progress in time under the condition that the current testing progress is abnormal.
In order to conveniently obtain the power consumption value corresponding to each data transmission bandwidth, in some optional embodiments, the generating module includes a connection sub-module, configured to connect the hard disk to be tested with a power consumption measurement device, so that the power consumption measurement device obtains the power consumption value output by the test script.
Specifically, the power consumption measuring device is an intermediate device connected with the hard disk to be tested and the testing machine, and calculates the power consumption value by acquiring voltage and current, or acquires the power consumption value provided by the internal interface of the SSD, so that in order to conveniently and accurately acquire the power consumption value corresponding to each data transmission bandwidth, one end of the power consumption measuring device is connected with the hard disk to be tested, the other end of the power consumption measuring device is connected with the testing machine, and after the power consumption value of the hard disk to be tested is acquired, the power consumption value is transmitted to the testing machine.
In some alternative embodiments, the test module includes an acquisition sub-module that acquires the power consumption value in the power consumption measurement device using a power consumption acquisition script. The device obtains the power consumption value through the script, so that the power consumption value can be accurately obtained.
Specifically, the test script, the power consumption acquisition script and the time calculation script are stored in the test machine, and therefore, the power consumption acquisition device acquires the power consumption value transmitted by the power consumption measurement device through the power consumption acquisition script after transmitting the power consumption value to the test machine.
In order to save the measured power consumption values, so as to facilitate the subsequent fitting to obtain the relation between the power consumption values and the data transmission bandwidths, in some optional embodiments, the apparatus further includes an output module configured to output each of the power consumption values and each of the data transmission bandwidths corresponding to each of the power consumption values to a log file.
Specifically, the log file is used for recording operation events of the system, so that each power consumption value obtained in the test process and the corresponding data transmission bandwidth are output to the log file for storage, the log file is conveniently called subsequently, and fitting is carried out on the data transmission bandwidth and the power consumption value, so that the energy consumption relation is obtained.
In some optional embodiments, the apparatus further includes a storage module, configured to store the hard disk information, each of the power consumption values, each of the data transmission bandwidths corresponding to each of the power consumption values, and the energy consumption relationship of the hard disk to be tested to a target physical address. The device stores the result obtained by the test and the energy consumption relation result obtained by fitting to the target address, so that the result can be stored for subsequent use.
Specifically, after the test is completed, the hard disk information, the environment information (related configuration information in the test process) and the test result of the hard disk to be tested are collected, packaged together and placed at a designated position of the tester, and generally defaults to be/home/result. Therefore, when the power consumption performance of the hard disk is optimized later, related information can be called, and detailed information of the energy consumption of the hard disk can be known.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the embodiments of the present application.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic device may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (11)

1. The method for testing the power consumption performance of the hard disk is characterized by comprising the following steps of:
obtaining hard disk information and bandwidth step length of a hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length, wherein the hard disk information at least comprises a hard disk code number;
generating a test script according to the configuration file, and sequentially testing the power consumption of the hard disk to be tested when the hard disk to be tested is respectively connected with a plurality of loads for data transmission according to the test script to obtain a power consumption value corresponding to each data transmission bandwidth, wherein in the test process, the data transmission bandwidths of the hard disk to be tested when the hard disk to be tested is connected with the plurality of loads for data transmission are sequentially increased according to the bandwidth step length;
fitting a plurality of data transmission bandwidths and a plurality of corresponding power consumption values in the testing process to obtain an energy consumption relation, wherein the energy consumption relation represents the corresponding relation between the data transmission bandwidths and the power consumption values of the hard disk to be tested.
2. The method according to claim 1, further comprising, before testing power consumption when the hard disk to be tested is connected to a plurality of loads respectively in sequence according to the test script:
identifying the hard disk information of the hard disk to be tested through a lspci command and an nvme list command;
and determining whether the hard disk information obtained through recognition is consistent with the hard disk information in the configuration file.
3. The method according to claim 1, wherein sequentially testing the power consumption of the hard disk to be tested when data is transmitted to the plurality of load connections according to the test script, comprises:
and sequentially testing the power consumption of the hard disk to be tested when the hard disk to be tested is respectively connected with a plurality of loads for data transmission according to the test script by using a fio tool.
4. The method according to claim 1, wherein the method further comprises:
obtaining total time for testing power consumption when the hard disk to be tested is connected with a plurality of loads respectively for data transmission, and obtaining total test time, wherein the total test time is obtained by calculation of a time calculation script;
and determining the current test progress according to the ratio of the current test time to the total test time in the test process, and displaying the current test progress.
5. The method of claim 1, further comprising, prior to obtaining the hard disk information and the bandwidth step size of the hard disk to be tested:
and connecting the hard disk to be tested with a power consumption measuring device so that the power consumption measuring device obtains the power consumption value output by the test script.
6. The method of claim 5, wherein obtaining a power consumption value for each data transmission bandwidth comprises:
and acquiring the power consumption value in the power consumption measuring device by using a power consumption acquisition script.
7. The method according to claim 1, wherein the method further comprises:
and outputting each power consumption value and each data transmission bandwidth corresponding to each power consumption value to a log file.
8. The method of claim 1, further comprising, after obtaining the energy consumption relation equation of the hard disk to be tested:
and storing the hard disk information, each power consumption value, each data transmission bandwidth corresponding to each power consumption value and the energy consumption relation of the hard disk to be tested to a target physical address.
9. The device for testing the power consumption performance of the hard disk is characterized by comprising the following components:
the generating module is used for acquiring the hard disk information and the bandwidth step length of the hard disk to be tested, and generating a configuration file according to the hard disk information and the bandwidth step length, wherein the hard disk information at least comprises a hard disk code number;
the testing module is used for generating a testing script according to the configuration file, testing the power consumption when the hard disk to be tested is connected with a plurality of loads respectively in sequence according to the testing script to obtain a power consumption value corresponding to each data transmission bandwidth, and the data transmission bandwidths when the hard disk to be tested is connected with the loads for data transmission are sequentially increased according to the bandwidth step length in the testing process;
the fitting module is used for fitting the plurality of data transmission bandwidths and the corresponding plurality of power consumption values in the testing process to obtain an energy consumption relation, wherein the energy consumption relation represents the corresponding relation between the data transmission bandwidths of the hard disk to be tested and the power consumption values.
10. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the method according to any of the claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any one of claims 1 to 8 when the computer program is executed.
CN202310443102.XA 2023-04-23 2023-04-23 Method and device for testing power consumption performance of hard disk and electronic equipment Pending CN116431412A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310443102.XA CN116431412A (en) 2023-04-23 2023-04-23 Method and device for testing power consumption performance of hard disk and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310443102.XA CN116431412A (en) 2023-04-23 2023-04-23 Method and device for testing power consumption performance of hard disk and electronic equipment

Publications (1)

Publication Number Publication Date
CN116431412A true CN116431412A (en) 2023-07-14

Family

ID=87094273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310443102.XA Pending CN116431412A (en) 2023-04-23 2023-04-23 Method and device for testing power consumption performance of hard disk and electronic equipment

Country Status (1)

Country Link
CN (1) CN116431412A (en)

Similar Documents

Publication Publication Date Title
CN106874187B (en) Code coverage rate collection method and device
CN104579816A (en) Vehicle network health assessment
CN109218136B (en) WIFI connection performance test method and device, computer equipment and storage medium
CN114326677A (en) Vehicle machine testing method and device
CN113225760B (en) Network testing method and equipment
WO2022007711A1 (en) Method for detecting storage battery of vehicle and battery detection device
CN112729884B (en) Equipment fault diagnosis method and device based on big data
CN112422369B (en) Method and device for determining offline time, storage medium and electronic device
CN111157906B (en) SOC precision testing method, device and system
CN111537793B (en) Power consumption testing method and system of mobile terminal
CN111179670B (en) Method and device for quantifying physical and electrical experiment result, terminal and storage medium
CN116431412A (en) Method and device for testing power consumption performance of hard disk and electronic equipment
CN110598797B (en) Fault detection method and device, storage medium and electronic device
CN116994641A (en) Semiconductor aging test method and system thereof
CN111258828A (en) I2C bus test method, test device and computer readable storage medium
CN114244423B (en) Method for processing measurement and control data and multi-star measurement and control system
CN116185873A (en) Storage component testing method and system, storage medium and electronic equipment
CN113447880A (en) Fault diagnosis method and device for electric energy meter and terminal equipment
CN110208727B (en) Processing method, processing device and system for precision verification test of fault indicator
US20110282607A1 (en) Electrical continuity analyzer
CN110896547B (en) Positioning method and device for NB-IOT network problem
CN115934450B (en) Method and device for detecting data transmission quality, storage medium and electronic device
CN117630696A (en) Battery testing method, battery testing device, electronic equipment and computer readable storage medium
CN117648561A (en) Method, device, nonvolatile storage medium and computer equipment for checking data
CN117607706A (en) Battery detection method and system for wide and narrow band ad hoc network equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination