Changeset 89695 in vbox
- Timestamp:
- Jun 15, 2021 9:51:59 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145143
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r88819 r89695 361 361 /** The breakpoint owner callback returned an invalid status code. */ 362 362 #define VERR_DBGF_BP_OWNER_CALLBACK_WRONG_STATUS (-1240) 363 /** The operation was cancelled. */ 364 #define VERR_DBGF_CANCELLED (-1241) 363 365 /** @} */ 364 366 -
trunk/src/VBox/VMM/Makefile.kmk
r89622 r89695 119 119 VMMR3/DBGFR3Trace.cpp \ 120 120 $(if-expr defined(VBOX_WITH_DBGF_TRACING), VMMR3/DBGFR3Tracer.cpp,) \ 121 $(if-expr defined(VBOX_WITH_DBGF_SAMPLE_REPORT), VMMR3/DBGFR3SampleReport.cpp,)\121 VMMR3/DBGFR3SampleReport.cpp \ 122 122 VMMR3/DBGFR3Type.cpp \ 123 123 VMMR3/EM.cpp \ -
trunk/src/VBox/VMM/VMMR3/DBGFR3SampleReport.cpp
r89683 r89695 42 42 #include <iprt/timer.h> 43 43 #include <iprt/string.h> 44 #include <iprt/stream.h> 44 45 45 46 … … 132 133 /** Number of microseconds left for sampling. */ 133 134 uint64_t cSampleUsLeft; 135 /** The report created after sampling was stopped. */ 136 char *pszReport; 134 137 /** Array of per VCPU samples collected. */ 135 138 DBGFSAMPLEREPORTVCPU aCpus[1]; … … 331 334 * 332 335 * @returns nothing. 336 * @param pHlp The debug info helper used for printing. 333 337 * @param pUVM The usermode VM handle. 334 338 * @param pFrame The frame to dump. 335 339 * @param idxFrame The frame number. 336 340 */ 337 static void dbgfR3SampleReportDumpFrame(P UVM pUVM, PCDBGFSAMPLEFRAME pFrame, uint32_t idxFrame)341 static void dbgfR3SampleReportDumpFrame(PCDBGFINFOHLP pHlp, PUVM pUVM, PCDBGFSAMPLEFRAME pFrame, uint32_t idxFrame) 338 342 { 339 343 RTGCINTPTR offDisp; … … 350 354 const char *pszModName = hMod != NIL_RTDBGMOD ? RTDbgModName(hMod) : NULL; 351 355 352 LogRel(("%*s%RU64 %s+%llx (%s) [%RGv]\n", idxFrame * 4, " ", 353 pFrame->cSamples, 354 SymPC.szName, offDisp, 355 hMod ? pszModName : "", 356 pFrame->AddrFrame.FlatPtr)); 356 pHlp->pfnPrintf(pHlp, 357 "%*s%RU64 %s+%llx (%s) [%RGv]\n", idxFrame * 4, " ", 358 pFrame->cSamples, 359 SymPC.szName, offDisp, 360 hMod ? pszModName : "", 361 pFrame->AddrFrame.FlatPtr); 357 362 RTDbgModRelease(hMod); 358 363 } 359 364 else 360 LogRel(("%*s%RU64 %RGv\n", idxFrame * 4, " ", pFrame->cSamples, pFrame->AddrFrame.FlatPtr));365 pHlp->pfnPrintf(pHlp, "%*s%RU64 %RGv\n", idxFrame * 4, " ", pFrame->cSamples, pFrame->AddrFrame.FlatPtr); 361 366 } 362 367 else 363 LogRel(("%*s%RU64 %RGv\n", idxFrame * 4, " ", pFrame->cSamples, pFrame->AddrFrame.FlatPtr));368 pHlp->pfnPrintf(pHlp, "%*s%RU64 %RGv\n", idxFrame * 4, " ", pFrame->cSamples, pFrame->AddrFrame.FlatPtr); 364 369 365 370 for (uint32_t i = 0; i < pFrame->cFramesValid; i++) 366 dbgfR3SampleReportDumpFrame(p UVM, &pFrame->paFrames[i], idxFrame + 1);371 dbgfR3SampleReportDumpFrame(pHlp, pUVM, &pFrame->paFrames[i], idxFrame + 1); 367 372 } 368 373 … … 441 446 pThis->hTimer = NULL; 442 447 443 #if 1 448 DBGFSAMPLEREPORTINFOHLP Hlp; 449 PCDBGFINFOHLP pHlp = &Hlp.Core; 450 451 dbgfR3SampleReportInfoHlpInit(&Hlp); 452 444 453 /* Some early dump code. */ 445 454 for (uint32_t i = 0; i < pThis->pUVM->cCpus; i++) … … 447 456 PCDBGFSAMPLEREPORTVCPU pSampleVCpu = &pThis->aCpus[i]; 448 457 449 LogRel(("Sample report for vCPU %u:\n", i));450 dbgfR3SampleReportDumpFrame(p This->pUVM, &pSampleVCpu->FrameRoot, 0);458 pHlp->pfnPrintf(pHlp, "Sample report for vCPU %u:\n", i); 459 dbgfR3SampleReportDumpFrame(pHlp, pThis->pUVM, &pSampleVCpu->FrameRoot, 0); 451 460 } 452 453 DBGFSAMPLEREPORTINFOHLP Hlp;454 PCDBGFINFOHLP pHlp = &Hlp.Core;455 456 dbgfR3SampleReportInfoHlpInit(&Hlp);457 461 458 462 /* Shameless copy from VMMGuruMeditation.cpp */ … … 494 498 "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); 495 499 496 LogRel(("%s", Hlp.pachBuf)); 500 if (pThis->pszReport) 501 RTMemFree(pThis->pszReport); 502 pThis->pszReport = Hlp.pachBuf; 497 503 dbgfR3SampleReportInfoHlpDelete(&Hlp); 498 #endif 504 505 ASMAtomicXchgU32((volatile uint32_t *)&pThis->enmState, DBGFSAMPLEREPORTSTATE_READY); 499 506 500 507 if (pThis->pfnProgress) … … 505 512 } 506 513 507 ASMAtomicXchgU32((volatile uint32_t *)&pThis->enmState, DBGFSAMPLEREPORTSTATE_READY);508 514 DBGFR3SampleReportRelease(pThis); 509 515 } … … 617 623 * @returns New reference count, on 0 the sample report instance is destroyed. 618 624 * @param hSample Sample report handle. 619 *620 * @note Can't be called from the progress callback passed during creation.621 625 */ 622 626 VMMR3DECL(uint32_t) DBGFR3SampleReportRelease(DBGFSAMPLEREPORT hSample) … … 718 722 * 719 723 * @returns VBox status code. 724 * @retval VERR_INVALID_STATE if nothing was sampled so far for reporting. 720 725 * @param hSample Sample report handle. 721 726 * @param pszFilename The filename to dump the report to. … … 723 728 VMMR3DECL(int) DBGFR3SampleReportDumpToFile(DBGFSAMPLEREPORT hSample, const char *pszFilename) 724 729 { 725 RT_NOREF(hSample, pszFilename); 726 return VINF_SUCCESS; 727 } 728 730 PDBGFSAMPLEREPORTINT pThis = hSample; 731 732 AssertReturn(pThis->pszReport, VERR_INVALID_STATE); 733 734 PRTSTREAM hStream; 735 int rc = RTStrmOpen(pszFilename, "w", &hStream); 736 if (RT_SUCCESS(rc)) 737 { 738 rc = RTStrmPutStr(hStream, pThis->pszReport); 739 RTStrmClose(hStream); 740 } 741 742 return rc; 743 } 744
Note:
See TracChangeset
for help on using the changeset viewer.