[Work][Python]Spec power automation-1

Fatboy Slim
2 min readApr 17, 2020

Environment: Windows server 2019, python 2.7

SPECpower_ssj2008 is the first industry-standard benchmark that evaluates the power and performance characteristics of volume server class computers. It is available from the Standard Performance Evaluation Corporation (SPEC). SPECpower_ssj2008 is SPEC’s first attempt at defining server power measurement standards. The result is as below, we can see the idle, 50%, 70%, and 100% percentage load and their power relationship.

There are three steps which I want to develop for automation.

  1. Produce related setting file SPECpower_ssj_EXPERT, SPECpower_ssj_config_sut1, runssj.batch automatically.
  2. Run spec power, related stress, record related power consumption and ambient temperature.
  3. Plot chart and output report value automatically.

In the section one, the target is create SPECpower_ssj_EXPERT file automatically.

There are three variable which need to be revise.

input.load_level.number_warehouses=104
input.load_level.count=4
input.load_level.percentage_sequence=100 70 50 30

warehouses is CPU logical processors. Assume we have a SPECpower_ssj_EXPERT.props and our solution is replace line 46,134 and 214.

Solution:

  1. Create a txt file for user enter Test_level, Test_percentage
Test_level, Test_percentage, Nic_FW, Nic_Speed
10
100 70 50 34 45
14.10.1020
100

2. EXPERT.py

import os
Cpu=os.popen('wmic cpu get name, NumberOfCores, NumberOfLogicalProcessors, L2Cachesize, L3Cachesize, CurrentClockSpeed/Format:List').readlines()
Cpu_logical=Cpu[7][26:].strip()
Cpu_n =len(Cpu)/9
warehouse=Cpu_n*int(Cpu_logical)
input_i=open(r'C:\specpower_D\TestInput.txt').readlines()
Test_level, Test_percent= input_i[1].strip(), input_i[2].strip()
#=========================================================================update EXPERT document
docu_1=open(r'C:\specpower_D\SPECpower_ssj_EXPERT.props')
Expert=docu_1.readlines()
Expert[46]="input.load_level.number_warehouses="+str(warehouse)+'\n'
Expert[134]="input.load_level.count="+str(Test_level)+'\n'
Expert[214]="input.load_level.percentage_sequence="+str(Test_percent)+'\n'
docu_1=open(r'C:\specpower_D\SPECpower_ssj_EXPERT.props','w+')
docu_1.writelines(Expert)
docu_1.close()

Reference:

http://www.spec.org/power_ssj2008/

--

--