Changeset 53430 in vbox for trunk/src/VBox/HostDrivers/Support/testcase
- Timestamp:
- Dec 3, 2014 1:18:41 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97118
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/testcase/tstGIP-2.cpp
r53358 r53430 39 39 #include <iprt/initterm.h> 40 40 #include <iprt/getopt.h> 41 #include <iprt/x86.h> 42 43 44 /** 45 * Checks whether the CPU advertises an invariant TSC or not. 46 * 47 * @returns true if invariant, false otherwise. 48 */ 49 bool tstIsInvariantTsc(void) 50 { 51 if (ASMHasCpuId()) 52 { 53 uint32_t uEax, uEbx, uEcx, uEdx; 54 ASMCpuId(0x80000000, &uEax, &uEbx, &uEcx, &uEdx); 55 if (uEax >= 0x80000007) 56 { 57 ASMCpuId(0x80000007, &uEax, &uEbx, &uEcx, &uEdx); 58 if (uEdx & X86_CPUID_AMD_ADVPOWER_EDX_TSCINVAR) 59 return true; 60 } 61 } 62 return false; 63 } 41 64 42 65 … … 64 87 uint64_t uCpuHzRef = 0; 65 88 uint64_t uCpuHzOverallDeviation = 0; 89 int64_t iCpuHzMaxDeviation = 0; 66 90 int32_t cCpuHzOverallDevCnt = 0; 67 91 RTGETOPTUNION ValueUnion; … … 144 168 else 145 169 { 146 if (pCpu->u32TransactionId > 7) 170 /* Wait until the history validation code takes effect. */ 171 if (pCpu->u32TransactionId > 23 + (8 * 2) + 1) 147 172 { 173 if (RT_ABS(iCpuHzDeviation) > RT_ABS(iCpuHzMaxDeviation)) 174 iCpuHzMaxDeviation = iCpuHzDeviation; 148 175 uCpuHzOverallDeviation += uCpuHzDeviation; 149 176 cCpuHzOverallDevCnt++; … … 222 249 RTPrintf("tstGIP-2: offline: %lld\n", g_pSUPGlobalInfoPage->aCPUs[iCpu].i64TSCDelta); 223 250 224 if (uCpuHzRef) 251 RTPrintf("CPUID.Invariant-TSC : %RTbool\n", tstIsInvariantTsc()); 252 if ( uCpuHzRef 253 && cCpuHzOverallDevCnt) 225 254 { 226 uint32_t uPct = (uint32_t)(uCpuHzOverallDeviation * 100000 / cCpuHzOverallDevCnt / uCpuHzRef + 5); 227 RTPrintf("tstGIP-2: Overall CpuHz deviation: %d.%02d%%\n", uPct / 1000, (uPct % 1000) / 10); 255 uint32_t uPct = (uint32_t)(uCpuHzOverallDeviation * 100000 / cCpuHzOverallDevCnt / uCpuHzRef + 5); 256 uint32_t uMaxPct = (uint32_t)(RT_ABS(iCpuHzMaxDeviation) * 100000 / uCpuHzRef + 5); 257 RTPrintf("Average CpuHz deviation: %d.%02d%%\n", uPct / 1000, (uPct % 1000) / 10); 258 RTPrintf("Maximum CpuHz deviation: %d.%02d%% (%RI64 ticks)\n", uMaxPct / 1000, (uMaxPct % 1000) / 10, iCpuHzMaxDeviation); 228 259 } 229 260 } … … 240 271 return !!rc; 241 272 } 273
Note:
See TracChangeset
for help on using the changeset viewer.