- Timestamp:
- Dec 12, 2016 5:32:06 PM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r64407 r64839 51 51 RTCritSectEnter(&pThis->CritSect); 52 52 53 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 54 STAM_REL_COUNTER_INC(&pThis->StatReqsRead); 55 53 56 /* 54 57 * Check the state. … … 74 77 else 75 78 rc = VERR_MEDIA_NOT_PRESENT; 79 80 if (RT_SUCCESS(rc)) 81 { 82 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 83 STAM_REL_COUNTER_ADD(&pThis->StatBytesRead, cbRead); 84 } 85 else 86 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 76 87 77 88 RTCritSectLeave(&pThis->CritSect); … … 91 102 pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, off, cbWrite, cbWrite, pvBuf)); 92 103 RTCritSectEnter(&pThis->CritSect); 104 105 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 106 STAM_REL_COUNTER_INC(&pThis->StatReqsWrite); 93 107 94 108 /* … … 115 129 rc = VERR_WRITE_PROTECT; 116 130 131 if (RT_SUCCESS(rc)) 132 { 133 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 134 STAM_REL_COUNTER_ADD(&pThis->StatBytesWritten, cbWrite); 135 } 136 else 137 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 138 117 139 RTCritSectLeave(&pThis->CritSect); 118 140 LogFlow(("%s-%d: drvHostBaseWrite: returns %Rrc\n", pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, rc)); … … 130 152 RTCritSectEnter(&pThis->CritSect); 131 153 154 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 155 STAM_REL_COUNTER_INC(&pThis->StatReqsFlush); 156 132 157 if (pThis->fMediaPresent) 133 158 rc = drvHostBaseFlushOs(pThis); 134 159 else 135 160 rc = VERR_MEDIA_NOT_PRESENT; 161 162 if (RT_SUCCESS(rc)) 163 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 164 else 165 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 136 166 137 167 RTCritSectLeave(&pThis->CritSect); … … 460 490 pReq->cbReq = cbRead; 461 491 pReq->cbResidual = cbRead; 492 493 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 494 STAM_REL_COUNTER_INC(&pThis->StatReqsRead); 462 495 463 496 /* … … 498 531 rc = VERR_MEDIA_NOT_PRESENT; 499 532 533 if (RT_SUCCESS(rc)) 534 { 535 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 536 STAM_REL_COUNTER_INC(&pThis->StatBytesRead); 537 } 538 else 539 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 540 500 541 RTCritSectLeave(&pThis->CritSect); 501 542 LogFlow(("%s-%d: drvHostBaseIoReqRead: returns %Rrc\n", pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, rc)); … … 514 555 pReq->cbReq = cbWrite; 515 556 pReq->cbResidual = cbWrite; 557 558 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 559 STAM_REL_COUNTER_INC(&pThis->StatReqsWrite); 516 560 517 561 /* … … 550 594 rc = VERR_WRITE_PROTECT; 551 595 596 if (RT_SUCCESS(rc)) 597 { 598 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 599 STAM_REL_COUNTER_INC(&pThis->StatBytesWritten); 600 } 601 else 602 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 603 552 604 RTCritSectLeave(&pThis->CritSect); 553 605 LogFlow(("%s-%d: drvHostBaseIoReqWrite: returns %Rrc\n", pThis->pDrvIns->pReg->szName, pThis->pDrvIns->iInstance, rc)); … … 566 618 RTCritSectEnter(&pThis->CritSect); 567 619 620 STAM_REL_COUNTER_INC(&pThis->StatReqsSubmitted); 621 STAM_REL_COUNTER_INC(&pThis->StatReqsFlush); 622 568 623 if (pThis->fMediaPresent) 569 624 rc = drvHostBaseFlushOs(pThis); 570 625 else 571 626 rc = VERR_MEDIA_NOT_PRESENT; 627 628 if (RT_SUCCESS(rc)) 629 STAM_REL_COUNTER_INC(&pThis->StatReqsSucceeded); 630 else 631 STAM_REL_COUNTER_INC(&pThis->StatReqsFailed); 572 632 573 633 RTCritSectLeave(&pThis->CritSect); … … 928 988 } 929 989 990 /** 991 * Registers statistics associated with the given media driver. 992 * 993 * @returns VBox status code. 994 * @param pThis The media driver instance. 995 */ 996 static int drvHostBaseStatsRegister(PDRVHOSTBASE pThis) 997 { 998 PPDMDRVINS pDrvIns = pThis->pDrvIns; 999 uint32_t iInstance, iLUN; 1000 const char *pcszController; 1001 1002 int rc = pThis->pDrvMediaPort->pfnQueryDeviceLocation(pThis->pDrvMediaPort, &pcszController, 1003 &iInstance, &iLUN); 1004 if (RT_SUCCESS(rc)) 1005 { 1006 char *pszCtrlUpper = RTStrDup(pcszController); 1007 if (pszCtrlUpper) 1008 { 1009 RTStrToUpper(pszCtrlUpper); 1010 1011 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, 1012 "Amount of data read.", "/Devices/%s%u/Port%u/ReadBytes", pszCtrlUpper, iInstance, iLUN); 1013 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_BYTES, 1014 "Amount of data written.", "/Devices/%s%u/Port%u/WrittenBytes", pszCtrlUpper, iInstance, iLUN); 1015 1016 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSubmitted, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1017 "Number of I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsSubmitted", pszCtrlUpper, iInstance, iLUN); 1018 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFailed, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1019 "Number of I/O requests failed.", "/Devices/%s%u/Port%u/ReqsFailed", pszCtrlUpper, iInstance, iLUN); 1020 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsSucceeded, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1021 "Number of I/O requests succeeded.", "/Devices/%s%u/Port%u/ReqsSucceeded", pszCtrlUpper, iInstance, iLUN); 1022 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsFlush, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1023 "Number of flush I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsFlush", pszCtrlUpper, iInstance, iLUN); 1024 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsWrite, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1025 "Number of write I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsWrite", pszCtrlUpper, iInstance, iLUN); 1026 PDMDrvHlpSTAMRegisterF(pDrvIns, &pThis->StatReqsRead, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_COUNT, 1027 "Number of read I/O requests submitted.", "/Devices/%s%u/Port%u/ReqsRead", pszCtrlUpper, iInstance, iLUN); 1028 1029 RTStrFree(pszCtrlUpper); 1030 } 1031 else 1032 rc = VERR_NO_STR_MEMORY; 1033 } 1034 1035 return rc; 1036 } 1037 1038 /** 1039 * Deregisters statistics associated with the given media driver. 1040 * 1041 * @returns nothing. 1042 * @param pThis The media driver instance. 1043 */ 1044 static void drvhostBaseStatsDeregister(PDRVHOSTBASE pThis) 1045 { 1046 PPDMDRVINS pDrvIns = pThis->pDrvIns; 1047 1048 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatBytesRead); 1049 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatBytesWritten); 1050 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsSubmitted); 1051 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsFailed); 1052 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsSucceeded); 1053 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsFlush); 1054 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsWrite); 1055 PDMDrvHlpSTAMDeregister(pDrvIns, &pThis->StatReqsRead); 1056 } 1057 930 1058 /* -=-=-=-=- driver interface -=-=-=-=- */ 931 1059 … … 1016 1144 /* Forget about the notifications. */ 1017 1145 pThis->pDrvMountNotify = NULL; 1146 1147 drvhostBaseStatsDeregister(pThis); 1018 1148 1019 1149 /* Leave the instance operational if this is just a cleanup of the state … … 1316 1446 } 1317 1447 1448 if (RT_SUCCESS(rc)) 1449 drvHostBaseStatsRegister(pThis); 1450 1318 1451 if (RT_FAILURE(rc)) 1319 1452 { -
trunk/src/VBox/Devices/Storage/DrvHostBase.h
r64407 r64839 107 107 size_t cbIoReqAlloc; 108 108 109 /** Release statistics: number of bytes written. */ 110 STAMCOUNTER StatBytesWritten; 111 /** Release statistics: number of bytes read. */ 112 STAMCOUNTER StatBytesRead; 113 /** Release statistics: Number of requests submitted. */ 114 STAMCOUNTER StatReqsSubmitted; 115 /** Release statistics: Number of requests failed. */ 116 STAMCOUNTER StatReqsFailed; 117 /** Release statistics: Number of requests succeeded. */ 118 STAMCOUNTER StatReqsSucceeded; 119 /** Release statistics: Number of flush requests. */ 120 STAMCOUNTER StatReqsFlush; 121 /** Release statistics: Number of write requests. */ 122 STAMCOUNTER StatReqsWrite; 123 /** Release statistics: Number of read requests. */ 124 STAMCOUNTER StatReqsRead; 125 109 126 /** 110 127 * Performs the locking / unlocking of the device.
Note:
See TracChangeset
for help on using the changeset viewer.