Search code examples
.netvisual-studio-2010visual-c++stopwatch

Visual C++ Stopwatch


I wonder what is the best way to measure the execution time of some code in C++. Is there any built in Stopwatch (.Net) alike class? I am developing C++ on VS2010. How (if) can i use the .Net libraries inside my C++ project?? Thank you In advance.


Solution

  • AFAIK C++ hasn't got an standard class like the Stopwatch in .NET.

    http://cplus.about.com/od/howtodothingsi2/a/timing.htm is an example for a high resolution timer on the windows platform.

    A platform independent implementation for such timers is: http://www.boost.org/libs/timer/doc/index.html

    HTH