VirtualBox

Changeset 82130 in vbox


Ignore:
Timestamp:
Nov 23, 2019 5:28:44 PM (5 years ago)
Author:
vboxsync
Message:

DrvVD: Moved the statistics to /Public/Storage/ to make them official (GUI uses them) and easier to find.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r80590 r82130  
    40604060{
    40614061    PPDMDRVINS pDrvIns = pThis->pDrvIns;
    4062     uint32_t iInstance, iLUN;
    4063     const char *pcszController;
    4064 
    4065     int rc = pThis->pDrvMediaPort->pfnQueryDeviceLocation(pThis->pDrvMediaPort, &pcszController,
    4066                                                           &iInstance, &iLUN);
    4067     if (RT_SUCCESS(rc))
    4068     {
    4069         char *pszCtrlUpper = RTStrDup(pcszController);
    4070         if (pszCtrlUpper)
    4071         {
    4072             RTStrToUpper(pszCtrlUpper);
    4073 
    4074             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufAttempts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS,
    4075                                    STAMUNIT_COUNT, "Number of attempts to query a direct buffer.",
    4076                                    "/Devices/%s%u/Port%u/QueryBufAttempts", pszCtrlUpper, iInstance, iLUN);
    4077             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufSuccess, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS,
    4078                                    STAMUNIT_COUNT, "Number of succeeded attempts to query a direct buffer.",
    4079                                    "/Devices/%s%u/Port%u/QueryBufSuccess", pszCtrlUpper, iInstance, iLUN);
    4080 
    4081             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES,
    4082                                    "Amount of data read.", "/Devices/%s%u/Port%u/ReadBytes", pszCtrlUpper, iInstance, iLUN);
    4083             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES,
    4084                                    "Amount of data written.", "/Devices/%s%u/Port%u/WrittenBytes", pszCtrlUpper, iInstance, iLUN);
    4085 
    4086             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4087                                    "Number of I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsSubmitted", pszCtrlUpper, iInstance, iLUN);
    4088             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4089                                    "Number of I/O requests failed.", "/Devices/%s%u/Port%u/ReqsFailed", pszCtrlUpper, iInstance, iLUN);
    4090             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSucceeded, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4091                                    "Number of I/O requests succeeded.", "/Devices/%s%u/Port%u/ReqsSucceeded", pszCtrlUpper, iInstance, iLUN);
    4092             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFlush, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4093                                    "Number of flush I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsFlush", pszCtrlUpper, iInstance, iLUN);
    4094             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsWrite, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4095                                    "Number of write I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsWrite", pszCtrlUpper, iInstance, iLUN);
    4096             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4097                                    "Number of read I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsRead", pszCtrlUpper, iInstance, iLUN);
    4098             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsDiscard, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
    4099                                    "Number of discard I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsDiscard", pszCtrlUpper, iInstance, iLUN);
    4100 
    4101             PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsPerSec, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    4102                                    "Number of processed I/O requests per second.", "/Devices/%s%u/Port%u/ReqsPerSec",
    4103                                    pszCtrlUpper, iInstance, iLUN);
    4104 
    4105             RTStrFree(pszCtrlUpper);
    4106         }
    4107         else
    4108             rc = VERR_NO_STR_MEMORY;
    4109     }
    4110 
    4111     return rc;
     4062
     4063    /*
     4064     * Figure out where to place the stats.
     4065     */
     4066    uint32_t iInstance = 0;
     4067    uint32_t iLUN = 0;
     4068    const char *pcszController = NULL;
     4069    int rc = pThis->pDrvMediaPort->pfnQueryDeviceLocation(pThis->pDrvMediaPort, &pcszController, &iInstance, &iLUN);
     4070    AssertRCReturn(rc, rc);
     4071
     4072    /*
     4073     * Compose the prefix for the statistics to reduce the amount of repetition below.
     4074     * The /Public/ bits are official and used by session info in the GUI.
     4075     */
     4076    char szCtrlUpper[32];
     4077    rc = RTStrCopy(szCtrlUpper, sizeof(szCtrlUpper), pcszController);
     4078    AssertRCReturn(rc, rc);
     4079
     4080    RTStrToUpper(szCtrlUpper);
     4081    char szPrefix[128];
     4082    RTStrPrintf(szPrefix, sizeof(szPrefix), "/Public/Storage/%s%u/Port%u", szCtrlUpper, iInstance, iLUN);
     4083
     4084    /*
     4085     * Do the registrations.
     4086     */
     4087    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufAttempts,   STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     4088                           "Number of attempts to query a direct buffer.",              "%s/QueryBufAttempts", szPrefix);
     4089    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufSuccess,    STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
     4090                           "Number of succeeded attempts to query a direct buffer.",    "%s/QueryBufSuccess", szPrefix);
     4091
     4092    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead,          STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES,
     4093                           "Amount of data read.",                          "%s/BytesRead", szPrefix);
     4094    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten,       STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES,
     4095                           "Amount of data written.",                       "%s/BytesWritten", szPrefix);
     4096
     4097    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSubmitted,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4098                           "Number of I/O requests submitted.",             "%s/ReqsSubmitted", szPrefix);
     4099    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFailed,         STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4100                           "Number of I/O requests failed.",                "%s/ReqsFailed", szPrefix);
     4101    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSucceeded,      STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4102                           "Number of I/O requests succeeded.",             "%s/ReqsSucceeded", szPrefix);
     4103    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFlush,          STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4104                           "Number of flush I/O requests submitted.",       "%s/ReqsFlush", szPrefix);
     4105    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsWrite,          STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4106                           "Number of write I/O requests submitted.",       "%s/ReqsWrite", szPrefix);
     4107    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsRead,           STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4108                           "Number of read I/O requests submitted.",        "%s/ReqsRead", szPrefix);
     4109    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsDiscard,        STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT,
     4110                           "Number of discard I/O requests submitted.",     "%s/ReqsDiscard", szPrefix);
     4111
     4112    PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsPerSec,         STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     4113                           "Number of processed I/O requests per second.",  "%s/ReqsPerSec", szPrefix);
     4114
     4115    return VINF_SUCCESS;
    41124116}
    41134117
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