views:

65

answers:

2

I wrote a function to match fingerprint templates using VC++.NET.

Now I want to know the time it takes to execute the function.

I tried surrounding the function call statement with clock ( Standard C Library ) and computing the difference in the values returned. For some reason it always returns zero. Am I missing something here or are there alternatives?

A: 

Can you not just used the System.Diagnostics.StopWatch? I'm assuming its both the same in VC++.NET and C#.NET.

If you can then you just need VC++ equivalent of :

StopWatch sw = StopWatch.StartNew()
Func();
sw.Stop();

Might want to check out StopWatch

Ian
I think the library function that I call for actually matching the templates has a very sophisticated and efficient implementation. It just takes few hundred nanoseconds to complete. Thanks!
ardsrk
A: 

Try this out :

clock_t start , end ;

start = clock();

funct();

end = clock();

double exe_time = (end - start) / CLOCKS_PER_SEC; // in second

Ashish