I wonder how best to measure the runtime of some C ++ code. Is there a class built into the Stopwatch (.Net)? I am developing C ++ on VS2010. How (if) can I use .Net libraries inside my C ++ project? Thanks in advance.
AFAIK C ++ does not have a standard class such as a stopwatch in .NET.
http://cplus.about.com/od/howtodothingsi2/a/timing.htm is an example of a high-resolution timer on the Windows platform.
Regardless of the platform for such timers: http://www.boost.org/libs/timer/doc/index.html
NTN
http://code.google.com/p/cpp-stopwatch, ++, Visual Studio. , .
You can use QueryPerformanceCounter to get the best time to “profile” some code (it is not perfect, but should be enough to run you).
BOOL WINAPI QueryPerformanceCounter( __out LARGE_INTEGER *lpPerformanceCount );
http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx .