Changeset 64835 in vbox for trunk/src/VBox
- Timestamp:
- Dec 12, 2016 4:48:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r64727 r64835 414 414 /** @name Statistics. 415 415 * @{ */ 416 /** how many attempts were made to query a direct buffer pointer from the416 /** How many attempts were made to query a direct buffer pointer from the 417 417 * device/driver above. */ 418 418 STAMCOUNTER StatQueryBufAttempts; 419 419 /** How many attempts to query a direct buffer pointer succeeded. */ 420 420 STAMCOUNTER StatQueryBufSuccess; 421 /** Release statistics: number of bytes written. */ 422 STAMCOUNTER StatBytesWritten; 423 /** Release statistics: number of bytes read. */ 424 STAMCOUNTER StatBytesRead; 425 /** Release statistics: Number of requests submitted. */ 426 STAMCOUNTER StatReqsSubmitted; 427 /** Release statistics: Number of requests failed. */ 428 STAMCOUNTER StatReqsFailed; 429 /** Release statistics: Number of requests succeeded. */ 430 STAMCOUNTER StatReqsSucceeded; 431 /** Release statistics: Number of flush requests. */ 432 STAMCOUNTER StatReqsFlush; 433 /** Release statistics: Number of write requests. */ 434 STAMCOUNTER StatReqsWrite; 435 /** Release statistics: Number of read requests. */ 436 STAMCOUNTER StatReqsRead; 437 /** Release statistics: Number of discard requests. */ 438 STAMCOUNTER StatReqsDiscard; 439 /** Release statistics: Number of I/O requests processed per second. */ 440 STAMCOUNTER StatReqsPerSec; 421 441 /** @} */ 422 442 } VBOXDISK; … … 1891 1911 return rc; 1892 1912 1913 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 1914 STAM_REL_COUNTER_INC(&pThis->StatReqsRead); 1915 1893 1916 if (!pThis->fBootAccelActive) 1894 1917 rc = VDRead(pThis->pDisk, off, pvBuf, cbRead); … … 1926 1949 1927 1950 if (RT_SUCCESS(rc)) 1951 { 1952 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 1928 1953 Log2(("%s: off=%#llx pvBuf=%p cbRead=%d\n%.*Rhxd\n", __FUNCTION__, 1929 1954 off, pvBuf, cbRead, cbRead, pvBuf)); 1955 } 1956 else 1957 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 1958 1930 1959 LogFlowFunc(("returns %Rrc\n", rc)); 1931 1960 return rc; … … 2029 2058 } 2030 2059 2060 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 2061 STAM_REL_COUNTER_INC(&pThis->StatReqsWrite); 2062 2031 2063 rc = VDWrite(pThis->pDisk, off, pvBuf, cbWrite); 2032 2064 #ifdef VBOX_PERIODIC_FLUSH … … 2041 2073 } 2042 2074 #endif /* VBOX_PERIODIC_FLUSH */ 2075 2076 if (RT_SUCCESS(rc)) 2077 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 2078 else 2079 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 2043 2080 2044 2081 LogFlowFunc(("returns %Rrc\n", rc)); … … 2066 2103 #endif /* VBOX_IGNORE_FLUSH */ 2067 2104 2105 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 2106 STAM_REL_COUNTER_INC(&pThis->StatReqsFlush); 2107 2068 2108 int rc = VDFlush(pThis->pDisk); 2109 if (RT_SUCCESS(rc)) 2110 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 2111 else 2112 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 2113 2069 2114 LogFlowFunc(("returns %Rrc\n", rc)); 2070 2115 return rc; … … 2407 2452 PVBOXDISK pThis = PDMIMEDIA_2_VBOXDISK(pInterface); 2408 2453 2454 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 2455 STAM_REL_COUNTER_INC(&pThis->StatReqsDiscard); 2456 2409 2457 int rc = VDDiscardRanges(pThis->pDisk, paRanges, cRanges); 2458 if (RT_SUCCESS(rc)) 2459 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 2460 else 2461 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 2462 2410 2463 LogFlowFunc(("returns %Rrc\n", rc)); 2411 2464 return rc; … … 2832 2885 } 2833 2886 } 2887 2888 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 2889 } 2890 else 2891 { 2892 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 2893 2894 switch (pIoReq->enmType) 2895 { 2896 case PDMMEDIAEXIOREQTYPE_READ: 2897 STAM_REL_COUNTER_ADD(&pThis->StatBytesRead, pIoReq->ReadWrite.cbReq); 2898 break; 2899 case PDMMEDIAEXIOREQTYPE_WRITE: 2900 STAM_REL_COUNTER_ADD(&pThis->StatBytesWritten, pIoReq->ReadWrite.cbReq); 2901 break; 2902 default: 2903 break; 2904 } 2834 2905 } 2835 2906 … … 3579 3650 return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE; 3580 3651 3652 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 3653 STAM_REL_COUNTER_INC(&pThis->StatReqsRead); 3654 3581 3655 pIoReq->enmType = PDMMEDIAEXIOREQTYPE_READ; 3582 3656 pIoReq->tsSubmit = RTTimeMilliTS(); … … 3618 3692 return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE; 3619 3693 3694 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 3695 STAM_REL_COUNTER_INC(&pThis->StatReqsWrite); 3696 3620 3697 pIoReq->enmType = PDMMEDIAEXIOREQTYPE_WRITE; 3621 3698 pIoReq->tsSubmit = RTTimeMilliTS(); … … 3657 3734 return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE; 3658 3735 3736 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 3737 STAM_REL_COUNTER_INC(&pThis->StatReqsFlush); 3738 3659 3739 pIoReq->enmType = PDMMEDIAEXIOREQTYPE_FLUSH; 3660 3740 pIoReq->tsSubmit = RTTimeMilliTS(); … … 3694 3774 if (RT_UNLIKELY(enmState != VDIOREQSTATE_ALLOCATED)) 3695 3775 return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE; 3776 3777 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 3778 STAM_REL_COUNTER_INC(&pThis->StatReqsDiscard); 3696 3779 3697 3780 /* Copy the ranges over now, this can be optimized in the future. */ … … 4112 4195 } 4113 4196 4197 /** 4198 * Registers statistics associated with the given media driver. 4199 * 4200 * @returns VBox status code. 4201 * @param pThis The media driver instance. 4202 */ 4203 static int drvvdStatsRegister(PVBOXDISK pThis) 4204 { 4205 PPDMDRVINS pDrvIns = pThis->pDrvIns; 4206 uint32_t iInstance, iLUN; 4207 const char *pcszController; 4208 4209 int rc = pThis->pDrvMediaPort->pfnQueryDeviceLocation(pThis->pDrvMediaPort, &pcszController, 4210 &iInstance, &iLUN); 4211 if (RT_SUCCESS(rc)) 4212 { 4213 char *pszCtrlUpper = RTStrDup(pcszController); 4214 if (pszCtrlUpper) 4215 { 4216 RTStrToUpper(pszCtrlUpper); 4217 4218 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufAttempts, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 4219 STAMUNIT_COUNT, "Number of attempts to query a direct buffer.", 4220 "/Devices/%s%u/Port%u/QueryBufAttempts", pszCtrlUpper, iInstance, iLUN); 4221 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatQueryBufSuccess, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, 4222 STAMUNIT_COUNT, "Number of succeeded attempts to query a direct buffer.", 4223 "/Devices/%s%u/Port%u/QueryBufSuccess", pszCtrlUpper, iInstance, iLUN); 4224 4225 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, 4226 "Amount of data read.", "/Devices/%s%u/Port%u/ReadBytes", pszCtrlUpper, iInstance, iLUN); 4227 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, 4228 "Amount of data written.", "/Devices/%s%u/Port%u/WrittenBytes", pszCtrlUpper, iInstance, iLUN); 4229 4230 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4231 "Number of I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsSubmitted", pszCtrlUpper, iInstance, iLUN); 4232 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4233 "Number of I/O requests failed.", "/Devices/%s%u/Port%u/ReqsFailed", pszCtrlUpper, iInstance, iLUN); 4234 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSucceeded, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4235 "Number of I/O requests succeeded.", "/Devices/%s%u/Port%u/ReqsSucceeded", pszCtrlUpper, iInstance, iLUN); 4236 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFlush, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4237 "Number of flush I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsFlush", pszCtrlUpper, iInstance, iLUN); 4238 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsWrite, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4239 "Number of write I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsWrite", pszCtrlUpper, iInstance, iLUN); 4240 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4241 "Number of read I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsRead", pszCtrlUpper, iInstance, iLUN); 4242 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsDiscard, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 4243 "Number of discard I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsDiscard", pszCtrlUpper, iInstance, iLUN); 4244 4245 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsPerSec, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 4246 "Number of processed I/O requests per second.", "/Devices/%s%u/Port%u/ReqsPerSec", 4247 pszCtrlUpper, iInstance, iLUN); 4248 4249 RTStrFree(pszCtrlUpper); 4250 } 4251 else 4252 rc = VERR_NO_STR_MEMORY; 4253 } 4254 4255 return rc; 4256 } 4257 4258 /** 4259 * Deregisters statistics associated with the given media driver. 4260 * 4261 * @returns nothing. 4262 * @param pThis The media driver instance. 4263 */ 4264 static void drvvdStatsDeregister(PVBOXDISK pThis) 4265 { 4266 PPDMDRVINS pDrvIns = pThis->pDrvIns; 4267 4268 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatQueryBufAttempts); 4269 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatQueryBufSuccess); 4270 4271 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatBytesRead); 4272 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatBytesWritten); 4273 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsSubmitted); 4274 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsFailed); 4275 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsSucceeded); 4276 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsFlush); 4277 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsWrite); 4278 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsRead); 4279 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsDiscard); 4280 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsPerSec); 4281 } 4114 4282 4115 4283 /********************************************************************************************************************************* … … 4415 4583 RTSemFastMutexDestroy(pThis->aIoReqAllocBins[i].hMtxLstIoReqAlloc); 4416 4584 4417 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatQueryBufAttempts); 4418 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatQueryBufSuccess); 4585 drvvdStatsDeregister(pThis); 4419 4586 } 4420 4587 … … 5408 5575 } /* !fEmptyDrive */ 5409 5576 5410 PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->StatQueryBufAttempts, "QueryBufAttempts", 5411 STAMUNIT_COUNT, "Number of attempts to query a direct buffer."); 5412 PDMDrvHlpSTAMRegCounterEx(pDrvIns, &pThis->StatQueryBufSuccess, "QueryBufSuccess", 5413 STAMUNIT_COUNT, "Number of succeeded attempts to query a direct buffer."); 5577 if (RT_SUCCESS(rc)) 5578 drvvdStatsRegister(pThis); 5414 5579 5415 5580 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.