VirtualBox

Ignore:
Timestamp:
Oct 31, 2008 3:53:18 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38690
Message:

Introduced new xml setting for the number of virtual CPUs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r13713 r13722  
    188188    /* default values for a newly created machine */
    189189    mMemorySize = 128;
     190    mCPUCount = 1;
    190191    mMemoryBalloonSize = 0;
    191192    mStatisticsUpdateInterval = 0;
     
    226227        mHWVirtExVPIDEnabled != that.mHWVirtExVPIDEnabled ||
    227228        mPAEEnabled != that.mPAEEnabled ||
     229        mCPUCount != that.mCPUCount ||
    228230        mClipboardMode != that.mClipboardMode)
    229231        return false;
     
    932934    mHWData.backup();
    933935    mHWData->mMemorySize = memorySize;
     936
     937    return S_OK;
     938}
     939
     940STDMETHODIMP Machine::COMGETTER(CPUCount) (ULONG *CPUCount)
     941{
     942    if (!CPUCount)
     943        return E_POINTER;
     944
     945    AutoCaller autoCaller (this);
     946    CheckComRCReturnRC (autoCaller.rc());
     947
     948    AutoReadLock alock (this);
     949
     950    *CPUCount = mHWData->mCPUCount;
     951
     952    return S_OK;
     953}
     954
     955STDMETHODIMP Machine::COMSETTER(CPUCount) (ULONG CPUCount)
     956{
     957    /* check RAM limits */
     958    if (CPUCount < SchemaDefs::MinCPUCount ||
     959        CPUCount > SchemaDefs::MaxCPUCount)
     960        return setError (E_INVALIDARG,
     961            tr ("Invalid virtual CPU count: %lu (must be in range [%lu, %lu])"),
     962                CPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount);
     963
     964    AutoCaller autoCaller (this);
     965    CheckComRCReturnRC (autoCaller.rc());
     966
     967    AutoWriteLock alock (this);
     968
     969    HRESULT rc = checkStateDependency (MutableStateDep);
     970    CheckComRCReturnRC (rc);
     971
     972    mHWData.backup();
     973    mHWData->mCPUCount = CPUCount;
    934974
    935975    return S_OK;
     
    49404980                mHWData->mPAEEnabled = PAENode.value <bool> ("enabled");
    49414981            }
     4982
     4983            /* CPUCount(optional, default is 1) */
     4984            Key CPUCountNode = cpuNode.findKey ("CPUCount");
     4985            if (!CPUCountNode.isNull())
     4986            {
     4987                mHWData->mCPUCount = CPUCountNode.value <ULONG> ("CPUCount");
     4988            }
    49424989        }
    49434990    }
     
    63106357            PAENode.setValue <bool> ("enabled", true);
    63116358        }
     6359
     6360        /* CPU count */
     6361        Key CPUCountNode = cpuNode.createKey ("CPUCount");
     6362        CPUCountNode.setValue <ULONG> ("CPUCount", mHWData->mCPUCount);
    63126363    }
    63136364
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette