Changeset 89696 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 15, 2021 9:53:06 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145144
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r87278 r89696 20584 20584 uuid="00ae6af4-00a7-4104-0009-49bc00b2da80" 20585 20585 wsmap="managed" 20586 reservedMethods="1 6" reservedAttributes="16"20586 reservedMethods="15" reservedAttributes="16" 20587 20587 > 20588 20588 <method name="dumpGuestCore"> … … 20972 20972 <param name="msInterval" type="long long" dir="return"> 20973 20973 <desc>The interval the percentage was calculated over in milliseconds</desc> 20974 </param> 20975 </method> 20976 20977 <method name="takeGuestSample"> 20978 <desc> 20979 Creates a sample report of the guest and emulated device activity. 20980 </desc> 20981 <param name="filename" type="wstring" dir="in"> 20982 <desc>The file to dump the report to.</desc> 20983 </param> 20984 <param name="usInterval" type="unsigned long" dir="in"> 20985 <desc>The sample interval.</desc> 20986 </param> 20987 <param name="usSampleTime" type="long long" dir="in"> 20988 <desc>The number of microseconds to sample.</desc> 20989 </param> 20990 <param name="progress" type="IProgress" dir="return"> 20991 <desc>The progress object on return.</desc> 20974 20992 </param> 20975 20993 </method> -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r85121 r89696 27 27 28 28 class Console; 29 class Progress; 29 30 30 31 class ATL_NO_VTABLE MachineDebugger : … … 134 135 com::Utf8Str &aStats); 135 136 HRESULT getCPULoad(ULONG aCpuId, ULONG *aPctExecuting, ULONG *aPctHalted, ULONG *aPctOther, LONG64 *aMsInterval) RT_OVERRIDE; 137 HRESULT takeGuestSample(const com::Utf8Str &aFilename, ULONG aUsInterval, LONG64 aUsSampleTime, ComPtr<IProgress> &pProgress); 136 138 137 139 // private methods … … 145 147 typedef FNLOGGETSTR *PFNLOGGETSTR; 146 148 HRESULT i_logStringProps(PRTLOGGER pLogger, PFNLOGGETSTR pfnLogGetStr, const char *pszLogGetStr, Utf8Str *pstrSettings); 149 150 static DECLCALLBACK(int) i_dbgfProgressCallback(void *pvUser, unsigned uPercentage); 147 151 148 152 Console * const mParent; … … 160 164 bool mFlushMode; 161 165 /** @} */ 166 167 /** @name Sample report related things. 168 * @{ */ 169 /** Sample report handle. */ 170 DBGFSAMPLEREPORT m_hSampleReport; 171 /** Progress object for the currently taken guest sample. */ 172 ComObjPtr<Progress> m_Progress; 173 /** Filename to dump the report to. */ 174 com::Utf8Str m_strFilename; 175 /** @} */ 162 176 }; 163 177 -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r82968 r89696 27 27 #include "Global.h" 28 28 #include "ConsoleImpl.h" 29 #include "ProgressImpl.h" 29 30 30 31 #include "AutoCaller.h" … … 94 95 mFlushMode = false; 95 96 97 m_hSampleReport = NULL; 98 96 99 /* Confirm a successful initialization */ 97 100 autoInitSpan.setSucceeded(); … … 115 118 unconst(mParent) = NULL; 116 119 mFlushMode = false; 120 } 121 122 /** 123 * @callback_method_impl{FNDBGFPROGRESS} 124 */ 125 /*static*/ DECLCALLBACK(int) MachineDebugger::i_dbgfProgressCallback(void *pvUser, unsigned uPercentage) 126 { 127 MachineDebugger *pThis = (MachineDebugger *)pvUser; 128 129 int vrc = pThis->m_Progress->i_iprtProgressCallback(uPercentage, static_cast<Progress *>(pThis->m_Progress)); 130 if ( RT_SUCCESS(vrc) 131 && uPercentage == 100) 132 { 133 vrc = DBGFR3SampleReportDumpToFile(pThis->m_hSampleReport, pThis->m_strFilename.c_str()); 134 DBGFR3SampleReportRelease(pThis->m_hSampleReport); 135 pThis->m_hSampleReport = NULL; 136 if (RT_SUCCESS(vrc)) 137 pThis->m_Progress->i_notifyComplete(S_OK); 138 else 139 { 140 HRESULT hrc = pThis->setError(VBOX_E_IPRT_ERROR, 141 tr("Writing the sample report to '%s' failed with %Rrc"), 142 pThis->m_strFilename.c_str(), vrc); 143 pThis->m_Progress->i_notifyComplete(hrc); 144 } 145 pThis->m_Progress.setNull(); 146 } 147 else if (vrc == VERR_CANCELLED) 148 vrc = VERR_DBGF_CANCELLED; 149 150 return vrc; 117 151 } 118 152 … … 1592 1626 1593 1627 1628 HRESULT MachineDebugger::takeGuestSample(const com::Utf8Str &aFilename, ULONG aUsInterval, LONG64 aUsSampleTime, ComPtr<IProgress> &pProgress) 1629 { 1630 /* 1631 * The prologue. 1632 */ 1633 LogFlowThisFunc(("\n")); 1634 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1635 Console::SafeVMPtr ptrVM(mParent); 1636 HRESULT hrc = ptrVM.rc(); 1637 if (SUCCEEDED(hrc)) 1638 { 1639 if (!m_hSampleReport) 1640 { 1641 m_strFilename = aFilename; 1642 1643 int vrc = DBGFR3SampleReportCreate(ptrVM.rawUVM(), aUsInterval, DBGF_SAMPLE_REPORT_F_STACK_REVERSE, &m_hSampleReport); 1644 if (RT_SUCCESS(vrc)) 1645 { 1646 hrc = m_Progress.createObject(); 1647 if (SUCCEEDED(hrc)) 1648 { 1649 hrc = m_Progress->init(static_cast<IMachineDebugger*>(this), 1650 tr("Creating guest sample report..."), 1651 TRUE /* aCancelable */); 1652 if (SUCCEEDED(hrc)) 1653 { 1654 vrc = DBGFR3SampleReportStart(m_hSampleReport, aUsSampleTime, i_dbgfProgressCallback, static_cast<MachineDebugger*>(this)); 1655 if (RT_SUCCESS(vrc)) 1656 hrc = m_Progress.queryInterfaceTo(pProgress.asOutParam()); 1657 else 1658 hrc = setErrorVrc(vrc); 1659 } 1660 } 1661 1662 if (FAILED(hrc)) 1663 { 1664 DBGFR3SampleReportRelease(m_hSampleReport); 1665 m_hSampleReport = NULL; 1666 } 1667 } 1668 else 1669 hrc = setErrorVrc(vrc); 1670 } 1671 else 1672 hrc = setError(VBOX_E_INVALID_VM_STATE, "A sample report is already in progress"); 1673 } 1674 1675 return hrc; 1676 } 1677 1678 1594 1679 // public methods only for internal purposes 1595 1680 /////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.