- Mar 12, 2000
- 8,324
- 2
- 0
Does anyone know of a quick and easy way to find out the time it takes to compute a function or perform some kind of process in Visual C++?
Right now, I'm trying to use the time functions in "time.h" but their resolution is very poor. It seems like it can't measure anything that takes less than 1 second (it reports that 0 seconds have occurred). Of course, most computers are so fast that it takes less than one second to perform an action. Is there any other timing functions that have a finer resolution (like in the miliseconds)?
************************************
// Start timer
start = time(NULL);
myFunction();
// Get ending time
end = time(NULL);
cout << "The function took about " << difftime(end, start) << " seconds to perform.\n\n";
