VirtualBox

Changeset 60410 in vbox


Ignore:
Timestamp:
Apr 10, 2016 3:42:46 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106496
Message:

IMachine: Added CPUProfile attribute (read/write string). Added a modifyvm option for setting it. Show non-default values in showvminfo, but always show it starting with 6.0.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/settings.h

    r60107 r60410  
    940940    uint32_t            ulCpuExecutionCap;      // requires settings version 1.11 (VirtualBox 3.3)
    941941    uint32_t            uCpuIdPortabilityLevel; // requires settings version 1.15 (VirtualBox 5.0)
     942    com::Utf8Str        strCpuProfile;          // requires settings version 1.16 (VirtualBox 5.1)
    942943
    943944    CpuIdLeafsList      llCpuIdLeafs;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r59269 r60410  
    3636
    3737#include <VBox/log.h>
     38#include <VBox/version.h>
    3839#include <iprt/stream.h>
    3940#include <iprt/time.h>
     
    445446    } while (0)
    446447
     448    /** @def SHOW_STRING_PROP_MAJ
     449     * For not breaking the output in a dot release we don't show default values. */
     450#define SHOW_STRING_PROP_MAJ(a_pObj, a_Prop, a_szMachine, a_szHuman, a_szUnless, a_uMajorVer) \
     451    do \
     452    { \
     453        Bstr bstr; \
     454        CHECK_ERROR2I_RET(a_pObj, COMGETTER(a_Prop)(bstr.asOutParam()), hrcCheck); \
     455        if ((a_uMajorVer) <= VBOX_VERSION_MAJOR || !bstr.equals(a_szUnless)) \
     456        { \
     457            if (details == VMINFO_MACHINEREADABLE)\
     458                outputMachineReadableString(a_szMachine, &bstr); \
     459            else \
     460                RTPrintf("%-16s %ls\n", a_szHuman ":", bstr.raw()); \
     461        } \
     462    } while (0)
     463
    447464#define SHOW_STRINGARRAY_PROP(a_pObj, a_Prop, a_szMachine, a_szHuman) \
    448465    do \
     
    564581    SHOW_ULONG_PROP(       machine, CPUExecutionCap,            "cpuexecutioncap",      "CPU exec cap",     "%%");
    565582    SHOW_BOOLEAN_PROP(     machine, HPETEnabled,                "hpet",                 "HPET");
     583    SHOW_STRING_PROP_MAJ(  machine, CPUProfile,                 "cpu-profile",          "CPUProfile",       "host", 6);
    566584
    567585    ChipsetType_T chipsetType;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r58437 r60410  
    7272    MODIFYVM_CPUS,
    7373    MODIFYVM_CPUHOTPLUG,
     74    MODIFYVM_CPU_PROFILE,
    7475    MODIFYVM_PLUGCPU,
    7576    MODIFYVM_UNPLUGCPU,
     
    217218static const RTGETOPTDEF g_aModifyVMOptions[] =
    218219{
     220/** @todo Convert to dash separated names like --triple-fault-reset! Please
     221 *        do that for all new options as we don't need more character soups
     222 *        around VirtualBox - typedefs more than covers that demand! */
    219223    { "--name",                     MODIFYVM_NAME,                      RTGETOPT_REQ_STRING },
    220224    { "--groups",                   MODIFYVM_GROUPS,                    RTGETOPT_REQ_STRING },
     
    244248    { "--cpus",                     MODIFYVM_CPUS,                      RTGETOPT_REQ_UINT32 },
    245249    { "--cpuhotplug",               MODIFYVM_CPUHOTPLUG,                RTGETOPT_REQ_BOOL_ONOFF },
     250    { "--cpu-profile",              MODIFYVM_CPU_PROFILE,               RTGETOPT_REQ_STRING },
    246251    { "--plugcpu",                  MODIFYVM_PLUGCPU,                   RTGETOPT_REQ_UINT32 },
    247252    { "--unplugcpu",                MODIFYVM_UNPLUGCPU,                 RTGETOPT_REQ_UINT32 },
     
    774779            }
    775780
     781            case MODIFYVM_CPU_PROFILE:
     782            {
     783                CHECK_ERROR(sessionMachine, COMSETTER(CPUProfile)(Bstr(ValueUnion.psz).raw()));
     784                break;
     785            }
     786
    776787            case MODIFYVM_PLUGCPU:
    777788            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r60408 r60410  
    43234323  <interface
    43244324    name="IMachine" extends="$unknown"
    4325     uuid="e1aa7812-ec46-4612-d9d5-0a3d4703b3ab"
     4325    uuid="95565a66-622a-4ad0-4eed-9bb83c91c5be"
    43264326    wsmap="managed"
    43274327    wrap-hint-server-addinterfaces="IInternalMachineControl"
    43284328    wrap-hint-server="manualaddinterfaces"
    4329     reservedMethods="8" reservedAttributes="12"
    4330     >
     4329    reservedMethods="8" reservedAttributes="10"
     4330    >
     4331    <!-- Note! This interface is not compatible between 5.0 and 5.1 as it had too many
     4332               methods/attributes for midl and the reservedAttributes had to be
     4333               decreased.  Max methods+attributes is 256, so in 6.0 this interface must
     4334               be refactored a little!  In the mean time, take from reservedMethods and
     4335               reservedAttributes and update the UUID like always. -->
    43314336    <desc>
    43324337      The IMachine interface represents a virtual machine, or guest, created
     
    51705175      <desc>
    51715176        Debug parameters for the paravirtualized guest interface provider.
     5177      </desc>
     5178    </attribute>
     5179
     5180    <attribute name="CPUProfile" type="wstring">
     5181      <desc>
     5182        Experimental feature to select the guest CPU profile.  The default
     5183        is "host", which indicates the host CPU.  All other names are subject
     5184        to change.
     5185
     5186        The profiles are found in src/VBox/VMM/VMMR3/cpus/.
    51725187      </desc>
    51735188    </attribute>
  • trunk/src/VBox/Main/include/MachineImpl.h

    r58437 r60410  
    290290        ULONG               mCpuExecutionCap;
    291291        uint32_t            mCpuIdPortabilityLevel;
     292        Utf8Str             mCpuProfile;
    292293        BOOL                mAccelerate3DEnabled;
    293294        BOOL                mHPETEnabled;
     
    875876    HRESULT getCPUIDPortabilityLevel(ULONG *aCPUIDPortabilityLevel);
    876877    HRESULT setCPUIDPortabilityLevel(ULONG aCPUIDPortabilityLevel);
     878    HRESULT getCPUProfile(com::Utf8Str &aCPUProfile);
     879    HRESULT setCPUProfile(const com::Utf8Str &aCPUProfile);
    877880    HRESULT getMemorySize(ULONG *aMemorySize);
    878881    HRESULT setMemorySize(ULONG aMemorySize);
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r60045 r60410  
    876876
    877877        /*
     878         * EM values (before CPUM as it may need to set IemExecutesAll).
     879         */
     880        PCFGMNODE pEM;
     881        InsertConfigNode(pRoot, "EM", &pEM);
     882
     883        /* Triple fault behavior. */
     884        BOOL fTripleFaultReset = false;
     885        hrc = pMachine->GetCPUProperty(CPUPropertyType_TripleFaultReset, &fTripleFaultReset); H();
     886        InsertConfigInteger(pEM, "TripleFaultReset", fTripleFaultReset);
     887
     888        /*
    878889         * CPUM values.
    879890         */
     
    957968        /* CPU Portability level, */
    958969        ULONG uCpuIdPortabilityLevel = 0;
    959         hrc = pMachine->COMGETTER(CPUIDPortabilityLevel)(&uCpuIdPortabilityLevel);            H();
     970        hrc = pMachine->COMGETTER(CPUIDPortabilityLevel)(&uCpuIdPortabilityLevel);          H();
    960971        InsertConfigInteger(pCPUM, "PortableCpuIdLevel", uCpuIdPortabilityLevel);
    961972
     
    964975        hrc = pMachine->GetCPUProperty(CPUPropertyType_PAE, &fEnablePAE);                   H();
    965976        InsertConfigInteger(pRoot, "EnablePAE", fEnablePAE);
     977
     978        /* CPUM profile name. */
     979        hrc = pMachine->COMGETTER(CPUProfile)(bstr.asOutParam());                           H();
     980        InsertConfigString(pRoot, "GuestCPUName", bstr);
     981
     982        /*
     983         * Temporary(?) hack to make sure we emulate the ancient 16-bit CPUs
     984         * correctly.   There are way to many #UDs we'll miss using VT-x,
     985         * raw-mode or qemu for the 186 and 286, while we'll get undefined opcodes
     986         * dead wrong on 8086 (see http://www.os2museum.com/wp/undocumented-8086-opcodes/).
     987         */
     988        if (   bstr.equals("80286")
     989            || bstr.equals("80186")
     990            || bstr.equals("V30")
     991            || bstr.equals("V20")
     992            || bstr.equals("8086")
     993            || bstr.equals("8088") )
     994            InsertConfigInteger(pEM, "IemExecutesAll", true);
    966995
    967996        /*
     
    10331062        }
    10341063        InsertConfigInteger(pRoot, "HMEnabled", fHMEnabled);
    1035 
    1036         /* /EM/xzy */
    1037         PCFGMNODE pEM;
    1038         InsertConfigNode(pRoot, "EM", &pEM);
    1039 
    1040         /* Triple fault behavior. */
    1041         BOOL fTripleFaultReset = false;
    1042         hrc = pMachine->GetCPUProperty(CPUPropertyType_TripleFaultReset, &fTripleFaultReset); H();
    1043         InsertConfigInteger(pEM, "TripleFaultReset", fTripleFaultReset);
    10441064
    10451065        /* /HM/xzy */
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r60054 r60410  
    197197    mCpuExecutionCap = 100; /* Maximum CPU execution cap by default. */
    198198    mCpuIdPortabilityLevel = 0;
     199    mCpuProfile = "host";
    199200
    200201    /* default boot order: floppy - DVD - HDD */
     
    16331634}
    16341635
     1636HRESULT Machine::getCPUProfile(com::Utf8Str &aCPUProfile)
     1637{
     1638    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     1639    aCPUProfile = mHWData->mCpuProfile;
     1640    return S_OK;
     1641}
     1642
     1643HRESULT Machine::setCPUProfile(const com::Utf8Str &aCPUProfile)
     1644{
     1645    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     1646    HRESULT hrc = i_checkStateDependency(MutableStateDep);
     1647    if (SUCCEEDED(hrc))
     1648    {
     1649        i_setModified(IsModified_MachineData);
     1650        mHWData.backup();
     1651        /* Empty equals 'host'. */
     1652        if (aCPUProfile.isNotEmpty())
     1653            mHWData->mCpuProfile = aCPUProfile;
     1654        else
     1655            mHWData->mCpuProfile = "host";
     1656    }
     1657    return hrc;
     1658}
     1659
    16351660HRESULT Machine::getEmulatedUSBCardReaderEnabled(BOOL *aEmulatedUSBCardReaderEnabled)
    16361661{
     
    88478872        mHWData->mCpuExecutionCap             = data.ulCpuExecutionCap;
    88488873        mHWData->mCpuIdPortabilityLevel       = data.uCpuIdPortabilityLevel;
     8874        mHWData->mCpuProfile                  = data.strCpuProfile;
    88498875
    88508876        // cpu
     
    1018210208        data.ulCpuExecutionCap      = mHWData->mCpuExecutionCap;
    1018310209        data.uCpuIdPortabilityLevel = mHWData->mCpuIdPortabilityLevel;
     10210        data.strCpuProfile          = mHWData->mCpuProfile;
    1018410211
    1018510212        data.llCpus.clear();
  • trunk/src/VBox/Main/xml/Settings.cpp

    r60283 r60410  
    20612061          ulCpuExecutionCap(100),
    20622062          uCpuIdPortabilityLevel(0),
     2063          strCpuProfile("host"),
    20632064          ulMemorySizeMB((uint32_t)-1),
    20642065          graphicsControllerType(GraphicsControllerType_VBoxVGA),
     
    21352136                  && (ulCpuExecutionCap         == h.ulCpuExecutionCap)
    21362137                  && (uCpuIdPortabilityLevel    == h.uCpuIdPortabilityLevel)
     2138                  && strCpuProfile              == h.strCpuProfile
    21372139                  && (fHPETEnabled              == h.fHPETEnabled)
    21382140                  && (llCpus                    == h.llCpus)
     
    21702172                  && (llSharedFolders           == h.llSharedFolders)
    21712173                  && (clipboardMode             == h.clipboardMode)
    2172                   && (dndMode           == h.dndMode)
     2174                  && (dndMode                   == h.dndMode)
    21732175                  && (ulMemoryBalloonSize       == h.ulMemoryBalloonSize)
    21742176                  && (fPageFusionEnabled        == h.fPageFusionEnabled)
     
    29382940            }
    29392941            pelmHwChild->getAttributeValue("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
     2942            pelmHwChild->getAttributeValue("CpuProfile", hw.strCpuProfile);
    29402943
    29412944            if ((pelmCPUChild = pelmHwChild->findChildElement("TripleFaultReset")))
     
    42484251    if (hw.uCpuIdPortabilityLevel != 0)
    42494252        pelmCPU->setAttribute("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
     4253    if (!hw.strCpuProfile.equals("host") && hw.strCpuProfile.isNotEmpty())
     4254        pelmCPU->setAttribute("CpuProfile", hw.strCpuProfile);
    42504255
    42514256    /* Always save this setting as we have changed the default in 4.0 (on for large memory 64-bit systems). */
     
    56885693    if (m->sv < SettingsVersion_v1_16)
    56895694    {
    5690         // VirtualBox 5.1 adds a NVMe storage controller, paravirt debug options.
     5695        // VirtualBox 5.1 adds a NVMe storage controller, paravirt debug options, cpu profile.
     5696
     5697        if (   hardwareMachine.strParavirtDebug.isNotEmpty()
     5698            || (!hardwareMachine.strCpuProfile.equals("host") && hardwareMachine.strCpuProfile.isNotEmpty())
     5699           )
     5700        {
     5701            m->sv = SettingsVersion_v1_16;
     5702            return;
     5703        }
     5704
    56915705        for (StorageControllersList::const_iterator it = storageMachine.llStorageControllers.begin();
    56925706             it != storageMachine.llStorageControllers.end();
     
    57005714                return;
    57015715            }
    5702         }
    5703 
    5704         if (hardwareMachine.strParavirtDebug.isNotEmpty())
    5705         {
    5706             m->sv = SettingsVersion_v1_16;
    5707             return;
    57085716        }
    57095717    }
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