- Timestamp:
- Mar 26, 2021 9:14:59 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdrv.h
r87761 r88305 1038 1038 * @param enmType Sample type. This indicates what pvSample is pointing at. 1039 1039 * @param pszName Sample name. The name is on this form "/<component>/<sample>". 1040 * Further nesting is possible. 1040 * Further nesting is possible. If this does not start 1041 * with a '/', the default prefix will be prepended, 1042 * otherwise it will be used as-is. 1041 1043 * @param enmUnit Sample unit. 1042 1044 * @param pszDesc Sample description. … … 1055 1057 * @param enmUnit Sample unit. 1056 1058 * @param pszDesc Sample description. 1057 * @param pszName The sample name format string. 1059 * @param pszName The sample name format string. If this does not start 1060 * with a '/', the default prefix will be prepended, 1061 * otherwise it will be used as-is. 1058 1062 * @param ... Arguments to the format string. 1059 1063 */ … … 1072 1076 * @param enmUnit Sample unit. 1073 1077 * @param pszDesc Sample description. 1074 * @param pszName The sample name format string. 1078 * @param pszName The sample name format string. If this does not 1079 * start with a '/', the default prefix will be prepended, 1080 * otherwise it will be used as-is. 1075 1081 * @param args Arguments to the format string. 1076 1082 */ -
trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp
r87773 r88305 1442 1442 { 1443 1443 PDMDRV_ASSERT_DRVINS(pDrvIns); 1444 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3); 1445 1446 STAM_REG(pDrvIns->Internal.s.pVMR3, pvSample, enmType, pszName, enmUnit, pszDesc); 1447 RT_NOREF6(pDrvIns, pvSample, enmType, pszName, enmUnit, pszDesc); 1448 /** @todo track the samples so they can be dumped & deregistered when the driver instance is destroyed. 1449 * For now we just have to be careful not to use this call for drivers which can be unloaded. */ 1444 PVM pVM = pDrvIns->Internal.s.pVMR3; 1445 VM_ASSERT_EMT(pVM); 1446 1447 #ifdef VBOX_WITH_STATISTICS /** @todo rework this to always be compiled in */ 1448 if (*pszName == '/') 1449 STAM_REG(pDrvIns->Internal.s.pVMR3, pvSample, enmType, pszName, enmUnit, pszDesc); 1450 else 1451 STAMR3RegisterF(pVM, pvSample, enmType, STAMVISIBILITY_ALWAYS, enmUnit, pszDesc, 1452 "/Drivers/%s-%u/%s", pDrvIns->pReg->szName, pDrvIns->iInstance, pszName); 1453 #else 1454 RT_NOREF(pDrvIns, pvSample, enmType, pszName, enmUnit, pszDesc, pVM); 1455 #endif 1456 } 1457 1458 1459 /** @interface_method_impl{PDMDRVHLPR3,pfnSTAMRegisterV} */ 1460 static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 1461 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args) 1462 { 1463 PDMDRV_ASSERT_DRVINS(pDrvIns); 1464 PVM pVM = pDrvIns->Internal.s.pVMR3; 1465 VM_ASSERT_EMT(pVM); 1466 1467 int rc; 1468 if (*pszName == '/') 1469 rc = STAMR3RegisterV(pVM, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args); 1470 else 1471 { 1472 /* We need to format it to check whether it starts with a 1473 slash or not (will rework this later). */ 1474 char szFormatted[2048]; 1475 ssize_t cchBase = RTStrPrintf2(szFormatted, sizeof(szFormatted) - 1024, "/Drivers/%s-%u/", 1476 pDrvIns->pReg->szName, pDrvIns->iInstance); 1477 AssertReturnVoid(cchBase > 0); 1478 1479 ssize_t cch2 = RTStrPrintf2V(&szFormatted[cchBase], sizeof(szFormatted) - cchBase, pszName, args); 1480 AssertReturnVoid(cch2 > 0); 1481 1482 rc = STAMR3Register(pVM, pvSample, enmType, enmVisibility, 1483 &szFormatted[szFormatted[cchBase] == '/' ? cchBase : 0], enmUnit, pszDesc); 1484 } 1485 AssertRC(rc); 1450 1486 } 1451 1487 … … 1455 1491 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, ...) 1456 1492 { 1457 PDMDRV_ASSERT_DRVINS(pDrvIns); 1458 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3); 1459 1460 va_list args; 1461 va_start(args, pszName); 1462 int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args); 1463 va_end(args); 1464 AssertRC(rc); 1465 } 1466 1467 1468 /** @interface_method_impl{PDMDRVHLPR3,pfnSTAMRegisterV} */ 1469 static DECLCALLBACK(void) pdmR3DrvHlp_STAMRegisterV(PPDMDRVINS pDrvIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility, 1470 STAMUNIT enmUnit, const char *pszDesc, const char *pszName, va_list args) 1471 { 1472 PDMDRV_ASSERT_DRVINS(pDrvIns); 1473 VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3); 1474 1475 int rc = STAMR3RegisterV(pDrvIns->Internal.s.pVMR3, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, args); 1476 AssertRC(rc); 1493 va_list va; 1494 va_start(va, pszName); 1495 pdmR3DrvHlp_STAMRegisterV(pDrvIns, pvSample, enmType, enmVisibility, enmUnit, pszDesc, pszName, va); 1496 va_end(va); 1477 1497 } 1478 1498
Note:
See TracChangeset
for help on using the changeset viewer.