Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > Re: Time measurement using RDTSC instruction

Reply
Fix Vista Errors
Thread Tools Display Modes

Re: Time measurement using RDTSC instruction

 
 
Tim Roberts
Guest
Posts: n/a

 
      11-04-2009



jslim <> wrote:
>
>I implemented my own device driver which generates software interrupt
>( INT n).
>And I want to measure the execution time of my interrupt service
>routine.
>The execution time is too small to measure using nornal time function.


No, it's not, at least in this case.

>What I tried to do is "RDTSC" as follows
>
>void myISR()
>{
> __asm{
> RDTSC
> MOV first_lowvalue, EAX
> MOV first_highvalue, EDX
> }
>
> // Some code of my ISR
>
> __asm{
> RDTSC
> MOV second_lowvalue, EAX
> MOV second_highvalue, EDX
> }
>}


There are intrinsics for this.

__int64 first = __rdtsc();
// code
__int64 second = __rdtsc();
__int64 delta = second - first;

>After doing this, I could get some value of RDTSC
>first : 16756678044338
>second : 16756736846933
>subtraction : 58802595
>
>What is the meaning of "Subtraction : 58802595"?
>Is that core clock cycle??
>MSDN said that "RDTSC time stamp is the number of clock cycles since
>the last reset"
>Then how can I change this into time( unit of nano sec, micro sec or
>milli sec )?


How can you possibly include assembler instructions in your driver when you
don't know what they do?

58 million cycles. On a typical 2 GHz processor, that's 29 milliseconds,
which is way, way, WAAAAY too long for an ISR. Your ISR should run in a
few microseconds -- thousands or tens of thousands of cycles, no more.
Time-consuming processing needs to be deferred to a DPC.
--
Tim Roberts,
Providenza & Boekelheide, Inc.
 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error reports what do they mean Joe83 Windows Vista Hardware 1 06-07-2007 04:35 AM
Anomolous settings in Date & Time control dialogued displayed Michael F. LaTerz Windows Vista Performance 1 10-31-2006 12:17 AM
synch date & time Vianney ActiveSync 10 01-12-2006 01:27 AM
Time Zone when synchronizing Calendar with Server Promotoz ActiveSync 0 12-21-2005 08:01 PM
Why does my iPaq 2200 keep losing time???????????????? Anonymous ActiveSync 16 10-14-2004 07:31 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59