Thursday, July 30, 2009

Is there a time function in C++ to calculate running time in microseconds?

I am looking for a time function which can help me to calculate running time for a block of C++ code in microseconds. I see time.h library but still not clear how to use them. What about gettick()?

Is there a time function in C++ to calculate running time in microseconds?
yup in c++ u have a time counter in time.h library. It is used for putting a delay of time in the execution of the program that is this gettick() ;delay() all these are used only to delay the execuion time but not to count the time in seconds.
Reply:delay() and gettick() can help you a lot. However if you need absolute time (for synchronous networking) you may need a third-part utility.
Reply:If your app runs on Windows and you are using some version of Visual C++ you can test the time that code takes to run to a very high degree of accuracy by using Kernel32.dll. A Microsoft article describes it here...


http://support.microsoft.com/default.asp...


No comments:

Post a Comment