VirtualBox

Changeset 88666 in vbox


Ignore:
Timestamp:
Apr 22, 2021 11:43:03 PM (4 years ago)
Author:
vboxsync
Message:

DrvAudio: Use PDMDrvHlpSTAMDeregisterByPrefix to deregister statistics for a stream. bugref:9890

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r88561 r88666  
    29172917
    29182918#ifdef VBOX_WITH_STATISTICS
    2919     char szStatName[255];
    29202919    if (pCfgGuest->enmDir == PDMAUDIODIR_IN)
    29212920    {
    2922         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesCaptured", pStreamEx->Core.szName);
    2923         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->In.Stats.TotalFramesCaptured,
    2924                                   szStatName, STAMUNIT_COUNT, "Total frames played.");
    2925         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesCaptured", pStreamEx->Core.szName);
    2926         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->In.Stats.TotalTimesCaptured,
    2927                                   szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
    2928         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesRead", pStreamEx->Core.szName);
    2929         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->In.Stats.TotalFramesRead,
    2930                                   szStatName, STAMUNIT_COUNT, "Total frames read.");
    2931         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesRead", pStreamEx->Core.szName);
    2932         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->In.Stats.TotalTimesRead,
    2933                                   szStatName, STAMUNIT_COUNT, "Total number of reads.");
     2921        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalFramesCaptured, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2922                               "Total frames played.", "%s/TotalFramesCaptured", pStreamEx->Core.szName);
     2923        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalTimesCaptured, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2924                               "Total number of playbacks.", "%s/TotalTimesCaptured", pStreamEx->Core.szName);
     2925        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalFramesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2926                               "Total frames read.", "%s/TotalFramesRead", pStreamEx->Core.szName);
     2927        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->In.Stats.TotalTimesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2928                               "Total number of reads.", "%s/TotalTimesRead", pStreamEx->Core.szName);
    29342929    }
    29352930    else
    29362931    {
    29372932        Assert(pCfgGuest->enmDir == PDMAUDIODIR_OUT);
    2938         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesPlayed", pStreamEx->Core.szName);
    2939         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->Out.Stats.TotalFramesPlayed,
    2940                                   szStatName, STAMUNIT_COUNT, "Total frames played.");
    2941 
    2942         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesPlayed", pStreamEx->Core.szName);
    2943         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->Out.Stats.TotalTimesPlayed,
    2944                                   szStatName, STAMUNIT_COUNT, "Total number of playbacks.");
    2945         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalFramesWritten", pStreamEx->Core.szName);
    2946         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->Out.Stats.TotalFramesWritten,
    2947                                   szStatName, STAMUNIT_COUNT, "Total frames written.");
    2948 
    2949         RTStrPrintf(szStatName, sizeof(szStatName), "Guest/%s/TotalTimesWritten", pStreamEx->Core.szName);
    2950         PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pStreamEx->Out.Stats.TotalTimesWritten,
    2951                                   szStatName, STAMUNIT_COUNT, "Total number of writes.");
     2933        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.TotalFramesPlayed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2934                               "Total frames played.", "%s/TotalFramesPlayed", pStreamEx->Core.szName);
     2935        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.TotalTimesPlayed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2936                               "Total number of playbacks.", "%s/TotalTimesPlayed", pStreamEx->Core.szName);
     2937        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.TotalFramesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2938                               "Total frames written.", "%s/TotalFramesWritten", pStreamEx->Core.szName);
     2939        PDMDrvHlpSTAMRegisterF(pDrvIns, &pStreamEx->Out.Stats.TotalTimesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_NONE,
     2940                               "Total number of writes.", "%s/TotalTimesWritten", pStreamEx->Core.szName);
    29522941    }
    29532942#endif /* VBOX_WITH_STATISTICS */
     
    35323521
    35333522    PPDMDRVINS const pDrvIns = pThis->pDrvIns;
     3523    PDMDrvHlpSTAMDeregisterByPrefix(pDrvIns, pStreamEx->Core.szName);
     3524
    35343525    if (pStreamEx->Core.enmDir == PDMAUDIODIR_IN)
    35353526    {
    3536 #ifdef VBOX_WITH_STATISTICS
    3537         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->In.Stats.TotalFramesCaptured);
    3538         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->In.Stats.TotalTimesCaptured);
    3539         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->In.Stats.TotalFramesRead);
    3540         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->In.Stats.TotalTimesRead);
    3541 #endif
    35423527        if (pThis->In.Cfg.Dbg.fEnabled)
    35433528        {
     
    35483533            pStreamEx->In.Dbg.pFileStreamRead = NULL;
    35493534        }
    3550         if (!pStreamEx->fNoMixBufs)
    3551         {
    3552             PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Host.MixBuf.cMixed);
    3553             PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Guest.MixBuf.cUsed);
    3554         }
    35553535    }
    35563536    else
    35573537    {
    35583538        Assert(pStreamEx->Core.enmDir == PDMAUDIODIR_OUT);
    3559 #ifdef VBOX_WITH_STATISTICS
    3560         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.TotalFramesPlayed);
    3561         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.TotalTimesPlayed);
    3562         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.TotalFramesWritten);
    3563         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.TotalTimesWritten);
    3564 #endif
    35653539        if (pThis->Out.Cfg.Dbg.fEnabled)
    35663540        {
     
    35713545            pStreamEx->Out.Dbg.pFileStreamWrite = NULL;
    35723546        }
    3573         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.cbBackendWritableAfter);
    3574         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Out.Stats.cbBackendWritableBefore);
    3575         if (!pStreamEx->fNoMixBufs)
    3576         {
    3577             PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Host.MixBuf.cUsed);
    3578             PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Guest.MixBuf.cMixed);
    3579         }
    3580     }
    3581     PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Host.Cfg.Backend.cFramesBufferSize);
    3582     if (!pStreamEx->fNoMixBufs)
    3583     {
    3584         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Host.MixBuf.cFrames);
    3585         PDMDrvHlpSTAMDeregister(pDrvIns, &pStreamEx->Guest.MixBuf.cFrames);
    3586     }
    3587 
     3547    }
    35883548    LogFlowFunc(("Returning %Rrc\n", rc));
    35893549    return rc;
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