Article View: borland.public.cppbuilder.nativeapi
Article #11167Re: Finegrain Sleep
From: Benjamin Pratt
Date: Tue, 24 Feb 2004 19:54
Date: Tue, 24 Feb 2004 19:54
67 lines
3580 bytes
3580 bytes
> > So, that's just the results on my machine. I'm sure the
> speed is effected by
> > the processor, compiler, and OS version.
> Surely the absolute speed is affected by processor, compiler
> and OS, but I can't understand how the comparison between
> GetTickCount and GetSystemTimeAsFileTime could be affected
> as well (and IMHO it is not).
I would agree, but I haven't changed the code any from what was posted.
GetSystemTimeAsFileTime is doing 64-bit arithmatic so it logically would be
slower on any 32-bit platform.
Purely speculating, I think the difference is in the Athlon. It must have
optimizations for 64-bit arithmatic that the Pentium doesn't have. Even so,
I would still think it would be ultimatly slower than GetTickCount().
My brother is the sys admin for a high school. He is going to write a script
to run it on a wide variety of computers at his school. Unfortunatly, he
doesn't have any Athlons.
If anyone is following this thread that has an Athlon and wants to
participate, I have posted the exe in borland.public.attachments.
This exe has the initial time resolution test removed. It just tests the
speed of GetSystemTimeAsFileTime and GetTickCount. The code is at the
bottom.
On my machine, the results are still the same, FileTime is faster, crazy as
it seems.
Filetime: 9.58222e-009
TickCount: 1.23368e-008
#include <iostream>
#include <windows.h>
int main()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
const int calls = 100000;
FILETIME ft;
int i;
LARGE_INTEGER FtStart, FtEnd;
QueryPerformanceCounter(&FtStart);
for(i = 0; i < calls; ++i)
GetSystemTimeAsFileTime(&ft);
QueryPerformanceCounter(&FtEnd);
DWORD tc;
LARGE_INTEGER TcStart, TcEnd;
QueryPerformanceCounter(&TcStart);
for(i = 0; i < calls; ++i)
tc = GetTickCount();
QueryPerformanceCounter(&TcEnd);
double FtLatency = (FtEnd.QuadPart - FtStart.QuadPart)
/ double(freq.QuadPart) / double(calls);
double TcLatency = (TcEnd.QuadPart - TcStart.QuadPart)
/ double(freq.QuadPart) / double(calls);
std::cout << "Filetime: " << FtLatency << std::endl;
std::cout << "TickCount: " << TcLatency << std::endl;
return 0;
}
Technical Details
Message-ID:
<403bab5f@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!in.nntp.be!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> <40349ac7@newsgroups.borland.com> <4034d0ba@newsgroups.borland.com> <4034ecd4$1@newsgroups.borland.com> <4035bee9@newsgroups.borland.com> <40365c30$1@newsgroups.borland.com> <4039bbb9@newsgroups.borland.com> <403acaa5@newsgroups.borland.com> <403b0261@newsgroups.borland.com> <403b4567$3@newsgroups.borland.com> <403b4949@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,fed9196afef30d83 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-02-24 11:58:53 PST From: "Benjamin Pratt" <benjamin.pratt.getridofthis@verizon.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <4033629c$1@newsgroups.borland.com> <40336c3f@newsgroups.borland.com> <40349ac7@newsgroups.borland.com> <4034d0ba@newsgroups.borland.com> <4034ecd4$1@newsgroups.borland.com> <4035bee9@newsgroups.borland.com> <40365c30$1@newsgroups.borland.com> <4039bbb9@newsgroups.borland.com> <403acaa5@newsgroups.borland.com> <403b0261@newsgroups.borland.com> <403b4567$3@newsgroups.borland.com> <403b4949@newsgroups.borland.com> Subject: Re: Finegrain Sleep Date: Tue, 24 Feb 2004 11:54:46 -0800 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 24.130.93.201 Message-ID: <403bab5f@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1077652319 24.130.93.201 (24 Feb 2004 11:51:59 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!in.nntp.be!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail