Re: Time measurement using RDTSC instruction
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Tue, 03 Nov 2009 22:37:39 -0800
jslim <gomting00@xxxxxxxxx> 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, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
.
- References:
- Time measurement using RDTSC instruction
- From: jslim
- Time measurement using RDTSC instruction
- Prev by Date: Re: Install issues on Win 7 RC Ultimate 64-bit
- Next by Date: Re: Why the disk driver (disk.sys) can not receive a PDO(physical device object) that is created by a class(disk) low filter driver?
- Previous by thread: Re: Time measurement using RDTSC instruction
- Next by thread: Re: Time measurement using RDTSC instruction
- Index(es):
Relevant Pages
|