]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/Cycles.cc: skip initialization if rdtsc is not implemented 4839/head
authorBoris Ranto <branto@redhat.com>
Wed, 3 Jun 2015 10:24:48 +0000 (12:24 +0200)
committerBoris Ranto <branto@redhat.com>
Thu, 4 Jun 2015 07:20:25 +0000 (09:20 +0200)
The Cycles initialization gets stuck in infinite loop if rdtsc is not
implemented. This patch fixes the issue by quitting the initialization
if rtdsc fails.

The patch was cherry-picked from ubuntu patch by James Page, see

https://bugzilla.redhat.com/show_bug.cgi?id=1222286

for more details on the patch.

Signed-off-by: James Page <james.page@ubuntu.com>
src/common/Cycles.cc

index a2efcf34b8f3aa194fc3617e826f0ae51a2a911f..b0b687e49d46b3d3ea1c4bfac449ecfd5950957d 100644 (file)
@@ -52,6 +52,10 @@ void Cycles::init()
   if (cycles_per_sec != 0)
     return;
 
+  // Skip initialization if rtdsc is not implemented
+  if (rdtsc() == 0)
+    return;
+
   // Compute the frequency of the fine-grained CPU timer: to do this,
   // take parallel time readings using both rdtsc and gettimeofday.
   // After 10ms have elapsed, take the ratio between these readings.