WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-bugs

[Xen-bugs] [Bug 1291] New: TSC not accurate in Windows HVM

To: xen-bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-bugs] [Bug 1291] New: TSC not accurate in Windows HVM
From: bugzilla-daemon@xxxxxxxxxxxxxxxxxxx
Date: Thu, 10 Jul 2008 02:16:24 -0700
Delivery-date: Thu, 10 Jul 2008 02:16:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-bugs-request@lists.xensource.com?subject=help>
List-id: Xen Bugzilla <xen-bugs.lists.xensource.com>
List-post: <mailto:xen-bugs@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-bugs>, <mailto:xen-bugs-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-bugs>, <mailto:xen-bugs-request@lists.xensource.com?subject=unsubscribe>
Reply-to: bugs@xxxxxxxxxxxxxxxxxx
Sender: xen-bugs-bounces@xxxxxxxxxxxxxxxxxxx
http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1291

           Summary: TSC not accurate in Windows HVM
           Product: Xen
           Version: unstable
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Hypervisor
        AssignedTo: xen-bugs@xxxxxxxxxxxxxxxxxxx
        ReportedBy: haicheng.li@xxxxxxxxx


Environment:
------------
Service OS (ia32/ia32e/IA64): all
Guest OS (ia32/ia32e/IA64): all
Change Set: 17776
Hardware: Montevina



Bug detailed description:
--------------------------
Windows has a function, QueryPerformanceCounter to retrieve the current value
of the high-resolution performance counter. It is used with
QueryPerformanceFrequency to measure short time intervals. We can calculate the
difference between two QueryPerformanceCounter() calls. Then divide the
difference by the QueryPerformanceFrequency to determine the number of seconds
elapsed.

I did an experiment on Native Windows and HVM Windows:
Calculate the difference of QueryPerformanceCounter() before/after 10 second
and divide it by QueryPerformanceFrequency.

On Native Windows, QueryPerformanceFrequency return a value which is same as
pmtimer frequency. And the time elapsed calculated by the API is near 10s(about
9800ms).

On HVM Windows, QueryPerformanceFrequency returen a valuse which is same as TSC
timer. And the time elapsed calculated by the API always fluctuate. (Sometimes
9100+ ms, sometimes 3000+ ms).

Following is the testing codes:
#include <windows.h>
#include <stdio.h>
#include <winbase.h>
#include <stdlib.h>
#include <time.h>
#include <intsafe.h>

int __cdecl main()
{
        LARGE_INTEGER Freq;
        LARGE_INTEGER Begin;
        LARGE_INTEGER End;
        LONGLONG diff;
        QueryPerformanceFrequency(&Freq);
        QueryPerformanceCounter(&Begin);
        Sleep(10000);
        QueryPerformanceCounter(&End);
        printf("%I64d\n",(End.QuadPart - Begin.QuadPart));
        printf("Check 10s sleep with QueryPerformance %I64d\n",((End.QuadPart -
Begin.QuadPart)*1000/Freq.QuadPart));
        printf("Frequecny is %I64d\n",Freq.QuadPart);
}


-- 
Configure bugmail: 
http://bugzilla.xensource.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

_______________________________________________
Xen-bugs mailing list
Xen-bugs@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-bugs

<Prev in Thread] Current Thread [Next in Thread>