Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 317490 Details for
Bug 463354
FEAT: cpuscaling test should be run separately for each cpu
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
cpuscaling.py patch
cpuscaling.patch (text/plain), 15.54 KB, created by
Greg Nichols
on 2008-09-23 16:49:05 UTC
(
hide
)
Description:
cpuscaling.py patch
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2008-09-23 16:49:05 UTC
Size:
15.54 KB
patch
obsolete
>Index: cpuscaling.py >=================================================================== >RCS file: /cvs/qa/hts/tests/cpuscaling/cpuscaling.py,v >retrieving revision 1.6 >diff -p -r1.6 cpuscaling.py >*** cpuscaling.py 20 Jun 2008 16:51:06 -0000 1.6 >--- cpuscaling.py 23 Sep 2008 16:43:57 -0000 >*************** import decimal >*** 26,31 **** >--- 26,32 ---- > from hts.tags import Constants > from hts.test import Test > from hts.device import Device >+ from hts.command import Command, HTSCommandException > > > class CPUScalingTest(Test): >*************** class CPUScalingTest(Test): >*** 34,65 **** > Test.__init__(self, name="cpuscaling") > self.interactive = False > self.speedUpTolerance = 10.0 # percent > > > def plan(self, devices): > tests = list() > for device in devices: > if 'processor' in device.getProperty("info.category"): > if device.getProperty("processor.can_throttle"): > test = self.makeCopy() > test.setDevice(device) >! tests.append(test) >! break > return tests > > def getCPUFreqDirectories(self): >- sysCPUDirectory = "/sys/devices/system/cpu" > >! if not os.path.exists(sysCPUDirectory): >! print "Error: no file %s" % sysCPUDirectory > return None > # look for cpu subdirectories > pattern = re.compile("cpu(?P<cpuNumber>[0-9]+)") > self.cpufreqDirectories = list() >! for subdirectory in os.listdir(sysCPUDirectory): > match = pattern.search(subdirectory) > if match and match.group("cpuNumber"): >! cpufreqDirectory = "%s/%s/cpufreq" % (sysCPUDirectory, subdirectory) > if not os.path.exists(cpufreqDirectory): > print "Error: cpu %s has no cpufreq directory %s" % (match.group("cpuNumber"), cpufreqDirectory) > return None >--- 35,74 ---- > Test.__init__(self, name="cpuscaling") > self.interactive = False > self.speedUpTolerance = 10.0 # percent >+ self.retryLimit = 5 >+ self.retryTolerance = 5.0 # percent >+ self.sysCPUDirectory = "/sys/devices/system/cpu" >+ self.cpufreqDirectory = "%s/cpu%s/cpufreq" % (self.sysCPUDirectory, self.getLogicalDeviceName()) >+ > > > def plan(self, devices): > tests = list() > for device in devices: >+ # plan a separate test for each cpu > if 'processor' in device.getProperty("info.category"): > if device.getProperty("processor.can_throttle"): > test = self.makeCopy() > test.setDevice(device) >! cpuNumber = device.getProperty("processor.number") >! if not cpuNumber: >! cpuNumber = "0" >! test.setLogicalDeviceName("%s" % cpuNumber) >! tests.append(test) > return tests > > def getCPUFreqDirectories(self): > >! if not os.path.exists(self.sysCPUDirectory): >! print "Error: no file %s" % self.sysCPUDirectory > return None > # look for cpu subdirectories > pattern = re.compile("cpu(?P<cpuNumber>[0-9]+)") > self.cpufreqDirectories = list() >! for subdirectory in os.listdir(self.sysCPUDirectory): > match = pattern.search(subdirectory) > if match and match.group("cpuNumber"): >! cpufreqDirectory = "%s/%s/cpufreq" % (self.sysCPUDirectory, subdirectory) > if not os.path.exists(cpufreqDirectory): > print "Error: cpu %s has no cpufreq directory %s" % (match.group("cpuNumber"), cpufreqDirectory) > return None >*************** class CPUScalingTest(Test): >*** 99,121 **** > > def setParameter(self, switch, setFile, readFile, value): > # try the command for all cpus >! command = "cpufreq-selector" >! if not os.system("%s -%s %s" % (command, switch, value)) is 0: >! print "Note: command failed: %s -%s %s" % (command, switch, value) >! >! returnValue = True >! for cpufreqDirectory in self.cpufreqDirectories: >! # try echo of the value to the file for each cpu >! if not os.system("echo \"%s\" > %s/%s" % (value, cpufreqDirectory, setFile)) is 0: >! print "Note: command failed: echo \"%s\" > %s/%s" % (value, cpufreqDirectory, setFile) >! >! # verify it has changed >! parameterFile = open("%s/%s" % (cpufreqDirectory, readFile)) >! line = parameterFile.readline() >! if not line or line.strip() != value: >! print "Error: could not verify that %s/%s was set to %s" % (cpufreqDirectory, readFile, value) >! returnValue = False >! return returnValue > > def setFrequency(self, frequency): > return self.setParameter("f", "scaling_setspeed", "scaling_cur_freq", frequency) >--- 108,143 ---- > > def setParameter(self, switch, setFile, readFile, value): > # try the command for all cpus >! result = True >! try: >! command = Command("cpufreq-selector -c %s -%s %s" % (self.getLogicalDeviceName(), switch, value)) >! command.echo() >! except HTSCommandException, exception: >! print "Note: command failed: %s" % exception.command >! result = False >! >! if not result: >! print "Trying alternate method." >! try: >! command = Command("echo \"%s\" > %s/%s" % (value, self.cpufreqDirectory, setFile)) >! command.echo() >! except HTSCommandException, exception: >! print "Error: command failed:" >! print exception >! return False >! >! # verify it has changed >! parameterFile = open("%s/%s" % (self.cpufreqDirectory, readFile)) >! line = parameterFile.readline() >! if not line or line.strip() != value: >! print "Error: could not verify that %s/%s was set to %s" % (self.cpufreqDirectory, readFile, value) >! if line: >! print "Actual Value: %s" % line >! else: >! print "parameter file was empty" >! return False >! >! return True > > def setFrequency(self, frequency): > return self.setParameter("f", "scaling_setspeed", "scaling_cur_freq", frequency) >*************** class CPUScalingTest(Test): >*** 126,143 **** > > def getParameter(self, parameter): > value = None >! for cpufreqDirectory in self.cpufreqDirectories: >! parameterFile = open("%s/%s" % (cpufreqDirectory, parameter)) >! line = parameterFile.readline() >! if not line: >! print "Error: failed to get %s for %s" % (parameter, cpufreqDirectory) >! return None >! if not value: >! value = line.strip() >! elif line.strip() != value: >! print "Error: Value of %s for %s is %s, different than other cpus." % (parameter, cpufreqDirectory, value) >! return None > return value > def getParameterList(self, parameter): > values = list() > for cpufreqDirectory in self.cpufreqDirectories: >--- 148,161 ---- > > def getParameter(self, parameter): > value = None >! parameterFile = open("%s/%s" % (self.cpufreqDirectory, parameter)) >! line = parameterFile.readline() >! if not line: >! print "Error: failed to get %s for %s" % (parameter, cpufreqDirectory) >! return None >! value = line.strip() > return value >+ > def getParameterList(self, parameter): > values = list() > for cpufreqDirectory in self.cpufreqDirectories: >*************** class CPUScalingTest(Test): >*** 152,160 **** > > def runLoadTest(self): > print "Running CPU load test..." > runTime = None > tries = 0 >! while tries < 5: > sys.stdout.flush() > (start_utime, start_stime, start_cutime, start_cstime, start_elapsed_time) = os.times() > # os.system("echo \"scale=2^12; 4*a(1)\" | bc -l > /dev/null") >--- 170,185 ---- > > def runLoadTest(self): > print "Running CPU load test..." >+ try: >+ Command("taskset -pc %s %s" % (self.getLogicalDeviceName(), os.getpid())).echo() >+ except HTSCommandException, exception: >+ print "Error: could not set task affinity" >+ print exception >+ return None >+ > runTime = None > tries = 0 >! while tries < self.retryLimit: > sys.stdout.flush() > (start_utime, start_stime, start_cutime, start_cstime, start_elapsed_time) = os.times() > # os.system("echo \"scale=2^12; 4*a(1)\" | bc -l > /dev/null") >*************** class CPUScalingTest(Test): >*** 165,178 **** > else: > thisTime = stop_elapsed_time - start_elapsed_time > print "comparing %.2f" % (abs(thisTime-runTime)/runTime) >! if (abs(thisTime-runTime)/runTime) < 0.05: > return runTime > else: > runTime = thisTime > tries += 1 > print "try %u - %.2f sec" % (tries, runTime) > >! print "Error: could not repeat load test times within 5%" > return None > > def pi(self): >--- 190,203 ---- > else: > thisTime = stop_elapsed_time - start_elapsed_time > print "comparing %.2f" % (abs(thisTime-runTime)/runTime) >! if (abs(thisTime-runTime)/runTime)*100 < self.retryTolerance: > return runTime > else: > runTime = thisTime > tries += 1 > print "try %u - %.2f sec" % (tries, runTime) > >! print "Error: could not repeat load test times within %.1f%%" % self.retryTolerance > return None > > def pi(self): >*************** class CPUScalingTest(Test): >*** 187,192 **** >--- 212,218 ---- > h = (1-s2/4).sqrt() > n = 2*n > # print i,":",A >+ return True > > def verifyMinimumFrequency(self): > waitTime = 5 >*************** class CPUScalingTest(Test): >*** 206,211 **** >--- 232,238 ---- > print "" > print "System Capabilites:" > print "-------------------------------------------------" >+ print "Testing cpu %s" % self.getLogicalDeviceName() > > # 1. Determine if the cpu's support scaling using presense or lack there of ~/cpufreq in sysfs > >*************** class CPUScalingTest(Test): >*** 284,290 **** > success = False > > # 9. Run and time non-cacheable work(?) test for each CPU >! # 10. Repeat and time until execution times are within 5% of each other run to verify the base line execution time, bail if 5% margin cannot be acheived in 5 runs. > self.minimumFrequencyTestTime = self.runLoadTest() > if not self.minimumFrequencyTestTime: > success = False >--- 311,318 ---- > success = False > > # 9. Run and time non-cacheable work(?) test for each CPU >! # 10. Repeat and time until execution times are within self.retryTolerance of each other >! # run to verify the base line execution time, bail if self.retryTolerance margin cannot be acheived in self.retryLimit runs. > self.minimumFrequencyTestTime = self.runLoadTest() > if not self.minimumFrequencyTestTime: > success = False >*************** class CPUScalingTest(Test): >*** 308,314 **** > success = False > print "Maximum frequency load test time: %.2f" % self.maximumFrequencyTestTime > >! # 13. Verify MHz increase is comparable to time % decrease( eg. slow MHz/fast MHz ~= fast time/slow time; again with a 5% margin) > predictedSpeedup = string.atof(maximumFrequency)/string.atof(minimumFrequency) > measuredSpeedup = self.minimumFrequencyTestTime/self.maximumFrequencyTestTime > print "" >--- 336,343 ---- > success = False > print "Maximum frequency load test time: %.2f" % self.maximumFrequencyTestTime > >! # 13. Verify MHz increase is comparable to time % decrease( eg. slow MHz/fast MHz ~= fast time/slow time; >! # again with self.speedUpTolerance margin) > predictedSpeedup = string.atof(maximumFrequency)/string.atof(minimumFrequency) > measuredSpeedup = self.minimumFrequencyTestTime/self.maximumFrequencyTestTime > print "" >*************** class CPUScalingTest(Test): >*** 350,356 **** > success = False > print "On Demand load test time: %.2f" % self.onDemandTestTime > >! # 18. Compare the timing to the max results from earlier, again time should be within 5% > self.differenceOnDemandVsMaximum = ((self.onDemandTestTime-self.maximumFrequencyTestTime)/self.maximumFrequencyTestTime)*100 > print "Percentage Difference vs. maximum frequency: %.1f%%" % self.differenceOnDemandVsMaximum > if self.differenceOnDemandVsMaximum > self.speedUpTolerance: >--- 379,385 ---- > success = False > print "On Demand load test time: %.2f" % self.onDemandTestTime > >! # 18. Compare the timing to the max results from earlier, again time should be within self.speedUpTolerance > self.differenceOnDemandVsMaximum = ((self.onDemandTestTime-self.maximumFrequencyTestTime)/self.maximumFrequencyTestTime)*100 > print "Percentage Difference vs. maximum frequency: %.1f%%" % self.differenceOnDemandVsMaximum > if self.differenceOnDemandVsMaximum > self.speedUpTolerance: >*************** class CPUScalingTest(Test): >*** 391,399 **** > self.performanceTestTime = self.runLoadTest() > if not self.performanceTestTime: > success = False >! print "Performace load test time: %.2f" % self.performanceTestTime > >! # 23. Compare the timing to the max results for a <5% delta > self.differencePerformanceVsMaximum = ((self.performanceTestTime-self.maximumFrequencyTestTime)/self.maximumFrequencyTestTime)*100 > print "Percentage Difference vs. maximum frequency: %.1f%%" % self.differencePerformanceVsMaximum > if self.differencePerformanceVsMaximum > self.speedUpTolerance: >--- 420,428 ---- > self.performanceTestTime = self.runLoadTest() > if not self.performanceTestTime: > success = False >! print "Performance load test time: %.2f" % self.performanceTestTime > >! # 23. Compare the timing to the max results for a self.speedUpTolerance delta > self.differencePerformanceVsMaximum = ((self.performanceTestTime-self.maximumFrequencyTestTime)/self.maximumFrequencyTestTime)*100 > print "Percentage Difference vs. maximum frequency: %.1f%%" % self.differencePerformanceVsMaximum > if self.differencePerformanceVsMaximum > self.speedUpTolerance:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 463354
:
317490
|
318602