Changeset 89697 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jun 15, 2021 9:54:12 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145145
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageDebugVM.cpp
r82968 r89697 784 784 } 785 785 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 */ 793 static 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 786 846 RTEXITCODE handleDebugVM(HandlerArg *pArgs) 787 847 { … … 885 945 rcExit = handleDebugVM_Statistics(pArgs, ptrDebugger); 886 946 } 947 else if (!strcmp(pszSubCmd, "guestsample")) 948 { 949 setCurrentSubcommand(HELP_SCOPE_DEBUGVM_GUESTSAMPLE); 950 rcExit = handleDebugVM_GuestSample(pArgs, ptrDebugger); 951 } 887 952 else 888 953 errorUnknownSubcommand(pszSubCmd);
Note:
See TracChangeset
for help on using the changeset viewer.