VirtualBox

Changeset 89829 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jun 22, 2021 11:57:02 AM (4 years ago)
Author:
vboxsync
Message:

VMM/DBGFR3SampleReport: Sort the frame order by sample count to quickly see where the guest spents most of its time, bugref:10025

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFR3SampleReport.cpp

    r89786 r89829  
    4141#include <iprt/time.h>
    4242#include <iprt/timer.h>
     43#include <iprt/sort.h>
    4344#include <iprt/string.h>
    4445#include <iprt/stream.h>
     
    333334
    334335/**
     336 * @copydoc FNRTSORTCMP
     337 */
     338static DECLCALLBACK(int) dbgfR3SampleReportFrameSortCmp(void const *pvElement1, void const *pvElement2, void *pvUser)
     339{
     340    RT_NOREF(pvUser);
     341    PCDBGFSAMPLEFRAME pFrame1 = (PCDBGFSAMPLEFRAME)pvElement1;
     342    PCDBGFSAMPLEFRAME pFrame2 = (PCDBGFSAMPLEFRAME)pvElement2;
     343
     344    if (pFrame1->cSamples < pFrame2->cSamples)
     345        return 1;
     346    if (pFrame1->cSamples > pFrame2->cSamples)
     347        return -1;
     348
     349    return 0;
     350}
     351
     352
     353/**
    335354 * Dumps a single given frame to the release log.
    336355 *
     
    369388    else
    370389        pHlp->pfnPrintf(pHlp, "%*s%RU64 %RGv\n", idxFrame * 4, " ", pFrame->cSamples, pFrame->AddrFrame.FlatPtr);
     390
     391    /* Sort by sample count. */
     392    RTSortShell(pFrame->paFrames, pFrame->cFramesValid, sizeof(*pFrame->paFrames), dbgfR3SampleReportFrameSortCmp, NULL);
    371393
    372394    for (uint32_t i = 0; i < pFrame->cFramesValid; i++)
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