VirtualBox

Changeset 46493 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Jun 11, 2013 1:34:40 PM (12 years ago)
Author:
vboxsync
Message:

STAMR3Deregister* optimizations. Relevant for both startup and shutdown times.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PATM.cpp

    r46159 r46493  
    56315631    if (PATM_STAT_INDEX_IS_VALID(pPatchRec->patch.uPatchIdx))
    56325632    {
    5633         STAMR3Deregister(pVM, &pPatchRec->patch);
    5634 #ifndef DEBUG_sandervl
    5635         STAMR3Deregister(pVM, &pVM->patm.s.pStatsHC[pPatchRec->patch.uPatchIdx]);
    5636         STAMR3Deregister(pVM, &pPatchRec->patch.cbPatchBlockSize);
    5637         STAMR3Deregister(pVM, &pPatchRec->patch.cbPatchJump);
    5638         STAMR3Deregister(pVM, &pPatchRec->patch.cbPrivInstr);
    5639         STAMR3Deregister(pVM, &pPatchRec->patch.cCodeWrites);
    5640         STAMR3Deregister(pVM, &pPatchRec->patch.cInvalidWrites);
    5641         STAMR3Deregister(pVM, &pPatchRec->patch.cTraps);
    5642         STAMR3Deregister(pVM, &pPatchRec->patch.flags);
    5643         STAMR3Deregister(pVM, &pPatchRec->patch.nrJumpRecs);
    5644         STAMR3Deregister(pVM, &pPatchRec->patch.nrFixups);
    5645         STAMR3Deregister(pVM, &pPatchRec->patch.opcode);
    5646         STAMR3Deregister(pVM, &pPatchRec->patch.uState);
    5647         STAMR3Deregister(pVM, &pPatchRec->patch.uOldState);
    5648         STAMR3Deregister(pVM, &pPatchRec->patch.uOpMode);
    5649 #endif
     5633        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/Patch/0x%RRv", pPatchRec->patch.pPrivInstrGC);
     5634        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
    56505635    }
    56515636#endif
     
    57495734    }
    57505735
    5751     /** Note: quite ugly to enable/disable/remove/insert old and new patches, but there's no easy way around it. */
     5736    /* Note: quite ugly to enable/disable/remove/insert old and new patches, but there's no easy way around it. */
    57525737
    57535738    rc = PATMR3DisablePatch(pVM, pInstrGC);
    57545739    AssertRC(rc);
    57555740
    5756     /** Kick it out of the lookup tree to make sure PATMR3InstallPatch doesn't fail (hack alert) */
     5741    /* Kick it out of the lookup tree to make sure PATMR3InstallPatch doesn't fail (hack alert) */
    57575742    RTAvloU32Remove(&pVM->patm.s.PatchLookupTreeHC->PatchTree, pPatchRec->Core.Key);
    57585743#ifdef VBOX_WITH_STATISTICS
    57595744    if (PATM_STAT_INDEX_IS_VALID(pPatchRec->patch.uPatchIdx))
    57605745    {
    5761         STAMR3Deregister(pVM, &pPatchRec->patch);
    5762 #ifndef DEBUG_sandervl
    5763         STAMR3Deregister(pVM, &pVM->patm.s.pStatsHC[pPatchRec->patch.uPatchIdx]);
    5764         STAMR3Deregister(pVM, &pPatchRec->patch.cbPatchBlockSize);
    5765         STAMR3Deregister(pVM, &pPatchRec->patch.cbPatchJump);
    5766         STAMR3Deregister(pVM, &pPatchRec->patch.cbPrivInstr);
    5767         STAMR3Deregister(pVM, &pPatchRec->patch.cCodeWrites);
    5768         STAMR3Deregister(pVM, &pPatchRec->patch.cInvalidWrites);
    5769         STAMR3Deregister(pVM, &pPatchRec->patch.cTraps);
    5770         STAMR3Deregister(pVM, &pPatchRec->patch.flags);
    5771         STAMR3Deregister(pVM, &pPatchRec->patch.nrJumpRecs);
    5772         STAMR3Deregister(pVM, &pPatchRec->patch.nrFixups);
    5773         STAMR3Deregister(pVM, &pPatchRec->patch.opcode);
    5774         STAMR3Deregister(pVM, &pPatchRec->patch.uState);
    5775         STAMR3Deregister(pVM, &pPatchRec->patch.uOldState);
    5776         STAMR3Deregister(pVM, &pPatchRec->patch.uOpMode);
    5777 #endif
     5746        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/Patch/0x%RRv", pPatchRec->patch.pPrivInstrGC);
     5747        STAMR3DeregisterF(pVM->pUVM, "/PATM/Stats/PatchBD/0x%RRv*", pPatchRec->patch.pPrivInstrGC);
    57785748    }
    57795749#endif
  • trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletion.cpp

    r44358 r46493  
    10491049    pEndpoint->tsIntervalStartMs = RTTimeMilliTS();
    10501050
    1051     for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesNs); i++)
    1052     {
     1051    for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesNs) && RT_SUCCESS(rc); i++)
    10531052        rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesNs[i], STAMTYPE_COUNTER,
    10541053                             STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     
    10561055                             "/PDM/AsyncCompletion/File/%s/TaskRun1Ns-%u-%u",
    10571056                             RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
    1058         if (RT_FAILURE(rc))
    1059             break;
    1060     }
    1061 
    1062     if (RT_SUCCESS(rc))
    1063     {
    1064         for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesUs); i++)
    1065         {
    1066             rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesUs[i], STAMTYPE_COUNTER,
    1067                                  STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    1068                                  "Microsecond resolution runtime statistics",
    1069                                  "/PDM/AsyncCompletion/File/%s/TaskRun2MicroSec-%u-%u",
    1070                                  RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
    1071             if (RT_FAILURE(rc))
    1072                 break;
    1073         }
    1074     }
    1075 
    1076     if (RT_SUCCESS(rc))
    1077     {
    1078         for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs); i++)
    1079         {
    1080             rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesMs[i], STAMTYPE_COUNTER,
    1081                                  STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    1082                                  "Milliseconds resolution runtime statistics",
    1083                                  "/PDM/AsyncCompletion/File/%s/TaskRun3Ms-%u-%u",
    1084                                  RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
    1085             if (RT_FAILURE(rc))
    1086                 break;
    1087         }
    1088     }
    1089 
    1090     if (RT_SUCCESS(rc))
    1091     {
    1092         for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs); i++)
    1093         {
    1094             rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesSec[i], STAMTYPE_COUNTER,
    1095                                  STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    1096                                  "Second resolution runtime statistics",
    1097                                  "/PDM/AsyncCompletion/File/%s/TaskRun4Sec-%u-%u",
    1098                                  RTPathFilename(pEndpoint->pszUri), i*10, i*10+10-1);
    1099             if (RT_FAILURE(rc))
    1100                 break;
    1101         }
    1102     }
    1103 
    1104     if (RT_SUCCESS(rc))
    1105     {
     1057
     1058    for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesUs) && RT_SUCCESS(rc); i++)
     1059        rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesUs[i], STAMTYPE_COUNTER,
     1060                             STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     1061                             "Microsecond resolution runtime statistics",
     1062                             "/PDM/AsyncCompletion/File/%s/TaskRun2MicroSec-%u-%u",
     1063                             RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
     1064
     1065    for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++)
     1066        rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesMs[i], STAMTYPE_COUNTER,
     1067                             STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     1068                             "Milliseconds resolution runtime statistics",
     1069                             "/PDM/AsyncCompletion/File/%s/TaskRun3Ms-%u-%u",
     1070                             RTPathFilename(pEndpoint->pszUri), i*100, i*100+100-1);
     1071
     1072    for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs) && RT_SUCCESS(rc); i++)
     1073        rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunTimesSec[i], STAMTYPE_COUNTER,
     1074                             STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     1075                             "Second resolution runtime statistics",
     1076                             "/PDM/AsyncCompletion/File/%s/TaskRun4Sec-%u-%u",
     1077                             RTPathFilename(pEndpoint->pszUri), i*10, i*10+10-1);
     1078
     1079    if (RT_SUCCESS(rc))
    11061080        rc = STAMR3RegisterF(pVM, &pEndpoint->StatTaskRunOver100Sec, STAMTYPE_COUNTER,
    11071081                             STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     
    11091083                             "/PDM/AsyncCompletion/File/%s/TaskRunSecGreater100Sec",
    11101084                             RTPathFilename(pEndpoint->pszUri));
    1111     }
    1112 
    1113     if (RT_SUCCESS(rc))
    1114     {
     1085
     1086    if (RT_SUCCESS(rc))
    11151087        rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsPerSec, STAMTYPE_COUNTER,
    11161088                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11181090                             "/PDM/AsyncCompletion/File/%s/IoOpsPerSec",
    11191091                             RTPathFilename(pEndpoint->pszUri));
    1120     }
    1121 
    1122     if (RT_SUCCESS(rc))
    1123     {
     1092
     1093    if (RT_SUCCESS(rc))
    11241094        rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsStarted, STAMTYPE_COUNTER,
    11251095                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11271097                             "/PDM/AsyncCompletion/File/%s/IoOpsStarted",
    11281098                             RTPathFilename(pEndpoint->pszUri));
    1129     }
    1130 
    1131     if (RT_SUCCESS(rc))
    1132     {
     1099
     1100    if (RT_SUCCESS(rc))
    11331101        rc = STAMR3RegisterF(pVM, &pEndpoint->StatIoOpsCompleted, STAMTYPE_COUNTER,
    11341102                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11361104                             "/PDM/AsyncCompletion/File/%s/IoOpsCompleted",
    11371105                             RTPathFilename(pEndpoint->pszUri));
    1138     }
    1139 
    1140     if (RT_SUCCESS(rc))
    1141     {
     1106
     1107    if (RT_SUCCESS(rc))
    11421108        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSizeSmaller512, STAMTYPE_COUNTER,
    11431109                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11451111                             "/PDM/AsyncCompletion/File/%s/ReqSizeSmaller512",
    11461112                             RTPathFilename(pEndpoint->pszUri));
    1147     }
    1148 
    1149     if (RT_SUCCESS(rc))
    1150     {
     1113
     1114    if (RT_SUCCESS(rc))
    11511115        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize512To1K, STAMTYPE_COUNTER,
    11521116                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11541118                             "/PDM/AsyncCompletion/File/%s/ReqSize512To1K",
    11551119                             RTPathFilename(pEndpoint->pszUri));
    1156     }
    1157 
    1158     if (RT_SUCCESS(rc))
    1159     {
     1120
     1121    if (RT_SUCCESS(rc))
    11601122        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize1KTo2K, STAMTYPE_COUNTER,
    11611123                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11631125                             "/PDM/AsyncCompletion/File/%s/ReqSize1KTo2K",
    11641126                             RTPathFilename(pEndpoint->pszUri));
    1165     }
    1166 
    1167     if (RT_SUCCESS(rc))
    1168     {
     1127
     1128    if (RT_SUCCESS(rc))
    11691129        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize2KTo4K, STAMTYPE_COUNTER,
    11701130                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11721132                             "/PDM/AsyncCompletion/File/%s/ReqSize2KTo4K",
    11731133                             RTPathFilename(pEndpoint->pszUri));
    1174     }
    1175 
    1176     if (RT_SUCCESS(rc))
    1177     {
     1134
     1135    if (RT_SUCCESS(rc))
    11781136        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize4KTo8K, STAMTYPE_COUNTER,
    11791137                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11811139                             "/PDM/AsyncCompletion/File/%s/ReqSize4KTo8K",
    11821140                             RTPathFilename(pEndpoint->pszUri));
    1183     }
    1184 
    1185     if (RT_SUCCESS(rc))
    1186     {
     1141
     1142    if (RT_SUCCESS(rc))
    11871143        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize8KTo16K, STAMTYPE_COUNTER,
    11881144                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11901146                             "/PDM/AsyncCompletion/File/%s/ReqSize8KTo16K",
    11911147                             RTPathFilename(pEndpoint->pszUri));
    1192     }
    1193 
    1194     if (RT_SUCCESS(rc))
    1195     {
     1148
     1149    if (RT_SUCCESS(rc))
    11961150        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize16KTo32K, STAMTYPE_COUNTER,
    11971151                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    11991153                             "/PDM/AsyncCompletion/File/%s/ReqSize16KTo32K",
    12001154                             RTPathFilename(pEndpoint->pszUri));
    1201     }
    1202 
    1203     if (RT_SUCCESS(rc))
    1204     {
     1155
     1156    if (RT_SUCCESS(rc))
    12051157        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize32KTo64K, STAMTYPE_COUNTER,
    12061158                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12081160                             "/PDM/AsyncCompletion/File/%s/ReqSize32KTo64K",
    12091161                             RTPathFilename(pEndpoint->pszUri));
    1210     }
    1211 
    1212     if (RT_SUCCESS(rc))
    1213     {
     1162
     1163    if (RT_SUCCESS(rc))
    12141164        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize64KTo128K, STAMTYPE_COUNTER,
    12151165                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12171167                             "/PDM/AsyncCompletion/File/%s/ReqSize64KTo128K",
    12181168                             RTPathFilename(pEndpoint->pszUri));
    1219     }
    1220 
    1221     if (RT_SUCCESS(rc))
    1222     {
     1169
     1170    if (RT_SUCCESS(rc))
    12231171        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize128KTo256K, STAMTYPE_COUNTER,
    12241172                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12261174                             "/PDM/AsyncCompletion/File/%s/ReqSize128KTo256K",
    12271175                             RTPathFilename(pEndpoint->pszUri));
    1228     }
    1229 
    1230     if (RT_SUCCESS(rc))
    1231     {
     1176
     1177    if (RT_SUCCESS(rc))
    12321178        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSize256KTo512K, STAMTYPE_COUNTER,
    12331179                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12351181                             "/PDM/AsyncCompletion/File/%s/ReqSize256KTo512K",
    12361182                             RTPathFilename(pEndpoint->pszUri));
    1237     }
    1238 
    1239     if (RT_SUCCESS(rc))
    1240     {
     1183
     1184    if (RT_SUCCESS(rc))
    12411185        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqSizeOver512K, STAMTYPE_COUNTER,
    12421186                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12441188                             "/PDM/AsyncCompletion/File/%s/ReqSizeOver512K",
    12451189                             RTPathFilename(pEndpoint->pszUri));
    1246     }
    1247 
    1248     if (RT_SUCCESS(rc))
    1249     {
     1190
     1191    if (RT_SUCCESS(rc))
    12501192        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned512, STAMTYPE_COUNTER,
    12511193                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12531195                             "/PDM/AsyncCompletion/File/%s/ReqsUnaligned512",
    12541196                             RTPathFilename(pEndpoint->pszUri));
    1255     }
    1256 
    1257     if (RT_SUCCESS(rc))
    1258     {
     1197
     1198    if (RT_SUCCESS(rc))
    12591199        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned4K, STAMTYPE_COUNTER,
    12601200                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12621202                             "/PDM/AsyncCompletion/File/%s/ReqsUnaligned4K",
    12631203                             RTPathFilename(pEndpoint->pszUri));
    1264     }
    1265 
    1266     if (RT_SUCCESS(rc))
    1267     {
     1204
     1205    if (RT_SUCCESS(rc))
    12681206        rc = STAMR3RegisterF(pVM, &pEndpoint->StatReqsUnaligned8K, STAMTYPE_COUNTER,
    12691207                             STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES,
     
    12711209                             "/PDM/AsyncCompletion/File/%s/ReqsUnaligned8K",
    12721210                             RTPathFilename(pEndpoint->pszUri));
    1273     }
    12741211
    12751212    return rc;
     
    12851222static void pdmR3AsyncCompletionStatisticsDeregister(PPDMASYNCCOMPLETIONENDPOINT pEndpoint)
    12861223{
    1287     PVM pVM = pEndpoint->pEpClass->pVM;
    1288 
    1289     for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesNs); i++)
    1290         STAMR3Deregister(pVM, &pEndpoint->StatTaskRunTimesNs[i]);
    1291     for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesUs); i++)
    1292         STAMR3Deregister(pVM, &pEndpoint->StatTaskRunTimesUs[i]);
    1293     for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs); i++)
    1294         STAMR3Deregister(pVM, &pEndpoint->StatTaskRunTimesMs[i]);
    1295     for (unsigned i = 0; i < RT_ELEMENTS(pEndpoint->StatTaskRunTimesMs); i++)
    1296         STAMR3Deregister(pVM, &pEndpoint->StatTaskRunTimesSec[i]);
    1297 
    1298     STAMR3Deregister(pVM, &pEndpoint->StatTaskRunOver100Sec);
    1299     STAMR3Deregister(pVM, &pEndpoint->StatIoOpsPerSec);
    1300     STAMR3Deregister(pVM, &pEndpoint->StatIoOpsStarted);
    1301     STAMR3Deregister(pVM, &pEndpoint->StatIoOpsCompleted);
    1302 
    1303     STAMR3Deregister(pVM, &pEndpoint->StatReqSizeSmaller512);
    1304     STAMR3Deregister(pVM, &pEndpoint->StatReqSize512To1K);
    1305     STAMR3Deregister(pVM, &pEndpoint->StatReqSize1KTo2K);
    1306     STAMR3Deregister(pVM, &pEndpoint->StatReqSize2KTo4K);
    1307     STAMR3Deregister(pVM, &pEndpoint->StatReqSize4KTo8K);
    1308     STAMR3Deregister(pVM, &pEndpoint->StatReqSize8KTo16K);
    1309     STAMR3Deregister(pVM, &pEndpoint->StatReqSize16KTo32K);
    1310     STAMR3Deregister(pVM, &pEndpoint->StatReqSize32KTo64K);
    1311     STAMR3Deregister(pVM, &pEndpoint->StatReqSize64KTo128K);
    1312     STAMR3Deregister(pVM, &pEndpoint->StatReqSize128KTo256K);
    1313     STAMR3Deregister(pVM, &pEndpoint->StatReqSize256KTo512K);
    1314     STAMR3Deregister(pVM, &pEndpoint->StatReqSizeOver512K);
    1315     STAMR3Deregister(pVM, &pEndpoint->StatReqsUnaligned512);
    1316     STAMR3Deregister(pVM, &pEndpoint->StatReqsUnaligned4K);
    1317     STAMR3Deregister(pVM, &pEndpoint->StatReqsUnaligned8K);
     1224    /* I hope this doesn't remove too much... */
     1225    STAMR3DeregisterF(pEndpoint->pEpClass->pVM->pUVM, "/PDM/AsyncCompletion/File/%s/*", RTPathFilename(pEndpoint->pszUri));
    13181226}
    13191227
  • trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp

    r44528 r46493  
    11541154
    11551155#ifdef VBOX_WITH_STATISTICS
    1156     STAMR3Deregister(pEpClassFile->Core.pVM, &pEpFile->StatRead);
    1157     STAMR3Deregister(pEpClassFile->Core.pVM, &pEpFile->StatWrite);
     1156    /* Not sure if this might be unnecessary because of similar statement in pdmR3AsyncCompletionStatisticsDeregister? */
     1157    STAMR3DeregisterF(pEpClassFile->Core.pVM->pUVM, "/PDM/AsyncCompletion/File/%s/*", RTPathFilename(pEpFile->Core.pszUri));
    11581158#endif
    11591159
  • trunk/src/VBox/VMM/VMMR3/PDMBlkCache.cpp

    r44528 r46493  
    12421242                        return VINF_SUCCESS;
    12431243                    }
    1244                     else
    1245                         rc = VERR_NO_MEMORY;
    1246 
     1244
     1245                    rc = VERR_NO_MEMORY;
    12471246                    RTSemRWDestroy(pBlkCache->SemRWEntries);
    12481247                }
     
    14461445
    14471446#ifdef VBOX_WITH_STATISTICS
    1448     STAMR3Deregister(pCache->pVM, &pBlkCache->StatWriteDeferred);
     1447    STAMR3DeregisterF(pCache->pVM->pUVM, "/PDM/BlkCache/%s/Cache/DeferredWrites", pBlkCache->pszId);
    14491448#endif
    14501449
  • trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp

    r45177 r46493  
    525525    pCritSect->pVMR0   = NIL_RTR0PTR;
    526526    pCritSect->pVMRC   = NIL_RTRCPTR;
     527    if (!fFinal)
     528        STAMR3DeregisterF(pVM->pUVM, "/PDM/CritSects/%s/*", pCritSect->pszName);
    527529    RTStrFree((char *)pCritSect->pszName);
    528530    pCritSect->pszName = NULL;
    529     if (!fFinal)
    530     {
    531         STAMR3Deregister(pVM, &pCritSect->StatContentionRZLock);
    532         STAMR3Deregister(pVM, &pCritSect->StatContentionRZUnlock);
    533         STAMR3Deregister(pVM, &pCritSect->StatContentionR3);
    534 #ifdef VBOX_WITH_STATISTICS
    535         STAMR3Deregister(pVM, &pCritSect->StatLocked);
    536 #endif
    537     }
    538531    return rc;
    539532}
     
    602595    pCritSect->pVMR0   = NIL_RTR0PTR;
    603596    pCritSect->pVMRC   = NIL_RTRCPTR;
     597    if (!fFinal)
     598        STAMR3DeregisterF(pVM->pUVM, "/PDM/CritSectsRw/%s/*", pCritSect->pszName);
    604599    RTStrFree((char *)pCritSect->pszName);
    605600    pCritSect->pszName = NULL;
    606     if (!fFinal)
    607     {
    608         STAMR3Deregister(pVM, &pCritSect->StatContentionRZEnterExcl);
    609         STAMR3Deregister(pVM, &pCritSect->StatContentionRZLeaveExcl);
    610         STAMR3Deregister(pVM, &pCritSect->StatContentionRZEnterShared);
    611         STAMR3Deregister(pVM, &pCritSect->StatContentionRZLeaveShared);
    612         STAMR3Deregister(pVM, &pCritSect->StatRZEnterExcl);
    613         STAMR3Deregister(pVM, &pCritSect->StatRZEnterShared);
    614         STAMR3Deregister(pVM, &pCritSect->StatContentionR3EnterExcl);
    615         STAMR3Deregister(pVM, &pCritSect->StatContentionR3EnterShared);
    616         STAMR3Deregister(pVM, &pCritSect->StatR3EnterExcl);
    617         STAMR3Deregister(pVM, &pCritSect->StatR3EnterShared);
    618 #ifdef VBOX_WITH_STATISTICS
    619         STAMR3Deregister(pVM, &pCritSect->StatWriteLocked);
    620 #endif
    621     }
    622601
    623602    return RT_SUCCESS(rc1) ? rc2 : rc1;
  • trunk/src/VBox/VMM/VMMR3/PDMDriver.cpp

    r45808 r46493  
    14271427    VM_ASSERT_EMT(pDrvIns->Internal.s.pVMR3);
    14281428
    1429     int rc = STAMR3DeregisterU(pDrvIns->Internal.s.pVMR3->pUVM, pvSample);
     1429    int rc = STAMR3DeregisterByAddr(pDrvIns->Internal.s.pVMR3->pUVM, pvSample);
    14301430    AssertRC(rc);
    14311431    return rc;
  • trunk/src/VBox/VMM/VMMR3/PDMQueue.cpp

    r46420 r46493  
    446446     * Deregister statistics.
    447447     */
    448     STAMR3Deregister(pVM, &pQueue->cbItem);
    449     STAMR3Deregister(pVM, &pQueue->cbItem);
    450     STAMR3Deregister(pVM, &pQueue->StatAllocFailures);
    451     STAMR3Deregister(pVM, &pQueue->StatInsert);
    452     STAMR3Deregister(pVM, &pQueue->StatFlush);
    453     STAMR3Deregister(pVM, &pQueue->StatFlushLeftovers);
    454 #ifdef VBOX_WITH_STATISTICS
    455     STAMR3Deregister(pVM, &pQueue->StatFlushPrf);
    456     STAMR3Deregister(pVM, (void *)&pQueue->cStatPending);
    457 #endif
     448    STAMR3DeregisterF(pVM->pUVM, "/PDM/Queue/%s/cbItem", pQueue->pszName);
    458449
    459450    /*
  • trunk/src/VBox/VMM/VMMR3/PGMHandler.cpp

    r45808 r46493  
    411411
    412412#ifdef VBOX_WITH_STATISTICS
    413         char szPath[256];
    414         RTStrPrintf(szPath, sizeof(szPath), "/PGM/VirtHandler/Calls/%RGv-%RGv", pNew->Core.Key, pNew->Core.KeyLast);
    415         rc = STAMR3Register(pVM, &pNew->Stat, STAMTYPE_PROFILE, STAMVISIBILITY_USED, szPath, STAMUNIT_TICKS_PER_CALL, pszDesc);
     413        rc = STAMR3RegisterF(pVM, &pNew->Stat, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, pszDesc,
     414                             "/PGM/VirtHandler/Calls/%RGv-%RGv", pNew->Core.Key, pNew->Core.KeyLast);
    416415        AssertRC(rc);
    417416#endif
     
    509508    pgmUnlock(pVM);
    510509
    511     STAM_DEREG(pVM, &pCur->Stat);
     510#ifdef VBOX_WITH_STATISTICS
     511    STAMR3DeregisterF(pVM->pUVM, "/PGM/VirtHandler/Calls/%RGv-%RGv", pCur->Core.Key, pCur->Core.KeyLast);
     512#endif
    512513    MMHyperFree(pVM, pCur);
    513514
  • trunk/src/VBox/VMM/VMMR3/STAM.cpp

    r46452 r46493  
    6262#include <iprt/stream.h>
    6363#include <iprt/string.h>
     64
     65
     66/*******************************************************************************
     67*   Defined Constants And Macros                                               *
     68*******************************************************************************/
     69/** The maximum name length excluding the terminator. */
     70#define STAM_MAX_NAME_LEN   239
    6471
    6572
     
    487494    AssertReturn(enmType != STAMTYPE_CALLBACK, VERR_INVALID_PARAMETER);
    488495
    489     char *pszFormattedName;
    490     RTStrAPrintfV(&pszFormattedName, pszName, args);
    491     if (!pszFormattedName)
    492         return VERR_NO_MEMORY;
    493 
    494     int rc = STAMR3RegisterU(pUVM, pvSample, enmType, enmVisibility, pszFormattedName, enmUnit, pszDesc);
    495     RTStrFree(pszFormattedName);
    496     return rc;
     496    char   szFormattedName[STAM_MAX_NAME_LEN + 8];
     497    size_t cch = RTStrPrintfV(szFormattedName, sizeof(szFormattedName), pszName, args);
     498    AssertReturn(cch <= STAM_MAX_NAME_LEN, VERR_OUT_OF_RANGE);
     499
     500    return STAMR3RegisterU(pUVM, pvSample, enmType, enmVisibility, szFormattedName, enmUnit, pszDesc);
    497501}
    498502
     
    12541258    AssertReturn(pszName[1] != '/' && pszName[1], VERR_INVALID_NAME);
    12551259    uint32_t const cchName = (uint32_t)strlen(pszName);
    1256     AssertReturn(cchName < 256, VERR_OUT_OF_RANGE);
     1260    AssertReturn(cchName <= STAM_MAX_NAME_LEN, VERR_OUT_OF_RANGE);
    12571261    AssertReturn(pszName[cchName - 1] != '/', VERR_INVALID_NAME);
    12581262    AssertReturn(memchr(pszName, '\\', cchName) == NULL, VERR_INVALID_NAME);
     
    14371441
    14381442/**
    1439  * Deregisters a sample previously registered by STAR3Register().
     1443 * Destroys the statistics descriptor, unlinking it and freeing all resources.
     1444 *
     1445 * @returns VINF_SUCCESS
     1446 * @param   pUVM        Pointer to the user mode VM structure.
     1447 * @param   pCur        The descriptor to destroy.
     1448 */
     1449static int stamR3DestroyDesc(PUVM pUVM, PSTAMDESC pCur)
     1450{
     1451    RTListNodeRemove(&pCur->ListEntry);
     1452#ifdef STAM_WITH_LOOKUP_TREE
     1453    pCur->pLookup->pDesc = NULL; /** @todo free lookup nodes once it's working. */
     1454    stamR3LookupDecUsage(pCur->pLookup);
     1455    stamR3LookupMaybeFree(pCur->pLookup);
     1456#endif
     1457    RTMemFree(pCur);
     1458
     1459    return VINF_SUCCESS;
     1460}
     1461
     1462
     1463/**
     1464 * Deregisters a sample previously registered by STAR3Register() given its
     1465 * address.
    14401466 *
    14411467 * This is intended used for devices which can be unplugged and for
     
    14461472 * @param   pvSample    Pointer to the sample registered with STAMR3Register().
    14471473 */
    1448 VMMR3DECL(int)  STAMR3DeregisterU(PUVM pUVM, void *pvSample)
     1474VMMR3DECL(int)  STAMR3DeregisterByAddr(PUVM pUVM, void *pvSample)
    14491475{
    14501476    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1477
     1478    /* This is a complete waste of time when shutting down. */
     1479    VMSTATE enmState = VMR3GetStateU(pUVM);
     1480    if (enmState >= VMSTATE_DESTROYING)
     1481        return VINF_SUCCESS;
    14511482
    14521483    STAM_LOCK_WR(pUVM);
     
    14601491    {
    14611492        if (pCur->u.pv == pvSample)
    1462         {
    1463             RTListNodeRemove(&pCur->ListEntry);
    1464 #ifdef STAM_WITH_LOOKUP_TREE
    1465             pCur->pLookup->pDesc = NULL; /** @todo free lookup nodes once it's working. */
    1466             stamR3LookupDecUsage(pCur->pLookup);
    1467             stamR3LookupMaybeFree(pCur->pLookup);
    1468 #endif
    1469             RTMemFree(pCur);
    1470             rc = VINF_SUCCESS;
    1471         }
     1493            rc = stamR3DestroyDesc(pUVM, pCur);
    14721494    }
    14731495
     
    14781500
    14791501/**
    1480  * Deregisters a sample previously registered by STAR3Register().
    1481  *
    1482  * This is intended used for devices which can be unplugged and for
    1483  * temporary samples.
     1502 * Worker for STAMR3Deregister, STAMR3DeregisterV and STAMR3DeregisterF.
     1503 *
     1504 * @returns VBox status code.
     1505 * @retval  VWRN_NOT_FOUND if no matching names found.
     1506 *
     1507 * @param   pUVM        Pointer to the user mode VM structure.
     1508 * @param   pszPat      The name pattern.
     1509 */
     1510static int stamR3DeregisterByPattern(PUVM pUVM, const char *pszPat)
     1511{
     1512    Assert(!strchr(pszPat, '|')); /* single pattern! */
     1513
     1514    int rc = VWRN_NOT_FOUND;
     1515    STAM_LOCK_WR(pUVM);
     1516
     1517    PSTAMDESC pLast;
     1518    PSTAMDESC pCur = stamR3LookupFindPatternDescRange(pUVM->stam.s.pRoot, &pUVM->stam.s.List, pszPat, &pLast);
     1519    if (pCur)
     1520    {
     1521        for (;;)
     1522        {
     1523            PSTAMDESC pNext = RTListNodeGetNext(&pCur->ListEntry, STAMDESC, ListEntry);
     1524
     1525            if (RTStrSimplePatternMatch(pszPat, pCur->pszName))
     1526                rc = stamR3DestroyDesc(pUVM, pCur);
     1527
     1528            /* advance. */
     1529            if (pCur == pLast)
     1530                break;
     1531            pCur = pNext;
     1532        }
     1533        Assert(pLast);
     1534    }
     1535    else
     1536        Assert(!pLast);
     1537
     1538    STAM_UNLOCK_WR(pUVM);
     1539    return rc;
     1540}
     1541
     1542
     1543/**
     1544 * Deregister zero or more samples given a (single) pattern matching their
     1545 * names.
    14841546 *
    14851547 * @returns VBox status.
    1486  * @param   pVM         Pointer to the VM.
    1487  * @param   pvSample    Pointer to the sample registered with STAMR3Register().
    1488  */
    1489 VMMR3DECL(int)  STAMR3Deregister(PVM pVM, void *pvSample)
    1490 {
    1491     return STAMR3DeregisterU(pVM->pUVM, pvSample);
     1548 * @param   pUVM        Pointer to the user mode VM structure.
     1549 * @param   pszPat      The name pattern.
     1550 * @sa      STAMR3DeregisterF, STAMR3DeregisterV
     1551 */
     1552VMMR3DECL(int)  STAMR3Deregister(PUVM pUVM, const char *pszPat)
     1553{
     1554    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1555
     1556    /* This is a complete waste of time when shutting down. */
     1557    VMSTATE enmState = VMR3GetStateU(pUVM);
     1558    if (enmState >= VMSTATE_DESTROYING)
     1559        return VINF_SUCCESS;
     1560
     1561    return stamR3DeregisterByPattern(pUVM, pszPat);
     1562}
     1563
     1564
     1565/**
     1566 * Deregister zero or more samples given a (single) pattern matching their
     1567 * names.
     1568 *
     1569 * @returns VBox status.
     1570 * @param   pUVM        Pointer to the user mode VM structure.
     1571 * @param   pszPatFmt   The name pattern format string.
     1572 * @param   ...         Format string arguments.
     1573 * @sa      STAMR3Deregister, STAMR3DeregisterV
     1574 */
     1575VMMR3DECL(int)  STAMR3DeregisterF(PUVM pUVM, const char *pszPatFmt, ...)
     1576{
     1577    va_list va;
     1578    va_start(va, pszPatFmt);
     1579    int rc = STAMR3DeregisterV(pUVM, pszPatFmt, va);
     1580    va_end(va);
     1581    return rc;
     1582}
     1583
     1584
     1585/**
     1586 * Deregister zero or more samples given a (single) pattern matching their
     1587 * names.
     1588 *
     1589 * @returns VBox status.
     1590 * @param   pUVM        Pointer to the user mode VM structure.
     1591 * @param   pszPatFmt   The name pattern format string.
     1592 * @param   va          Format string arguments.
     1593 * @sa      STAMR3Deregister, STAMR3DeregisterF
     1594 */
     1595VMMR3DECL(int)  STAMR3DeregisterV(PUVM pUVM, const char *pszPatFmt, va_list va)
     1596{
     1597    UVM_ASSERT_VALID_EXT_RETURN(pUVM, VERR_INVALID_VM_HANDLE);
     1598
     1599    /* This is a complete waste of time when shutting down. */
     1600    VMSTATE enmState = VMR3GetStateU(pUVM);
     1601    if (enmState >= VMSTATE_DESTROYING)
     1602        return VINF_SUCCESS;
     1603
     1604    char   szPat[STAM_MAX_NAME_LEN + 8];
     1605    size_t cchPat = RTStrPrintfV(szPat, sizeof(szPat), pszPatFmt, va);
     1606    AssertReturn(cchPat <= STAM_MAX_NAME_LEN, VERR_OUT_OF_RANGE);
     1607
     1608    return stamR3DeregisterByPattern(pUVM, szPat);
    14921609}
    14931610
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette