Unreliable QueryPerformanceCounter on Windows 2008 RC2 guest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

I am using a Ubuntu 12.04 x64 host to run a Windows 2008 RC2 guest and
I have noticed very puzzling behaviour inside the guest when invoking
QueryPerformanceCounter. Specifically the program below will
periodically show a 43 second offset between loop iterations despite
the fact that  loop is roughly running once per second (printing out
the guest system clock confirms this). The same thing happens on a
Windows 7 guest. The 43 second number is remarkably stable across
hosts and guests.

#include "stdafx.h"
#include "windows.h"
#include <iostream>

int main(int argc, char ** argv)
{

   LARGE_INTEGER qpcnt;
   QueryPerformanceCounter(&qpcnt);
   auto then = qpcnt.QuadPart;

   while (true) {
      LARGE_INTEGER qpfreq;
      QueryPerformanceFrequency(&qpfreq);
      auto freq = qpfreq.QuadPart;

      QueryPerformanceCounter(&qpcnt);
      auto now = qpcnt.QuadPart;
      auto delta_seconds = (now - then) / freq;

      std::cout << delta_seconds << std::endl;

      QueryPerformanceCounter(&qpcnt);
      then = qpcnt.QuadPart;
      Sleep (1000);
   }
}

A few more details on the host:

$ uname -a
Linux think 3.2.0-48-generic #74-Ubuntu SMP Thu Jun 6 19:43:26 UTC
2013 x86_64 x86_64 x86_64 GNU/Linux
$ kvm --version
QEMU emulator version 1.0 (qemu-kvm-1.0), Copyright (c) 2003-2008
Fabrice Bellard

Any ideas on what might be happening?

Thanks in advance,
-pp
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux