| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-Spam-Check-By: | sourceware.org |
| X-YMail-OSG: | YSHhIaQVM1la47lRNFJh7NV8VMPxEQeKdH5hc2phJ88CRAtLBqu0xxREPYBr_e.4he0TrCipML0UOA6CEjCkjM2Kt6ybkIIDhzH8ll.YAX38bL2a9A-- |
| Message-ID: | <471E9B41.6030205@computer.org> |
| Date: | Tue, 23 Oct 2007 18:09:21 -0700 |
| From: | Tim Prince <tprince AT computer DOT org> |
| User-Agent: | Thunderbird 2.0.0.4 (X11/20070613) |
| MIME-Version: | 1.0 |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: milliseconds on Windows |
| References: | <38624 DOT 131 DOT 220 DOT 7 DOT 1 DOT 1193151578 DOT squirrel AT webmail DOT iai DOT uni-bonn DOT de> <Pine DOT CYG DOT 4 DOT 58 DOT 0710231015060 DOT 3388 AT PC1163-8460-XP DOT flightsafety DOT com> <000201c81593$045ae260$02fea8c0 AT DDZG9K91> |
| In-Reply-To: | <000201c81593$045ae260$02fea8c0@DDZG9K91> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
Robert D. Holtz - Lists wrote:
>> Hello Brian,
>
> http://cygwin.com/acronyms/#PPIOSPE
>
> I've redirected this message and set the Reply-To appropriately.
>
>> I'm a student at Bonn university and I'm researching robotics. I'm trying
>> to write a robot controller for Windows XP (wasn't my choice!) and
>> measuring elapsed time down to milliseconds precision is crucial. Do you
>> happen to remember this discussion on the cygwin mailing list?
>>
>> So if you know how to measure 1ms (less would be even better) on Win XP,
>> can you please tell me how to do that?
>
> If you're feeling frisky it's also possible to write a low level routine
> that hooks the hardware clock and uses it for retrieving the time.
>
> This clock does go down to microsecond granularity.
>
As gcc hasn't implemented the Microsoft style __rdtsc() intrinsic, we
use routinely the usual gcc 32-bit-only stuff:
unsigned long long int rdtsc( )
{
long long a;
asm volatile("rdtsc":"=A" (a));
return a;
}
which gives you a number of CPU clock ticks (on current platforms,
typically derived from the buss clock and nominal CPU clock speed ratio).
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |