Explorar el Código

wall_clock: use standard wall clock if rtsc frequency is too low

german77 hace 4 años
padre
commit
e4c63d432d
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      src/common/wall_clock.cpp

+ 3 - 1
src/common/wall_clock.cpp

@@ -72,7 +72,9 @@ std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency,
     if (caps.invariant_tsc) {
     if (caps.invariant_tsc) {
         rtsc_frequency = EstimateRDTSCFrequency();
         rtsc_frequency = EstimateRDTSCFrequency();
     }
     }
-    if (rtsc_frequency == 0) {
+
+    // Fallback to StandardWallClock if rtsc period is higher than a nano second
+    if (rtsc_frequency <= 1000000000) {
         return std::make_unique<StandardWallClock>(emulated_cpu_frequency,
         return std::make_unique<StandardWallClock>(emulated_cpu_frequency,
                                                    emulated_clock_frequency);
                                                    emulated_clock_frequency);
     } else {
     } else {