Changeset 59261 in vbox for trunk/src/VBox/VMM/VMMR3
- Timestamp:
- Jan 6, 2016 11:32:38 AM (9 years ago)
- Location:
- trunk/src/VBox/VMM/VMMR3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp
r58170 r59261 1054 1054 STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 1055 1055 "Nanosecond resolution runtime statistics", 1056 "/PDM/AsyncCompletion/File/%s/ TaskRun1Ns-%u-%u",1057 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);1056 "/PDM/AsyncCompletion/File/%s/%d/TaskRun1Ns-%u-%u", 1057 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId, i*100, i*100+100-1); 1058 1058 1059 1059 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesUs) && RT_SUCCESS(rc); i++) … … 1061 1061 STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 1062 1062 "Microsecond resolution runtime statistics", 1063 "/PDM/AsyncCompletion/File/%s/ TaskRun2MicroSec-%u-%u",1064 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);1063 "/PDM/AsyncCompletion/File/%s/%d/TaskRun2MicroSec-%u-%u", 1064 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId, i*100, i*100+100-1); 1065 1065 1066 1066 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++) … … 1068 1068 STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 1069 1069 "Milliseconds resolution runtime statistics", 1070 "/PDM/AsyncCompletion/File/%s/ TaskRun3Ms-%u-%u",1071 RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);1070 "/PDM/AsyncCompletion/File/%s/%d/TaskRun3Ms-%u-%u", 1071 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId, i*100, i*100+100-1); 1072 1072 1073 1073 for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++) … … 1075 1075 STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 1076 1076 "Second resolution runtime statistics", 1077 "/PDM/AsyncCompletion/File/%s/ TaskRun4Sec-%u-%u",1078 RTPathFilename(pEndpoint->pszUri), i*10, i*10+10-1);1077 "/PDM/AsyncCompletion/File/%s/%d/TaskRun4Sec-%u-%u", 1078 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId, i*10, i*10+10-1); 1079 1079 1080 1080 if (RT_SUCCESS(rc)) … … 1082 1082 STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, 1083 1083 "Tasks which ran more than 100sec", 1084 "/PDM/AsyncCompletion/File/%s/ TaskRunSecGreater100Sec",1085 RTPathFilename(pEndpoint->pszUri) );1084 "/PDM/AsyncCompletion/File/%s/%d/TaskRunSecGreater100Sec", 1085 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1086 1086 1087 1087 if (RT_SUCCESS(rc)) … … 1089 1089 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1090 1090 "Processed I/O operations per second", 1091 "/PDM/AsyncCompletion/File/%s/ IoOpsPerSec",1092 RTPathFilename(pEndpoint->pszUri) );1091 "/PDM/AsyncCompletion/File/%s/%d/IoOpsPerSec", 1092 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1093 1093 1094 1094 if (RT_SUCCESS(rc)) … … 1096 1096 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1097 1097 "Started I/O operations for this endpoint", 1098 "/PDM/AsyncCompletion/File/%s/ IoOpsStarted",1099 RTPathFilename(pEndpoint->pszUri) );1098 "/PDM/AsyncCompletion/File/%s/%d/IoOpsStarted", 1099 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1100 1100 1101 1101 if (RT_SUCCESS(rc)) … … 1103 1103 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1104 1104 "Completed I/O operations for this endpoint", 1105 "/PDM/AsyncCompletion/File/%s/ IoOpsCompleted",1106 RTPathFilename(pEndpoint->pszUri) );1105 "/PDM/AsyncCompletion/File/%s/%d/IoOpsCompleted", 1106 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1107 1107 1108 1108 if (RT_SUCCESS(rc)) … … 1110 1110 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1111 1111 "Number of requests with a size smaller than 512 bytes", 1112 "/PDM/AsyncCompletion/File/%s/ ReqSizeSmaller512",1113 RTPathFilename(pEndpoint->pszUri) );1112 "/PDM/AsyncCompletion/File/%s/%d/ReqSizeSmaller512", 1113 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1114 1114 1115 1115 if (RT_SUCCESS(rc)) … … 1117 1117 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1118 1118 "Number of requests with a size between 512 bytes and 1KB", 1119 "/PDM/AsyncCompletion/File/%s/ ReqSize512To1K",1120 RTPathFilename(pEndpoint->pszUri) );1119 "/PDM/AsyncCompletion/File/%s/%d/ReqSize512To1K", 1120 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1121 1121 1122 1122 if (RT_SUCCESS(rc)) … … 1124 1124 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1125 1125 "Number of requests with a size between 1KB and 2KB", 1126 "/PDM/AsyncCompletion/File/%s/ ReqSize1KTo2K",1127 RTPathFilename(pEndpoint->pszUri) );1126 "/PDM/AsyncCompletion/File/%s/%d/ReqSize1KTo2K", 1127 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1128 1128 1129 1129 if (RT_SUCCESS(rc)) … … 1131 1131 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1132 1132 "Number of requests with a size between 2KB and 4KB", 1133 "/PDM/AsyncCompletion/File/%s/ ReqSize2KTo4K",1134 RTPathFilename(pEndpoint->pszUri) );1133 "/PDM/AsyncCompletion/File/%s/%d/ReqSize2KTo4K", 1134 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1135 1135 1136 1136 if (RT_SUCCESS(rc)) … … 1138 1138 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1139 1139 "Number of requests with a size between 4KB and 8KB", 1140 "/PDM/AsyncCompletion/File/%s/ ReqSize4KTo8K",1141 RTPathFilename(pEndpoint->pszUri) );1140 "/PDM/AsyncCompletion/File/%s/%d/ReqSize4KTo8K", 1141 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1142 1142 1143 1143 if (RT_SUCCESS(rc)) … … 1145 1145 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1146 1146 "Number of requests with a size between 8KB and 16KB", 1147 "/PDM/AsyncCompletion/File/%s/ ReqSize8KTo16K",1148 RTPathFilename(pEndpoint->pszUri) );1147 "/PDM/AsyncCompletion/File/%s/%d/ReqSize8KTo16K", 1148 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1149 1149 1150 1150 if (RT_SUCCESS(rc)) … … 1152 1152 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1153 1153 "Number of requests with a size between 16KB and 32KB", 1154 "/PDM/AsyncCompletion/File/%s/ ReqSize16KTo32K",1155 RTPathFilename(pEndpoint->pszUri) );1154 "/PDM/AsyncCompletion/File/%s/%d/ReqSize16KTo32K", 1155 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1156 1156 1157 1157 if (RT_SUCCESS(rc)) … … 1159 1159 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1160 1160 "Number of requests with a size between 32KB and 64KB", 1161 "/PDM/AsyncCompletion/File/%s/ ReqSize32KTo64K",1162 RTPathFilename(pEndpoint->pszUri) );1161 "/PDM/AsyncCompletion/File/%s/%d/ReqSize32KTo64K", 1162 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1163 1163 1164 1164 if (RT_SUCCESS(rc)) … … 1166 1166 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1167 1167 "Number of requests with a size between 64KB and 128KB", 1168 "/PDM/AsyncCompletion/File/%s/ ReqSize64KTo128K",1169 RTPathFilename(pEndpoint->pszUri) );1168 "/PDM/AsyncCompletion/File/%s/%d/ReqSize64KTo128K", 1169 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1170 1170 1171 1171 if (RT_SUCCESS(rc)) … … 1173 1173 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1174 1174 "Number of requests with a size between 128KB and 256KB", 1175 "/PDM/AsyncCompletion/File/%s/ ReqSize128KTo256K",1176 RTPathFilename(pEndpoint->pszUri) );1175 "/PDM/AsyncCompletion/File/%s/%d/ReqSize128KTo256K", 1176 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1177 1177 1178 1178 if (RT_SUCCESS(rc)) … … 1180 1180 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1181 1181 "Number of requests with a size between 256KB and 512KB", 1182 "/PDM/AsyncCompletion/File/%s/ ReqSize256KTo512K",1183 RTPathFilename(pEndpoint->pszUri) );1182 "/PDM/AsyncCompletion/File/%s/%d/ReqSize256KTo512K", 1183 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1184 1184 1185 1185 if (RT_SUCCESS(rc)) … … 1187 1187 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1188 1188 "Number of requests with a size over 512KB", 1189 "/PDM/AsyncCompletion/File/%s/ ReqSizeOver512K",1190 RTPathFilename(pEndpoint->pszUri) );1189 "/PDM/AsyncCompletion/File/%s/%d/ReqSizeOver512K", 1190 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1191 1191 1192 1192 if (RT_SUCCESS(rc)) … … 1194 1194 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1195 1195 "Number of requests which size is not aligned to 512 bytes", 1196 "/PDM/AsyncCompletion/File/%s/ ReqsUnaligned512",1197 RTPathFilename(pEndpoint->pszUri) );1196 "/PDM/AsyncCompletion/File/%s/%d/ReqsUnaligned512", 1197 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1198 1198 1199 1199 if (RT_SUCCESS(rc)) … … 1201 1201 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1202 1202 "Number of requests which size is not aligned to 4KB", 1203 "/PDM/AsyncCompletion/File/%s/ ReqsUnaligned4K",1204 RTPathFilename(pEndpoint->pszUri) );1203 "/PDM/AsyncCompletion/File/%s/%d/ReqsUnaligned4K", 1204 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1205 1205 1206 1206 if (RT_SUCCESS(rc)) … … 1208 1208 STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, 1209 1209 "Number of requests which size is not aligned to 8KB", 1210 "/PDM/AsyncCompletion/File/%s/ ReqsUnaligned8K",1211 RTPathFilename(pEndpoint->pszUri) );1210 "/PDM/AsyncCompletion/File/%s/%d/ReqsUnaligned8K", 1211 RTPathFilename(pEndpoint->pszUri), pEndpoint->iStatId); 1212 1212 1213 1213 return rc; … … 1377 1377 1378 1378 1379 static PPDMASYNCCOMPLETIONENDPOINT1380 pdmR3AsyncCompletion FindEndpointWithUri(PPDMASYNCCOMPLETIONEPCLASS pEndpointClass, const char *pszUri)1379 static unsigned 1380 pdmR3AsyncCompletionGetStatId(PPDMASYNCCOMPLETIONEPCLASS pEndpointClass, const char *pszUri) 1381 1381 { 1382 1382 PPDMASYNCCOMPLETIONENDPOINT pEndpoint = pEndpointClass->pEndpointsHead; 1383 const char *pszFilename = RTPathFilename(pszUri); 1384 unsigned iStatId = 0; 1383 1385 1384 1386 while (pEndpoint) 1385 1387 { 1386 if (!RTStrCmp(pEndpoint->pszUri, pszUri)) 1387 return pEndpoint; 1388 if ( !RTStrCmp(RTPathFilename(pEndpoint->pszUri), pszFilename) 1389 && pEndpoint->iStatId >= iStatId) 1390 iStatId = pEndpoint->iStatId + 1; 1388 1391 1389 1392 pEndpoint = pEndpoint->pNext; 1390 1393 } 1391 1394 1392 return NULL; 1393 } 1394 1395 return iStatId; 1396 } 1395 1397 1396 1398 /** … … 1427 1429 AssertMsg(pEndpointClass, ("File endpoint class was not initialized\n")); 1428 1430 1429 /* Search for a already opened endpoint for this file. */1430 pEndpoint = pdmR3AsyncCompletionFindEndpointWithUri(pEndpointClass, pszFilename);1431 if (pEndpoint)1432 {1433 /* Endpoint found. */1434 pEndpoint->cUsers++;1435 1436 *ppEndpoint = pEndpoint;1437 return VINF_SUCCESS;1438 }1439 1440 1431 /* Create an endpoint. */ 1441 1432 int rc = MMR3HeapAllocZEx(pVM, MM_TAG_PDM_ASYNC_COMPLETION, … … 1450 1441 pEndpoint->pTemplate = pTemplate; 1451 1442 pEndpoint->pszUri = RTStrDup(pszFilename); 1452 pEndpoint-> cUsers = 1;1443 pEndpoint->iStatId = pdmR3AsyncCompletionGetStatId(pEndpointClass, pszFilename); 1453 1444 pEndpoint->pBwMgr = NULL; 1454 1445 … … 1486 1477 return VINF_SUCCESS; 1487 1478 } 1479 else 1480 pEndpointClass->pEndpointOps->pfnEpClose(pEndpoint); 1488 1481 1489 1482 if (pEndpointClass->fGatherAdvancedStatistics) … … 1513 1506 AssertReturnVoid(VALID_PTR(pEndpoint)); 1514 1507 1515 pEndpoint->cUsers--; 1516 1517 /* If the last user closed the endpoint we will free it. */ 1518 if (!pEndpoint->cUsers) 1519 { 1520 PPDMASYNCCOMPLETIONEPCLASS pEndpointClass = pEndpoint->pEpClass; 1521 PVM pVM = pEndpointClass->pVM; 1522 1523 pEndpointClass->pEndpointOps->pfnEpClose(pEndpoint); 1524 1525 /* Drop reference from the template. */ 1526 ASMAtomicDecU32(&pEndpoint->pTemplate->cUsed); 1527 1528 /* Unlink the endpoint from the list. */ 1529 int rc = RTCritSectEnter(&pEndpointClass->CritSect); 1530 AssertMsg(RT_SUCCESS(rc), ("Failed to enter critical section rc=%Rrc\n", rc)); 1531 1532 PPDMASYNCCOMPLETIONENDPOINT pEndpointNext = pEndpoint->pNext; 1533 PPDMASYNCCOMPLETIONENDPOINT pEndpointPrev = pEndpoint->pPrev; 1534 1535 if (pEndpointPrev) 1536 pEndpointPrev->pNext = pEndpointNext; 1537 else 1538 pEndpointClass->pEndpointsHead = pEndpointNext; 1539 if (pEndpointNext) 1540 pEndpointNext->pPrev = pEndpointPrev; 1541 1542 pEndpointClass->cEndpoints--; 1543 1544 rc = RTCritSectLeave(&pEndpointClass->CritSect); 1545 AssertMsg(RT_SUCCESS(rc), ("Failed to enter critical section rc=%Rrc\n", rc)); 1546 1547 if (pEndpointClass->fGatherAdvancedStatistics) 1548 pdmR3AsyncCompletionStatisticsDeregister(pEndpoint); 1549 1550 RTStrFree(pEndpoint->pszUri); 1551 MMR3HeapFree(pEndpoint); 1552 } 1508 PPDMASYNCCOMPLETIONEPCLASS pEndpointClass = pEndpoint->pEpClass; 1509 PVM pVM = pEndpointClass->pVM; 1510 1511 pEndpointClass->pEndpointOps->pfnEpClose(pEndpoint); 1512 1513 /* Drop reference from the template. */ 1514 ASMAtomicDecU32(&pEndpoint->pTemplate->cUsed); 1515 1516 /* Unlink the endpoint from the list. */ 1517 int rc = RTCritSectEnter(&pEndpointClass->CritSect); 1518 AssertMsg(RT_SUCCESS(rc), ("Failed to enter critical section rc=%Rrc\n", rc)); 1519 1520 PPDMASYNCCOMPLETIONENDPOINT pEndpointNext = pEndpoint->pNext; 1521 PPDMASYNCCOMPLETIONENDPOINT pEndpointPrev = pEndpoint->pPrev; 1522 1523 if (pEndpointPrev) 1524 pEndpointPrev->pNext = pEndpointNext; 1525 else 1526 pEndpointClass->pEndpointsHead = pEndpointNext; 1527 if (pEndpointNext) 1528 pEndpointNext->pPrev = pEndpointPrev; 1529 1530 pEndpointClass->cEndpoints--; 1531 1532 rc = RTCritSectLeave(&pEndpointClass->CritSect); 1533 AssertMsg(RT_SUCCESS(rc), ("Failed to enter critical section rc=%Rrc\n", rc)); 1534 1535 if (pEndpointClass->fGatherAdvancedStatistics) 1536 pdmR3AsyncCompletionStatisticsDeregister(pEndpoint); 1537 1538 RTStrFree(pEndpoint->pszUri); 1539 MMR3HeapFree(pEndpoint); 1553 1540 } 1554 1541 -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
r58126 r59261 1103 1103 STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS, 1104 1104 STAMUNIT_TICKS_PER_CALL, "Time taken to read from the endpoint", 1105 "/PDM/AsyncCompletion/File/%s/ Read", RTPathFilename(pEpFile->Core.pszUri));1105 "/PDM/AsyncCompletion/File/%s/%d/Read", RTPathFilename(pEpFile->Core.pszUri), pEpFile->Core.iStatId); 1106 1106 1107 1107 STAMR3RegisterF(pEpClassFile->Core.pVM, &pEpFile->StatWrite, 1108 1108 STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS, 1109 1109 STAMUNIT_TICKS_PER_CALL, "Time taken to write to the endpoint", 1110 "/PDM/AsyncCompletion/File/%s/ Write", RTPathFilename(pEpFile->Core.pszUri));1110 "/PDM/AsyncCompletion/File/%s/%d/Write", RTPathFilename(pEpFile->Core.pszUri), pEpFile->Core.iStatId); 1111 1111 } 1112 1112 #endif
Note:
See TracChangeset
for help on using the changeset viewer.