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.