VirtualBox

Changeset 89697 in vbox


Ignore:
Timestamp:
Jun 15, 2021 9:54:12 AM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145145
Message:

FE/VBoxManage: Add guestsample sub-command for debugvm, bugref:10025

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/man_VBoxManage-debugvm.xml

    r84600 r89697  
    122122      <arg>--descriptions</arg>
    123123      <arg>--pattern=<replaceable>pattern</replaceable></arg>
     124    </cmdsynopsis>
     125    <cmdsynopsis id="synopsis-vboxmanage-debugvm-guestsample">
     126      <command>VBoxManage debugvm</command>
     127      <arg choice="req"><replaceable>uuid|vmname</replaceable></arg>
     128      <arg choice="plain">guestsample</arg>
     129      <arg>--filename=<replaceable>filename</replaceable></arg>
     130      <arg>--sample-interval-us=<replaceable>interval</replaceable></arg>
     131      <arg>--sample-time-us=<replaceable>time</replaceable></arg>
    124132    </cmdsynopsis>
    125133  </refsynopsisdiv>
     
    610618    </refsect2>
    611619
     620    <refsect2 id="vboxmanage-debugvm-guestsample">
     621      <title>debugvm guestsample</title>
     622      <remark role="help-copy-synopsis"/>
     623      <para>
     624        Creates a sample report of the guest activity.
     625      </para>
     626      <para>
     627        Retrieves the filename to dump the report to.
     628      </para>
     629      <variablelist>
     630        <varlistentry>
     631          <term><option>--filename=<replaceable>filename</replaceable></option></term>
     632          <listitem><para>The filename to dump the sample report to.</para>
     633          </listitem>
     634        </varlistentry>
     635        <varlistentry>
     636          <term><option>--sample-interval-us=<replaceable>interval</replaceable></option></term>
     637          <listitem><para>The interval in microseconds between guest samples.</para>
     638          </listitem>
     639        </varlistentry>
     640        <varlistentry>
     641          <term><option>--sample-time-us=<replaceable>time</replaceable></option></term>
     642          <listitem><para>The amount of microseconds to take guest samples.</para>
     643          </listitem>
     644        </varlistentry>
     645      </variablelist>
     646
     647    </refsect2>
     648
    612649  </refsect1>
    613650
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp

    r82968 r89697  
    784784}
    785785
     786/**
     787 * Handles the guestsample sub-command.
     788 *
     789 * @returns Suitable exit code.
     790 * @param   pArgs               The handler arguments.
     791 * @param   pDebugger           Pointer to the debugger interface.
     792 */
     793static RTEXITCODE handleDebugVM_GuestSample(HandlerArg *pArgs, IMachineDebugger *pDebugger)
     794{
     795    /*
     796     * Parse arguments.
     797     */
     798    const char                 *pszFilename         = NULL;
     799    uint32_t                   cSampleIntervalUs    = 1000;
     800    uint64_t                   cSampleTimeUs        = 1000*1000;
     801
     802    RTGETOPTSTATE               GetState;
     803    RTGETOPTUNION               ValueUnion;
     804    static const RTGETOPTDEF    s_aOptions[] =
     805    {
     806        { "--filename",           'f', RTGETOPT_REQ_STRING },
     807        { "--sample-interval-us", 'i', RTGETOPT_REQ_UINT32 },
     808        { "--sample-time-us",     't', RTGETOPT_REQ_UINT64 },
     809    };
     810    int rc = RTGetOptInit(&GetState, pArgs->argc, pArgs->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 2, 0 /*fFlags*/);
     811    AssertRCReturn(rc, RTEXITCODE_FAILURE);
     812
     813    while ((rc = RTGetOpt(&GetState, &ValueUnion)) != 0)
     814    {
     815        switch (rc)
     816        {
     817            case 'f':
     818                pszFilename = ValueUnion.psz;
     819                break;
     820            case 'i':
     821                cSampleIntervalUs = ValueUnion.u32;
     822                break;
     823            case 't':
     824                cSampleTimeUs = ValueUnion.u64;
     825                break;
     826
     827            default:
     828                return errorGetOpt(rc, &ValueUnion);
     829        }
     830    }
     831
     832    if (!pszFilename)
     833        return errorSyntax("The --filename is missing");
     834
     835    /*
     836     * Execute the order.
     837     */
     838    ComPtr<IProgress> ptrProgress;
     839    com::Bstr bstrFilename(pszFilename);
     840    CHECK_ERROR2I_RET(pDebugger, TakeGuestSample(bstrFilename.raw(), cSampleIntervalUs, cSampleTimeUs, ptrProgress.asOutParam()), RTEXITCODE_FAILURE);
     841    showProgress(ptrProgress);
     842
     843    return RTEXITCODE_SUCCESS;
     844}
     845
    786846RTEXITCODE handleDebugVM(HandlerArg *pArgs)
    787847{
     
    885945                    rcExit = handleDebugVM_Statistics(pArgs, ptrDebugger);
    886946                }
     947                else if (!strcmp(pszSubCmd, "guestsample"))
     948                {
     949                    setCurrentSubcommand(HELP_SCOPE_DEBUGVM_GUESTSAMPLE);
     950                    rcExit = handleDebugVM_GuestSample(pArgs, ptrDebugger);
     951                }
    887952                else
    888953                    errorUnknownSubcommand(pszSubCmd);
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