Lines Matching refs:pEndpoint

154 static void pdmR3AsyncCompletionPutTask(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, PPDMASYNCCOMPLETIONTASK pTask);
715 * @param pEndpoint The endpoint.
721 bool pdmacEpIsTransferAllowed(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint32_t cbTransfer, RTMSINTERVAL *pmsWhenNext)
724 PPDMACBWMGR pBwMgr = ASMAtomicReadPtrT(&pEndpoint->pBwMgr, PPDMACBWMGR);
726 LogFlowFunc(("pEndpoint=%p pBwMgr=%p cbTransfer=%u\n", pEndpoint, pBwMgr, cbTransfer));
785 PPDMASYNCCOMPLETIONTEMPLATE pTemplate = pTask->pEndpoint->pTemplate;
810 pdmR3AsyncCompletionPutTask(pTask->pEndpoint, pTask);
964 * @param pEndpoint The endpoint to register the request size for.
967 static void pdmR3AsyncCompletionStatisticsRecordSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, size_t cbReq)
970 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSizeSmaller512);
972 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize512To1K);
974 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize1KTo2K);
976 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize2KTo4K);
978 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize4KTo8K);
980 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize8KTo16K);
982 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize16KTo32K);
984 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize32KTo64K);
986 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize64KTo128K);
988 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize128KTo256K);
990 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSize256KTo512K);
992 STAM_REL_COUNTER_INC(&pEndpoint->StatReqSizeOver512K);
995 STAM_REL_COUNTER_INC(&pEndpoint->StatReqsUnaligned512);
997 STAM_REL_COUNTER_INC(&pEndpoint->StatReqsUnaligned4K);
999 STAM_REL_COUNTER_INC(&pEndpoint->StatReqsUnaligned8K);
1007 * @param pEndpoint The endpoint.
1010 static void pdmR3AsyncCompletionStatisticsRecordCompletionTime(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cNsRun)
1014 pStatCounter = &pEndpoint->StatTaskRunTimesNs[cNsRun / (RT_NS_1US / 10)];
1016 pStatCounter = &pEndpoint->StatTaskRunTimesUs[cNsRun / (RT_NS_1MS / 10)];
1018 pStatCounter = &pEndpoint->StatTaskRunTimesMs[cNsRun / (RT_NS_1SEC / 10)];
1020 pStatCounter = &pEndpoint->StatTaskRunTimesSec[cNsRun / (RT_NS_1SEC_64*100 / 10)];
1022 pStatCounter = &pEndpoint->StatTaskRunOver100Sec;
1025 STAM_REL_COUNTER_INC(&pEndpoint->StatIoOpsCompleted);
1026 pEndpoint->cIoOpsCompleted++;
1028 uint64_t tsInterval = tsMsCur - pEndpoint->tsIntervalStartMs;
1031 pEndpoint->StatIoOpsPerSec.c = pEndpoint->cIoOpsCompleted / (tsInterval / 1000);
1032 pEndpoint->tsIntervalStartMs = tsMsCur;
1033 pEndpoint->cIoOpsCompleted = 0;
1042 * @param pEndpoint The endpoint to register the advanced statistics for.
1044 static int pdmR3AsyncCompletionStatisticsRegister(PPDMASYNCCOMPLETIONENDPOINT pEndpoint)
1047 PVM pVM = pEndpoint->pEpClass->pVM;
1049 pEndpoint->tsIntervalStartMs = RTTimeMilliTS();
1051 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesNs) && RT_SUCCESS(rc); i++)
1052 rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesNs[i], STAMTYPE_COUNTER,
1056 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
1058 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesUs) && RT_SUCCESS(rc); i++)
1059 rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesUs[i], STAMTYPE_COUNTER,
1063 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
1065 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++)
1066 rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesMs[i], STAMTYPE_COUNTER,
1070 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
1072 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++)
1073 rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesSec[i], STAMTYPE_COUNTER,
1077 RTPathFilename(pEndpoint->pszUri), i*10, i*10+10-1);
1080 rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunOver100Sec, STAMTYPE_COUNTER,
1084 RTPathFilename(pEndpoint->pszUri));
1087 rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsPerSec, STAMTYPE_COUNTER,
1091 RTPathFilename(pEndpoint->pszUri));
1094 rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsStarted, STAMTYPE_COUNTER,
1098 RTPathFilename(pEndpoint->pszUri));
1101 rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsCompleted, STAMTYPE_COUNTER,
1105 RTPathFilename(pEndpoint->pszUri));
1108 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSizeSmaller512, STAMTYPE_COUNTER,
1112 RTPathFilename(pEndpoint->pszUri));
1115 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize512To1K, STAMTYPE_COUNTER,
1119 RTPathFilename(pEndpoint->pszUri));
1122 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize1KTo2K, STAMTYPE_COUNTER,
1126 RTPathFilename(pEndpoint->pszUri));
1129 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize2KTo4K, STAMTYPE_COUNTER,
1133 RTPathFilename(pEndpoint->pszUri));
1136 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize4KTo8K, STAMTYPE_COUNTER,
1140 RTPathFilename(pEndpoint->pszUri));
1143 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize8KTo16K, STAMTYPE_COUNTER,
1147 RTPathFilename(pEndpoint->pszUri));
1150 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize16KTo32K, STAMTYPE_COUNTER,
1154 RTPathFilename(pEndpoint->pszUri));
1157 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize32KTo64K, STAMTYPE_COUNTER,
1161 RTPathFilename(pEndpoint->pszUri));
1164 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize64KTo128K, STAMTYPE_COUNTER,
1168 RTPathFilename(pEndpoint->pszUri));
1171 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize128KTo256K, STAMTYPE_COUNTER,
1175 RTPathFilename(pEndpoint->pszUri));
1178 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize256KTo512K, STAMTYPE_COUNTER,
1182 RTPathFilename(pEndpoint->pszUri));
1185 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSizeOver512K, STAMTYPE_COUNTER,
1189 RTPathFilename(pEndpoint->pszUri));
1192 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned512, STAMTYPE_COUNTER,
1196 RTPathFilename(pEndpoint->pszUri));
1199 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned4K, STAMTYPE_COUNTER,
1203 RTPathFilename(pEndpoint->pszUri));
1206 rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned8K, STAMTYPE_COUNTER,
1210 RTPathFilename(pEndpoint->pszUri));
1220 * @param pEndpoint The endpoint to deregister the advanced statistics for.
1222 static void pdmR3AsyncCompletionStatisticsDeregister(PPDMASYNCCOMPLETIONENDPOINT pEndpoint)
1225 STAMR3DeregisterF(pEndpoint->pEpClass->pVM->pUVM, "/PDM/AsyncCompletion/File/%s/*", RTPathFilename(pEndpoint->pszUri));
1333 * @param pEndpoint The endpoint the task is for.
1336 static PPDMASYNCCOMPLETIONTASK pdmR3AsyncCompletionGetTask(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser)
1338 PPDMASYNCCOMPLETIONEPCLASS pEndpointClass = pEndpoint->pEpClass;
1344 pTask->pEndpoint = pEndpoint;
1349 STAM_REL_COUNTER_INC(&pEndpoint->StatIoOpsStarted);
1360 * @param pEndpoint The endpoint the task belongs to.
1363 static void pdmR3AsyncCompletionPutTask(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, PPDMASYNCCOMPLETIONTASK pTask)
1365 PPDMASYNCCOMPLETIONEPCLASS pEndpointClass = pEndpoint->pEpClass;
1372 pdmR3AsyncCompletionStatisticsRecordCompletionTime(pEndpoint, cNsRun);
1381 PPDMASYNCCOMPLETIONENDPOINT pEndpoint = pEndpointClass->pEndpointsHead;
1383 while (pEndpoint)
1385 if (!RTStrCmp(pEndpoint->pszUri, pszUri))
1386 return pEndpoint;
1388 pEndpoint = pEndpoint->pNext;
1424 PPDMASYNCCOMPLETIONENDPOINT pEndpoint = NULL;
1429 pEndpoint = pdmR3AsyncCompletionFindEndpointWithUri(pEndpointClass, pszFilename);
1430 if (pEndpoint)
1433 pEndpoint->cUsers++;
1435 *ppEndpoint = pEndpoint;
1442 (void **)&pEndpoint);
1446 pEndpoint->pNext = NULL;
1447 pEndpoint->pPrev = NULL;
1448 pEndpoint->pEpClass = pEndpointClass;
1449 pEndpoint->pTemplate = pTemplate;
1450 pEndpoint->pszUri = RTStrDup(pszFilename);
1451 pEndpoint->cUsers = 1;
1452 pEndpoint->pBwMgr = NULL;
1454 if ( pEndpoint->pszUri
1458 rc = pEndpointClass->pEndpointOps->pfnEpInitialize(pEndpoint, pszFilename, fFlags);
1462 rc = pdmR3AsyncCompletionStatisticsRegister(pEndpoint);
1470 pEndpoint->pNext = pEndpointClass->pEndpointsHead;
1472 pEndpointClass->pEndpointsHead->pPrev = pEndpoint;
1474 pEndpointClass->pEndpointsHead = pEndpoint;
1483 *ppEndpoint = pEndpoint;
1489 pdmR3AsyncCompletionStatisticsDeregister(pEndpoint);
1491 RTStrFree(pEndpoint->pszUri);
1493 MMR3HeapFree(pEndpoint);
1505 * @param pEndpoint Handle of the endpoint.
1507 VMMR3DECL(void) PDMR3AsyncCompletionEpClose(PPDMASYNCCOMPLETIONENDPOINT pEndpoint)
1509 LogFlowFunc((": pEndpoint=%p\n", pEndpoint));
1512 AssertReturnVoid(VALID_PTR(pEndpoint));
1514 pEndpoint->cUsers--;
1517 if (!pEndpoint->cUsers)
1519 PPDMASYNCCOMPLETIONEPCLASS pEndpointClass = pEndpoint->pEpClass;
1522 pEndpointClass->pEndpointOps->pfnEpClose(pEndpoint);
1525 ASMAtomicDecU32(&pEndpoint->pTemplate->cUsed);
1531 PPDMASYNCCOMPLETIONENDPOINT pEndpointNext = pEndpoint->pNext;
1532 PPDMASYNCCOMPLETIONENDPOINT pEndpointPrev = pEndpoint->pPrev;
1547 pdmR3AsyncCompletionStatisticsDeregister(pEndpoint);
1549 RTStrFree(pEndpoint->pszUri);
1550 MMR3HeapFree(pEndpoint);
1559 * @param pEndpoint The file endpoint to read from.
1568 VMMR3DECL(int) PDMR3AsyncCompletionEpRead(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
1573 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1582 pTask = pdmR3AsyncCompletionGetTask(pEndpoint, pvUser);
1586 int rc = pEndpoint->pEpClass->pEndpointOps->pfnEpRead(pTask, pEndpoint, off,
1590 if (pEndpoint->pEpClass->fGatherAdvancedStatistics)
1591 pdmR3AsyncCompletionStatisticsRecordSize(pEndpoint, cbRead);
1596 pdmR3AsyncCompletionPutTask(pEndpoint, pTask);
1606 * @param pEndpoint The file endpoint to write to.
1615 VMMR3DECL(int) PDMR3AsyncCompletionEpWrite(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, RTFOFF off,
1620 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1629 pTask = pdmR3AsyncCompletionGetTask(pEndpoint, pvUser);
1633 int rc = pEndpoint->pEpClass->pEndpointOps->pfnEpWrite(pTask, pEndpoint, off,
1637 if (pEndpoint->pEpClass->fGatherAdvancedStatistics)
1638 pdmR3AsyncCompletionStatisticsRecordSize(pEndpoint, cbWrite);
1643 pdmR3AsyncCompletionPutTask(pEndpoint, pTask);
1656 * @param pEndpoint The file endpoint to flush.
1661 VMMR3DECL(int) PDMR3AsyncCompletionEpFlush(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, void *pvUser, PPPDMASYNCCOMPLETIONTASK ppTask)
1663 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1668 pTask = pdmR3AsyncCompletionGetTask(pEndpoint, pvUser);
1672 int rc = pEndpoint->pEpClass->pEndpointOps->pfnEpFlush(pTask, pEndpoint);
1676 pdmR3AsyncCompletionPutTask(pEndpoint, pTask);
1690 * @param pEndpoint The file endpoint.
1693 VMMR3DECL(int) PDMR3AsyncCompletionEpGetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint,
1696 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1699 if (pEndpoint->pEpClass->pEndpointOps->pfnEpGetSize)
1700 return pEndpoint->pEpClass->pEndpointOps->pfnEpGetSize(pEndpoint, pcbSize);
1713 * @param pEndpoint The file endpoint.
1718 VMMR3DECL(int) PDMR3AsyncCompletionEpSetSize(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, uint64_t cbSize)
1720 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1722 if (pEndpoint->pEpClass->pEndpointOps->pfnEpSetSize)
1723 return pEndpoint->pEpClass->pEndpointOps->pfnEpSetSize(pEndpoint, cbSize);
1732 * @param pEndpoint The endpoint.
1736 VMMR3DECL(int) PDMR3AsyncCompletionEpSetBwMgr(PPDMASYNCCOMPLETIONENDPOINT pEndpoint, const char *pszBwMgr)
1738 AssertPtrReturn(pEndpoint, VERR_INVALID_POINTER);
1745 pBwMgrNew = pdmacBwMgrFindById(pEndpoint->pEpClass, pszBwMgr);
1754 pBwMgrOld = ASMAtomicXchgPtrT(&pEndpoint->pBwMgr, pBwMgrNew, PPDMACBWMGR);