- Timestamp:
- Nov 8, 2021 2:37:50 PM (3 years ago)
- Location:
- trunk/src/VBox/ValidationKit
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testdriver/vboxwrappers.py
r92244 r92269 1721 1721 return fRc; 1722 1722 1723 def setLargePages(self, fUseLargePages): 1724 """ 1725 Configures whether the VM should use large pages or not. 1726 Returns True on success and False on failure. Error information is logged. 1727 """ 1728 fRc = True; 1729 try: 1730 self.o.machine.setHWVirtExProperty(vboxcon.HWVirtExPropertyType_LargePages, fUseLargePages); 1731 except: 1732 reporter.errorXcpt('failed to set large pages of "%s" to %s' % (self.sName, fUseLargePages)); 1733 fRc = False; 1734 else: 1735 reporter.log('set the large pages of "%s" to %s' % (self.sName, fUseLargePages)); 1736 self.oTstDrv.processPendingEvents(); 1737 return fRc; 1738 1723 1739 def setVRamSize(self, cMB): 1724 1740 """ -
trunk/src/VBox/ValidationKit/tests/benchmarks/Makefile.kmk
r82968 r92269 33 33 ValidationKitTestsBenchmarks_INST = $(INST_VALIDATIONKIT)tests/benchmarks/ 34 34 ValidationKitTestsBenchmarks_EXEC_SOURCES := \ 35 $(PATH_SUB_CURRENT)/tdBenchmark1.py 35 $(PATH_SUB_CURRENT)/tdBenchmark1.py \ 36 $(PATH_SUB_CURRENT)/tdBenchmark2.py 36 37 37 38 VBOX_VALIDATIONKIT_PYTHON_SOURCES += $(ValidationKitTestsBenchmarks_EXEC_SOURCES) -
trunk/src/VBox/ValidationKit/tests/benchmarks/tdBenchmark2.py
r92247 r92269 44 44 from testdriver import reporter; 45 45 from testdriver import vbox; 46 from testdriver import vboxcon; 46 47 from testdriver import vboxtestvms; 47 48 48 49 49 class tdBenchmark 1(vbox.TestDriver):50 class tdBenchmark2(vbox.TestDriver): 50 51 """ 51 Benchmark # 1.52 Benchmark #2 - Memory. 52 53 """ 53 54 54 55 def __init__(self): 55 56 vbox.TestDriver.__init__(self); 56 oTestVm = vboxtestvms.BootSectorTestVm(self.oTestVmSet, 'tst-bs- test1',57 os.path.join(self.sVBoxBootSectors, 'b ootsector2-test1.img'));57 oTestVm = vboxtestvms.BootSectorTestVm(self.oTestVmSet, 'tst-bs-memalloc-1', 58 os.path.join(self.sVBoxBootSectors, 'bs3-memalloc-1.img')); 58 59 self.oTestVmSet.aoTestVms.append(oTestVm); 59 60 … … 86 87 fRc = False; 87 88 88 sXmlFile = self.prepareResultFile(); 89 asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile]; 89 # 90 # Determin the RAM configurations we want to test. 91 # 92 cMbMaxGuestRam = self.oVBox.systemProperties.maxGuestRAM; 93 cMbHostAvail = self.oVBox.host.memoryAvailable; 94 cMbHostTotal = self.oVBox.host.memorySize; 95 reporter.log('cMbMaxGuestRam=%s cMbHostAvail=%s cMbHostTotal=%s' % (cMbMaxGuestRam, cMbHostAvail, cMbHostTotal,)); 90 96 91 self.logVmInfo(oVM); 92 oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv); 93 if oSession is not None: 94 cMsTimeout = 15*60*1000; 95 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ... 96 cMsTimeout = self.adjustTimeoutMs(180 * 60000); 97 cMbHostAvail -= cMbHostAvail // 10; # Rough 10% safety/overhead margin. 98 if cMbMaxGuestRam < cMbHostAvail: 99 # Currently: 2048 GiB, 1536 GiB, 1024 GiB, 512 GiB, 256 GiB, 128 GiB 100 acMbRam = [ cMbMaxGuestRam, cMbMaxGuestRam // 4 * 3, cMbMaxGuestRam // 2, cMbMaxGuestRam // 4, 101 cMbMaxGuestRam // 8, cMbMaxGuestRam // 16 ]; 102 elif cMbHostAvail > 8*1024: 103 # First entry is available memory rounded down to the nearest 8 GiB 104 cMbHostAvail = cMbHostAvail & ~(8 * 1024 - 1); 105 acMbRam = [ cMbHostAvail, ]; 97 106 98 oRc = self.waitForTasks(cMsTimeout); 99 if oRc == oSession: 100 fRc = oSession.assertPoweredOff(); 101 else: 102 reporter.error('oRc=%s, expected %s' % (oRc, oSession)); 107 # The remaining entries are powers of two below that, up to 6 of these stopping at 16 GiB. 108 cMb = 8*1024; 109 while cMb < cMbHostAvail: 110 cMb *= 2; 111 while len(acMbRam) < 7 and cMb > 16 * 1024: 112 cMb //= 2; 113 acMbRam.append(cMb); 114 else: 115 reporter.log("Less than 8GB of host RAM available for VMs, skipping test"); 116 return None; 117 reporter.log("RAM configurations: %s" % (acMbRam)); 103 118 104 reporter.addSubXmlFile(sXmlFile); 105 self.terminateVmBySession(oSession); 119 # Large pages only work with nested paging. 120 afLargePages = [False, ]; 121 try: 122 if oVM.getHWVirtExProperty(vboxcon.HWVirtExPropertyType_NestedPaging): 123 afLargePages = [True, False]; 124 except: 125 return reporter.errorXcpt("Failed to get HWVirtExPropertyType_NestedPaging"); 126 127 # 128 # Test the RAM configurations. 129 # 130 for fLargePages in afLargePages: 131 sLargePages = 'large pages' if fLargePages is True else 'no large pages'; 132 for cMbRam in acMbRam: 133 reporter.testStart('%s MiB, %s' % (cMbRam, sLargePages)); 134 135 # Reconfigure the VM: 136 fRc = False 137 oSession = self.openSession(oVM); 138 if oSession: 139 fRc = oSession.setRamSize(cMbRam); 140 fRc = oSession.setLargePages(fLargePages) and fRc; 141 if fRc: 142 fRc = oSession.saveSettings(); 143 if not fRc: 144 oSession.discardSettings(True); 145 oSession.close(); 146 if fRc: 147 # Set up the result file 148 sXmlFile = self.prepareResultFile(); 149 asEnv = [ 'IPRT_TEST_FILE=' + sXmlFile, ]; 150 151 # Do the test: 152 self.logVmInfo(oVM); 153 oSession = self.startVm(oVM, sName = oTestVm.sVmName, asEnv = asEnv); 154 if oSession is not None: 155 cMsTimeout = 15 * 60000 + cMbRam / 256; 156 if not reporter.isLocal(): ## @todo need to figure a better way of handling timeouts on the testboxes ... 157 cMsTimeout = self.adjustTimeoutMs(180 * 60000 + cMbRam / 256); 158 159 oRc = self.waitForTasks(cMsTimeout); 160 if oRc == oSession: 161 fRc = oSession.assertPoweredOff(); 162 else: 163 reporter.error('oRc=%s, expected %s' % (oRc, oSession)); 164 165 reporter.addSubXmlFile(sXmlFile); 166 self.terminateVmBySession(oSession); 167 else: 168 reporter.errorXcpt("Failed to set memory size to %s MiB or setting largePages to %s" % (cMbRam, fLargePages)); 169 reporter.testDone(); 170 106 171 return fRc; 107 172 … … 109 174 110 175 if __name__ == '__main__': 111 sys.exit(tdBenchmark 1().main(sys.argv));176 sys.exit(tdBenchmark2().main(sys.argv)); 112 177
Note:
See TracChangeset
for help on using the changeset viewer.