Re: Is there a faster hi resolution timer for diy profiling
- From: "colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Jan 2008 01:02:56 GMT
"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:%23pkHBg8VIHA.4740@xxxxxxxxxxxxxxxxxxxxxxx
"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
// C function that uses an intrinsic to retrieve the Processor's cycle
counter register
// Beware your CPU may not support this!
// Compile from the command line: cl /EHsc /O2 <thisfile.cpp>
#include <intrin.h>
#pragma intrinsic(__rdtsc)
extern "C"
__declspec(dllexport) unsigned __int64 __stdcall rdtsc()
{
return __rdtsc();
}
// C#
[DllImport("thisfile.dll"),SuppressUnmanagedCodeSecurity]
static extern ulong rdtsc();
...
ulong cycles = rdtsc();
Willy.
thanks that worked, however it stil takes 9000 clock cycles
wich I think is roughly about the same time ...
is that PInvoke realy so time consuming ?
what does it have todo ?
thanks
Colin =^.^=
.
- Follow-Ups:
- Re: Is there a faster hi resolution timer for diy profiling
- From: Willy Denoyette [MVP]
- Re: Is there a faster hi resolution timer for diy profiling
- From: colin
- Re: Is there a faster hi resolution timer for diy profiling
- References:
- Is there a faster hi resolution timer for diy profiling
- From: colin
- Re: Is there a faster hi resolution timer for diy profiling
- From: Willy Denoyette [MVP]
- Re: Is there a faster hi resolution timer for diy profiling
- From: Willy Denoyette [MVP]
- Re: Is there a faster hi resolution timer for diy profiling
- From: Willy Denoyette [MVP]
- Is there a faster hi resolution timer for diy profiling
- Prev by Date: Re: Destructor is not called
- Next by Date: Re: Dis-arrayed arrays
- Previous by thread: Re: Is there a faster hi resolution timer for diy profiling
- Next by thread: Re: Is there a faster hi resolution timer for diy profiling
- Index(es):
Relevant Pages
|
Loading