You can use the Stopwatch class to do that very easily. See MSDN for more info.
A note of caution if you want to use ns precision:
(From this thread:
http://groups.google.com/group/micro...3c2bcaba6ff09c
)
"One should not use Elapsed.Ticks to calculate the elapsed time in
nanoseconds.
The only correct way to get this high precision count is by using
Stopwatch.ElapsedTicks like this:
long nanosecPerTick = (1000L*1000L*1000L) / Stopwatch.Frequency;
....
long ticks = sw.ElapsedTicks;
Console.WriteLine("{0} nanoseconds", ticks * nanosecPerTick);
or use Stopwatch.ElapsedMiliseconds.
--
Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
"eladla" wrote:
Hi all,
I have a function in C++/CLI that calls a native C++ function.
I want the C++/CLI function to measure the time between the call to the
unmanaged function and the return to the managed function.
Can anyone point me in the right direction?
I don`t really know where to start and have not found anything on google or
MSDN NGs.
Thanks!