Changeset 31287 in vbox for trunk/src/VBox
- Timestamp:
- Aug 2, 2010 12:13:00 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64314
- Location:
- trunk/src/VBox/Main
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r31180 r31287 769 769 InsertConfigInteger(pPDMAcFile, "CacheSize", ioCacheSize * _1M); 770 770 771 /* Maximum I/O bandwidth */772 ULONG ioBandwidthMax = 0;773 hrc = pMachine->COMGETTER(IoBandwidthMax)(&ioBandwidthMax); H();774 if (ioBandwidthMax != 0)775 {776 InsertConfigInteger(pPDMAcFile, "VMTransferPerSecMax", ioBandwidthMax * _1M);777 }778 779 771 /* 780 772 * Devices -
trunk/src/VBox/Main/MachineImpl.cpp
r31281 r31287 213 213 mIoCacheEnabled = true; 214 214 mIoCacheSize = 5; /* 5MB */ 215 mIoBandwidthMax = 0; /* Unlimited */ 215 216 /* Maximum CPU priority by default. */ 217 mCpuPriority = 100; 216 218 } 217 219 … … 1279 1281 return S_OK; 1280 1282 } 1283 1284 STDMETHODIMP Machine::COMGETTER(CPUPriority)(ULONG *aPriority) 1285 { 1286 if (!aPriority) 1287 return E_POINTER; 1288 1289 AutoCaller autoCaller(this); 1290 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1291 1292 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1293 1294 *aPriority = mHWData->mCpuPriority; 1295 1296 return S_OK; 1297 } 1298 1299 STDMETHODIMP Machine::COMSETTER(CPUPriority)(ULONG aPriority) 1300 { 1301 /* check priority limits */ 1302 if ( aPriority < 1 1303 || aPriority > 100 1304 ) 1305 return setError(E_INVALIDARG, 1306 tr("Invalid CPU priority: %lu (must be in range [%lu, %lu])"), 1307 aPriority, 1, 100); 1308 1309 AutoCaller autoCaller(this); 1310 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1311 1312 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1313 1314 /* Todo: must always allow changes. */ 1315 HRESULT rc = checkStateDependency(MutableStateDep); 1316 if (FAILED(rc)) return rc; 1317 1318 setModified(IsModified_MachineData); 1319 mHWData.backup(); 1320 mHWData->mCpuPriority = aPriority; 1321 1322 return S_OK; 1323 } 1324 1281 1325 1282 1326 STDMETHODIMP Machine::COMGETTER(CPUHotPlugEnabled)(BOOL *enabled) … … 2647 2691 } 2648 2692 2649 STDMETHODIMP Machine::COMGETTER(IoBandwidthMax)(ULONG *aIoBandwidthMax)2650 {2651 CheckComArgOutPointerValid(aIoBandwidthMax);2652 2653 AutoCaller autoCaller(this);2654 if (FAILED(autoCaller.rc())) return autoCaller.rc();2655 2656 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);2657 2658 *aIoBandwidthMax = mHWData->mIoBandwidthMax;2659 2660 return S_OK;2661 }2662 2663 STDMETHODIMP Machine::COMSETTER(IoBandwidthMax)(ULONG aIoBandwidthMax)2664 {2665 AutoCaller autoCaller(this);2666 if (FAILED(autoCaller.rc())) return autoCaller.rc();2667 2668 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);2669 2670 HRESULT rc = checkStateDependency(MutableStateDep);2671 if (FAILED(rc)) return rc;2672 2673 setModified(IsModified_MachineData);2674 mHWData.backup();2675 mHWData->mIoBandwidthMax = aIoBandwidthMax;2676 2677 return S_OK;2678 }2679 2693 2680 2694 /** … … 6853 6867 mHWData->mSyntheticCpu = data.fSyntheticCpu; 6854 6868 6855 mHWData->mCPUCount = data.cCPUs; 6856 mHWData->mCPUHotPlugEnabled = data.fCpuHotPlug; 6869 mHWData->mCPUCount = data.cCPUs; 6870 mHWData->mCPUHotPlugEnabled = data.fCpuHotPlug; 6871 mHWData->mCpuPriority = data.ulCpuPriority; 6857 6872 6858 6873 // cpu … … 7009 7024 mHWData->mIoCacheEnabled = data.ioSettings.fIoCacheEnabled; 7010 7025 mHWData->mIoCacheSize = data.ioSettings.ulIoCacheSize; 7011 mHWData->mIoBandwidthMax = data.ioSettings.ulIoBandwidthMax;7012 7026 7013 7027 #ifdef VBOX_WITH_GUEST_PROPS … … 7945 7959 } 7946 7960 7947 data.cCPUs = mHWData->mCPUCount; 7948 data.fCpuHotPlug = !!mHWData->mCPUHotPlugEnabled; 7961 data.cCPUs = mHWData->mCPUCount; 7962 data.fCpuHotPlug = !!mHWData->mCPUHotPlugEnabled; 7963 data.ulCpuPriority = mHWData->mCpuPriority; 7949 7964 7950 7965 data.llCpus.clear(); … … 8074 8089 data.ioSettings.fIoCacheEnabled = !!mHWData->mIoCacheEnabled; 8075 8090 data.ioSettings.ulIoCacheSize = mHWData->mIoCacheSize; 8076 data.ioSettings.ulIoBandwidthMax = mHWData->mIoBandwidthMax;8077 8091 8078 8092 // guest properties -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r30681 r31287 52 52 const LONG lDevice; 53 53 const DeviceType_T type; 54 bool fPassthrough : 1; 55 bool fImplicit : 1; 54 bool fPassthrough; 55 bool fImplicit; 56 ULONG mBandwidthLimit; 56 57 }; 57 58 … … 132 133 m->bd->fImplicit = false; 133 134 135 /* Default is no limit. */ 136 m->bd->mBandwidthLimit = 0; 137 134 138 /* Confirm a successful initialization when it's the case */ 135 139 autoInitSpan.setSucceeded(); … … 272 276 } 273 277 278 STDMETHODIMP MediumAttachment::COMGETTER(BandwidthLimit) (ULONG *aLimit) 279 { 280 CheckComArgOutPointerValid(aLimit); 281 282 AutoCaller autoCaller(this); 283 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 284 285 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 286 287 *aLimit = m->bd->mBandwidthLimit; 288 return S_OK; 289 } 290 291 STDMETHODIMP MediumAttachment::COMSETTER(BandwidthLimit) (ULONG aLimit) 292 { 293 AutoCaller autoCaller(this); 294 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 295 296 /* the machine doesn't need to be mutable */ 297 298 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 299 300 if (aLimit != m->bd->mBandwidthLimit) 301 { 302 m->bd.backup(); 303 m->bd->mBandwidthLimit = aLimit; 304 305 /* todo: not all storage attachments will support this. */ 306 } 307 return S_OK; 308 } 309 274 310 /** 275 311 * @note Locks this object for writing. -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r28800 r31287 84 84 /* initialize data */ 85 85 mData->mSlot = aSlot; 86 87 /* Default limit is not capped/unlimited. */ 88 mData->mBandwidthLimit = 0; 86 89 87 90 /* default to Am79C973 */ … … 749 752 } 750 753 754 STDMETHODIMP NetworkAdapter::COMGETTER(BandwidthLimit) (ULONG *aLimit) 755 { 756 CheckComArgOutPointerValid(aLimit); 757 758 AutoCaller autoCaller(this); 759 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 760 761 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 762 763 *aLimit = mData->mBandwidthLimit; 764 return S_OK; 765 } 766 767 STDMETHODIMP NetworkAdapter::COMSETTER(BandwidthLimit) (ULONG aLimit) 768 { 769 AutoCaller autoCaller(this); 770 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 771 772 /* the machine doesn't need to be mutable */ 773 774 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 775 776 if (aLimit != mData->mBandwidthLimit) 777 { 778 mData.backup(); 779 mData->mBandwidthLimit = aLimit; 780 781 m_fModified = true; 782 // leave the lock before informing callbacks 783 alock.release(); 784 785 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock 786 mParent->setModified(Machine::IsModified_NetworkAdapters); 787 mlock.release(); 788 789 /* No change in CFGM logic => changeAdapter=FALSE. */ 790 mParent->onNetworkAdapterChange(this, FALSE); 791 } 792 return S_OK; 793 } 794 751 795 STDMETHODIMP NetworkAdapter::COMGETTER(TraceEnabled) (BOOL *aEnabled) 752 796 { … … 1218 1262 /* boot priority (defaults to 0, i.e. lowest) */ 1219 1263 mData->mBootPriority = data.ulBootPriority; 1264 /* Bandwidth limit in Mbps. */ 1265 mData->mBandwidthLimit = data.ulBandwidthLimit; 1220 1266 1221 1267 switch (data.mode) … … 1300 1346 1301 1347 data.ulBootPriority = mData->mBootPriority; 1348 1349 data.ulBandwidthLimit = mData->mBandwidthLimit; 1302 1350 1303 1351 data.type = mData->mAdapterType; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31280 r31287 3638 3638 <interface 3639 3639 name="IMachine" extends="$unknown" 3640 uuid=" de8f0b23-f285-4779-acf4-08eddda7ec75"3640 uuid="e2d8679e-b144-41d9-9dfa-bbe2fd0ab2d1" 3641 3641 wsmap="managed" 3642 3642 > … … 3835 3835 </attribute> 3836 3836 3837 <attribute name="memorySize" type="unsigned long"> 3837 <attribute name="CPUPriority" type="unsigned long"> 3838 <desc> 3839 Priority of the virtual CPUs. Means to limit the number of CPU cycles 3840 a guest can use. The unit is percentage of host CPU cycles per second. 3841 The valid range is 1 - 100. 100 (the default) implies no limit. 3842 </desc> 3843 </attribute> 3844 3845 <attribute name="memorySize" type="unsigned long"> 3838 3846 <desc>System memory size in megabytes.</desc> 3839 3847 </attribute> … … 4191 4199 </attribute> 4192 4200 4193 <attribute name="ioBandwidthMax" type="unsigned long">4194 <desc>4195 The maximum number of MB the VM is allowed to transfer per second.4196 0 means unlimited bandwidth.4197 </desc>4198 </attribute>4199 4200 4201 <method name="lockMachine"> 4201 4202 <desc> … … 8529 8530 <interface 8530 8531 name="IMediumAttachment" extends="$unknown" 8531 uuid=" e58eb3eb-8627-428b-bdf8-34487c848de5"8532 uuid="c29452cc-ca72-404b-9261-cfc514f1e412" 8532 8533 wsmap="struct" 8533 8534 > … … 8580 8581 <attribute name="passthrough" type="boolean" readonly="yes"> 8581 8582 <desc>Pass I/O requests through to a device on the host.</desc> 8583 </attribute> 8584 8585 <attribute name="bandwidthLimit" type="unsigned long"> 8586 <desc> 8587 Maximum throughput allowed for this medium attachment, in units of 1 mbps. 8588 A zero value means uncapped/unlimited. 8589 </desc> 8582 8590 </attribute> 8583 8591 … … 11077 11085 <interface 11078 11086 name="INetworkAdapter" extends="$unknown" 11079 uuid=" 5bdb9df8-a5e1-4322-a139-b7a4a734c790"11087 uuid="9bf58a46-c3f7-4f31-80fa-dde9a5dc0b7b" 11080 11088 wsmap="managed" 11081 11089 > … … 11192 11200 </attribute> 11193 11201 11194 <method name="attachToNAT"> 11202 <attribute name="bandwidthLimit" type="unsigned long"> 11203 <desc> 11204 Maximum throughput allowed for this network adapter, in units of 1 mbps. 11205 A zero value means uncapped/unlimited. 11206 </desc> 11207 </attribute> 11208 11209 <method name="attachToNAT"> 11195 11210 <desc> 11196 11211 Attach the network adapter to the Network Address Translation (NAT) interface. -
trunk/src/VBox/Main/include/MachineImpl.h
r31228 r31287 271 271 ULONG mCPUCount; 272 272 BOOL mCPUHotPlugEnabled; 273 ULONG mCpuPriority; 273 274 BOOL mAccelerate3DEnabled; 274 275 BOOL mHpetEnabled; … … 296 297 BOOL mIoCacheEnabled; 297 298 ULONG mIoCacheSize; 298 ULONG mIoBandwidthMax;299 299 }; 300 300 … … 392 392 STDMETHOD(COMGETTER(CPUHotPlugEnabled))(BOOL *enabled); 393 393 STDMETHOD(COMSETTER(CPUHotPlugEnabled))(BOOL enabled); 394 STDMETHOD(COMGETTER(CPUPriority))(ULONG *aPriority); 395 STDMETHOD(COMSETTER(CPUPriority))(ULONG aPriority); 394 396 STDMETHOD(COMGETTER(HpetEnabled))(BOOL *enabled); 395 397 STDMETHOD(COMSETTER(HpetEnabled))(BOOL enabled); … … 451 453 STDMETHOD(COMGETTER(IoCacheSize)) (ULONG *aIoCacheSize); 452 454 STDMETHOD(COMSETTER(IoCacheSize)) (ULONG aIoCacheSize); 453 STDMETHOD(COMGETTER(IoBandwidthMax)) (ULONG *aIoBandwidthMax);454 STDMETHOD(COMSETTER(IoBandwidthMax)) (ULONG aIoBandwidthMax);455 455 456 456 // IMachine methods -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r30739 r31287 61 61 STDMETHOD(COMGETTER(Type))(DeviceType_T *aType); 62 62 STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough); 63 STDMETHOD(COMGETTER(BandwidthLimit))(ULONG *aLimit); 64 STDMETHOD(COMSETTER(BandwidthLimit))(ULONG aLimit); 63 65 64 66 // public internal methods -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r30764 r31287 69 69 Bstr mNATNetwork; 70 70 ULONG mBootPriority; 71 ULONG mBandwidthLimit; 71 72 }; 72 73 … … 122 123 STDMETHOD(COMGETTER(BootPriority)) (ULONG *aBootPriority); 123 124 STDMETHOD(COMSETTER(BootPriority)) (ULONG aBootPriority); 125 STDMETHOD(COMGETTER(BandwidthLimit)) (ULONG *aLimit); 126 STDMETHOD(COMSETTER(BandwidthLimit)) (ULONG aLimit); 124 127 125 128 // INetworkAdapter methods -
trunk/src/VBox/Main/xml/Settings.cpp
r31131 r31287 1489 1489 fCpuHotPlug(false), 1490 1490 fHpetEnabled(false), 1491 ulCpuPriority(100), 1491 1492 ulMemorySizeMB((uint32_t)-1), 1492 1493 ulVRAMSizeMB(8), … … 1533 1534 && (cCPUs == h.cCPUs) 1534 1535 && (fCpuHotPlug == h.fCpuHotPlug) 1536 && (ulCpuPriority == h.ulCpuPriority) 1535 1537 && (fHpetEnabled == h.fHpetEnabled) 1536 1538 && (llCpus == h.llCpus) … … 1642 1644 fIoCacheEnabled = true; 1643 1645 ulIoCacheSize = 5; 1644 ulIoBandwidthMax = 0;1645 1646 } 1646 1647 … … 1839 1840 pelmAdapter->getAttributeValue("tracefile", nic.strTraceFile); 1840 1841 pelmAdapter->getAttributeValue("bootPriority", nic.ulBootPriority); 1842 pelmAdapter->getAttributeValue("bandwidthLimit", nic.ulBandwidthLimit); 1841 1843 1842 1844 xml::ElementNodesList llNetworkModes; … … 2193 2195 2194 2196 pelmHwChild->getAttributeValue("hotplug", hw.fCpuHotPlug); 2197 pelmHwChild->getAttributeValue("priority", hw.ulCpuPriority); 2195 2198 2196 2199 const xml::ElementNode *pelmCPUChild; … … 2540 2543 pelmIoChild->getAttributeValue("enabled", hw.ioSettings.fIoCacheEnabled); 2541 2544 pelmIoChild->getAttributeValue("size", hw.ioSettings.ulIoCacheSize); 2542 }2543 if ((pelmIoChild = pelmHwChild->findChildElement("IoBandwidth")))2544 {2545 pelmIoChild->getAttributeValue("max", hw.ioSettings.ulIoBandwidthMax);2546 2545 } 2547 2546 } … … 3107 3106 pelmCPU->createChild("SyntheticCpu")->setAttribute("enabled", hw.fSyntheticCpu); 3108 3107 pelmCPU->setAttribute("count", hw.cCPUs); 3108 if (hw.ulCpuPriority != 100) 3109 pelmCPU->setAttribute("priority", hw.ulCpuPriority); 3109 3110 3110 3111 if (hw.fLargePages) … … 3386 3387 pelmAdapter->setAttribute("tracefile", nic.strTraceFile); 3387 3388 } 3389 if (nic.ulBandwidthLimit) 3390 pelmAdapter->setAttribute("bandwidthLimit", nic.ulBandwidthLimit); 3388 3391 3389 3392 const char *pcszType; … … 3572 3575 pelmIoCache->setAttribute("size", hw.ioSettings.ulIoCacheSize); 3573 3576 pelmIoBandwidth = pelmIo->createChild("IoBandwidth"); 3574 pelmIoBandwidth->setAttribute("max", hw.ioSettings.ulIoBandwidthMax);3575 3577 } 3576 3578 … … 4188 4190 netit != hardwareMachine.llNetworkAdapters.end(); ++netit) 4189 4191 { 4192 if (netit->ulBandwidthLimit) 4193 { 4194 /* New in VirtualBox 3.3 */ 4195 m->sv = SettingsVersion_v1_11; 4196 break; 4197 } 4198 4190 4199 if ( netit->fEnabled 4191 4200 && netit->mode == NetworkAttachmentType_NAT … … 4219 4228 } 4220 4229 // VirtualBox 3.2: Check for non default I/O settings and bump the settings version. 4221 if (m->sv < SettingsVersion_v1_1 0)4230 if (m->sv < SettingsVersion_v1_11) 4222 4231 { 4223 4232 if ( hardwareMachine.ioSettings.fIoCacheEnabled != true 4224 || hardwareMachine.ioSettings.ulIoCacheSize != 5 4225 || hardwareMachine.ioSettings.ulIoBandwidthMax != 0) 4233 || hardwareMachine.ioSettings.ulIoCacheSize != 5) 4226 4234 m->sv = SettingsVersion_v1_10; 4227 4235 } 4228 4236 4229 4237 // VirtualBox 3.2 adds support for VRDP video channel 4230 if ( m->sv < SettingsVersion_v1_1 04238 if ( m->sv < SettingsVersion_v1_11 4231 4239 && ( hardwareMachine.vrdpSettings.fVideoChannel 4232 4240 ) … … 4240 4248 ) 4241 4249 m->sv = SettingsVersion_v1_11; 4250 4251 // VirtualBox 3.3 adds support for CPU priority 4252 if ( m->sv < SettingsVersion_v1_11 4253 && ( hardwareMachine.ulCpuPriority != 100 4254 ) 4255 ) 4256 m->sv = SettingsVersion_v1_10; 4242 4257 } 4243 4258
Note:
See TracChangeset
for help on using the changeset viewer.