Author: gnichols Date: 2011-08-31 20:43:01 +0000 (Wed, 31 Aug 2011) New Revision: 1061
Modified: trunk/tests/cpuscaling/cpuscaling.py Log: 732113 - cpuscaling rewrite
Modified: trunk/tests/cpuscaling/cpuscaling.py =================================================================== --- trunk/tests/cpuscaling/cpuscaling.py 2011-08-31 20:42:19 UTC (rev 1060) +++ trunk/tests/cpuscaling/cpuscaling.py 2011-08-31 20:43:01 UTC (rev 1061) @@ -128,15 +128,25 @@ # freq1 and freq2 is strings, in KHz return abs(int(freq1)-int(freq2)) < self.frequencyTolerance*1000 # MHz->KHz
- def checkSpeedup(self, speedup): - success = True + def checkSpeedup(self, speedup, warn=False): + message = None + tag = "Error:" + if warn: + tag = "Warning:" + if speedup < self.minimumRequiredSpeedup(): - self.logWorkloadError("Error: measured speedup %.2f less that the required minimum speedup of %.2f. " % (speedup, self.minimumRequiredSpeedup())) - success = False + message = "%s measured speedup %.2f less than the minimum speedup of %.2f. " % (tag, speedup, self.minimumRequiredSpeedup()) if speedup > self.maximumRequiredSpeedup(): - self.logWorkloadError("Error: measured speedup %.2f greater than the maximum speedup of %.2f" % (speedup, self.maximumRequiredSpeedup())) - success = False - return success + message = "%s measured speedup %.2f greater than the maximum speedup of %.2f" % (tag, speedup, self.maximumRequiredSpeedup()) + + if message: + if warn: + print message + else: + self.logWorkloadError(message) + return False + + return True
def minimumRequiredSpeedup(self): return self.predictedSpeedup - ((self.predictedSpeedup - 1.00)*self.speedUpTolerance/100.0) @@ -636,14 +646,14 @@ print "" print "CPU Frequency Speed Up: %.2f" % self.predictedSpeedup print "CPU %s Measured Speed Up: %.2f" % (cpu, measuredSpeedup) - if not self.checkSpeedup(measuredSpeedup): - success = False + self.checkSpeedup(measuredSpeedup, warn=True) else: print "Note: %s governor not supported" % governor
return success
- def runOnDemandTests(self): + def runPackageOnDemandTests(self): + """ NOTE: whole-package ondemand testing is currently unused by the test """ print "" print "On Demand Governor Test:" print "-------------------------------------------------" @@ -675,7 +685,7 @@ for cpu in self.packageToCpus[self.currentPackage]: if self.getWorkloadTime("maximum", cpu): onDemandSpeedup = self.speedup(cpu, "ondemand") - print "CPU %s Speedup On Demand: %.2f%%" % (cpu, onDemandSpeedup) + print "CPU %s Speedup On Demand: %.2f" % (cpu, onDemandSpeedup) if not self.checkSpeedup(onDemandSpeedup): success = False else: @@ -726,22 +736,19 @@ # 23. Compare the timing to the max results for a self.speedUpTolerance delta for cpu in self.packageToCpus[self.currentPackage]: performanceSpeedup = self.speedup(cpu, "performance") - print "CPU %s Performance Speedup: %.2f%%" % (cpu, performanceSpeedup) - if not self.checkSpeedup(performanceSpeedup): - success = False - + print "CPU %s Performance Speedup: %.2f" % (cpu, performanceSpeedup) + self.checkSpeedup(performanceSpeedup, warn=True) else: print "Note: %s governor not supported" % governor
return success
- def runTurboBoostTest(self): + def runOnDemandTests(self): """ test one cpu in the package while others are idle, and verify that its speedup is greater than when all cpus in the package are loaded """ print "" - print "Turbo Boost Test:" + print "Single CPU On Demand Test:" print "-------------------------------------------------" - self.differenceTurboVsMaximum = None # 30. Set and verify the govr. to "performance" governor = "ondemand" success = True @@ -749,27 +756,32 @@ print "Setting governor to %s" % governor if not self.setGovernor(governor): success = False - self.currentWorkload = "turbo" + self.currentWorkload = "ondemand" + + # 16. Wait a fixed period of time, then verify current speed is the slowest in as before + if not self.verifyMinimumFrequency(): + self.logWorkloadError("Error: Could not verify that cpu frequency has settled to the minimum value") + success = False
# 32 Pick a cpu other than cpu0 to load - turboCpu = self.getTurboCpu() - print "Using cpu %s to test Turbo/IDA performance" % turboCpu + singleCpu = self.getSingleCpu() + print "Using cpu %s to test Single CPU On Demand." % singleCpu
# 33. Repeat workload test, loading a single cpu - self.turboTestTime = self.runLoadTest(cpu=turboCpu) - if not self.turboTestTime: + self.onDemandTime = self.runLoadTest(cpu=singleCpu) + if not self.onDemandTime: return False # otherwise - print "Turbo/IDA load test time: %.2f" % self.turboTestTime + print "Single CPU load test time: %.2f" % self.onDemandTime
# 23. Compare the timing to the max results for a self.speedUpTolerance delta - turboSpeedup = self.speedup(turboCpu, "turbo") - if not turboSpeedup: + ondemandSpeedup = self.speedup(singleCpu, "ondemand") + if not ondemandSpeedup: return False - print "Turbo Speedup: %.1f%%" % turboSpeedup + print "Single CPU On Demand Speedup: %.1f" % ondemandSpeedup
- if not self.checkSpeedup(turboSpeedup): + if not self.checkSpeedup(ondemandSpeedup): success = False
else: @@ -778,12 +790,12 @@
return success
- def getTurboCpu(self): + def getSingleCpu(self): # 32 Pick a cpu other than cpu0 to load - for turboCpu in self.packageToCpus[self.currentPackage]: - if turboCpu != "0": + for cpu in self.packageToCpus[self.currentPackage]: + if cpu != "0": break - return turboCpu + return cpu
def restoreGovernors(self): print "Restoring original governor to %s" % (self.originalGovernors[0]) @@ -833,29 +845,25 @@
print ""
- - print "\nCPU Workload Test:\n" - print "Expected Speedup: %.2f" % self.predictedSpeedup - print "Allowable Speedup: %.2f to %.2f" % (self.minimumRequiredSpeedup(), self.maximumRequiredSpeedup()) - print "" - print " On Demand Single CPU " - print "-------- -------------- --------------" - - #actual values, one row per cpu - for cpu in self.packageToCpus[package]: - sys.stdout.write("cpu %-3s " % cpu) - for workload in ["ondemand", "turbo"]: - if workload in self.workloadTime: - workloadTime = self.getWorkloadTime(workload, cpu) - if workloadTime: - sys.stdout.write(" %.2f" % self.speedup(cpu, workload)) - sys.stdout.write((" (%.2fs) " % workloadTime)[:10]) - else: - sys.stdout.write(" - ") + if "ondemand" in self.workloadTime: + print "\nCPU Workload Test:\n" + print "Expected Speedup: %.2f" % self.predictedSpeedup + print "Allowable Speedup: %.2f to %.2f" % (self.minimumRequiredSpeedup(), self.maximumRequiredSpeedup()) print "" + print " On Demand " + print "-------- -------------- " + + #actual values, one row per cpu + for cpu in self.packageToCpus[package]: + workloadTime = self.getWorkloadTime("ondemand", cpu) + if workloadTime: + sys.stdout.write("cpu %-3s " % cpu) + sys.stdout.write(" %.2f" % self.speedup(cpu, "ondemand")) + sys.stdout.write((" (%.2fs) " % workloadTime)[:10]) + print "" + + print ""
- print "" - def printWorkloadTimeSummary(self, package): sys.stdout.write("Workload run times for package %s:\n" % package) sys.stdout.write("-------------------\n") @@ -914,11 +922,6 @@
if not self.runSubTest(self.runPerformanceTests, "Performance, package %s" % package): result = FAILED - - if self.turboBoostSupported(): - if not self.runSubTest(self.runTurboBoostTest, "Turbo Boost/IDA, package %s" % package): - result = FAILED -
self.restoreGovernors()
v7-commits@lists.stg.fedorahosted.org