Changeset 106307 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Oct 14, 2024 2:45:58 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstIEMN8veProfiling.cpp
r106212 r106307 38 38 #include <VBox/vmm/uvm.h> 39 39 #include <VBox/vmm/vmm.h> 40 #include <VBox/vmm/vmmr3vtable.h> 40 41 41 42 #include <iprt/errcore.h> … … 46 47 #include <iprt/stream.h> 47 48 #include <iprt/string.h> 49 50 51 /********************************************************************************************************************************* 52 * Global Variables * 53 *********************************************************************************************************************************/ 54 static uint32_t g_cMaxTbs = 0; 55 static uint64_t g_cbMaxExecMem = 0; 56 static PCVMMR3VTABLE g_pVMM = NULL; 57 58 59 /** 60 * @callback_method_impl{FNCFGMCONSTRUCTOR} 61 */ 62 static DECLCALLBACK(int) tstIEMN8veProfilingCfgConstructor(PUVM pUVM, PVM pVM, PCVMMR3VTABLE pVMM, void *pvUser) 63 { 64 RT_NOREF(pUVM, pvUser); 65 g_pVMM = pVMM; 66 67 /* 68 * Create a default configuration tree. 69 */ 70 int rc = pVMM->pfnCFGMR3ConstructDefaultTree(pVM); 71 AssertRCReturn(rc, rc); 72 73 /* 74 * Now for our overrides. 75 */ 76 PCFGMNODE const pRoot = pVMM->pfnCFGMR3GetRoot(pVM); 77 PCFGMNODE pIemNode = pVMM->pfnCFGMR3GetChild(pRoot, "IEM"); 78 if (!pIemNode) 79 { 80 rc = pVMM->pfnCFGMR3InsertNode(pRoot, "IEM", &pIemNode); 81 if (RT_FAILURE(rc)) 82 return RTMsgErrorRc(rc, "CFGMR3InsertNode/IEM failed: %Rrc", rc); 83 } 84 85 if (g_cMaxTbs != 0) 86 { 87 rc = pVMM->pfnCFGMR3InsertInteger(pIemNode, "MaxTbCount", g_cMaxTbs); 88 if (RT_FAILURE(rc)) 89 return RTMsgErrorRc(rc, "CFGMR3InsertInteger/MaxTbCount failed: %Rrc", rc); 90 } 91 92 if (g_cbMaxExecMem != 0) 93 { 94 rc = pVMM->pfnCFGMR3InsertInteger(pIemNode, "MaxExecMem", g_cbMaxExecMem); 95 if (RT_FAILURE(rc)) 96 return RTMsgErrorRc(rc, "CFGMR3InsertInteger/MaxExecMemaxTbCount failed: %Rrc", rc); 97 } 98 99 return VINF_SUCCESS; 100 } 101 48 102 49 103 … … 67 121 unsigned cVerbosity = 0; 68 122 uint32_t cMinTbs = 0; 123 const char *pszStats = NULL; 69 124 static const RTGETOPTDEF s_aOptions[] = 70 125 { 71 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 72 { "--min-tbs", 'm', RTGETOPT_REQ_UINT32 }, 126 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 127 { "--min-tbs", 'm', RTGETOPT_REQ_UINT32 }, 128 { "--stats", 's', RTGETOPT_REQ_STRING }, 129 { "--max-tb-count", 't', RTGETOPT_REQ_UINT32 }, 130 { "--max-exec-mem", 'x', RTGETOPT_REQ_UINT64 }, 73 131 }; 74 132 RTGETOPTSTATE GetState; … … 94 152 break; 95 153 154 case 's': 155 pszStats = *ValueUnion.psz ? ValueUnion.psz : NULL; 156 break; 157 158 case 't': 159 g_cMaxTbs = ValueUnion.u32; 160 break; 161 162 case 'x': 163 g_cbMaxExecMem = ValueUnion.u64; 164 break; 165 96 166 case 'h': 97 167 RTPrintf("Usage: %Rbn [options] <ThreadedTBsForRecompilerProfiling.sav>\n" … … 109 179 if (!pVM) 110 180 { 111 rc = VMR3Create(1 /*cCpus*/, NULL, VMCREATE_F_DRIVERLESS, NULL, NULL, NULL, NULL, &pVM, &pUVM); 181 rc = VMR3Create(1 /*cCpus*/, NULL, VMCREATE_F_DRIVERLESS, NULL, NULL, 182 tstIEMN8veProfilingCfgConstructor, NULL, &pVM, &pUVM); 112 183 if (RT_FAILURE(rc)) 113 184 { … … 116 187 } 117 188 } 118 rc = VMR3ReqCallWaitU(pUVM, 0, (PFNRT)IEMR3ThreadedProfileRecompilingSavedTbs, 119 3, pVM, ValueUnion.psz, cMinTbs); 120 if (RT_FAILURE(rc)) 121 rcExit = RTEXITCODE_FAILURE; 189 rc = g_pVMM->pfnVMR3ReqCallWaitU(pUVM, 0, (PFNRT)IEMR3ThreadedProfileRecompilingSavedTbs, 190 3, pVM, ValueUnion.psz, cMinTbs); 191 if (RT_SUCCESS(rc)) 192 { 193 if (pszStats) 194 g_pVMM->pfnSTAMR3Print(pUVM, pszStats); 195 } 196 else 197 rcExit = RTMsgErrorExitFailure("VMR3ReqCallWaitU/IEMR3ThreadedProfileRecompilingSavedTbs failed: %Rrc", 198 rc); 122 199 break; 123 200
Note:
See TracChangeset
for help on using the changeset viewer.