C ++ Profiler on Windows

I am in the beginning with C ++, and sometimes I don’t know how much my compiler will like two different implementations of alghoritm. Is there a simple tool I can use to find out how long does my code take to execute?

EDIT: Im using a gcc compiler

+4
source share
3 answers

If you want to measure how long the whole program works, then Code-Blocks / Visual studio should tell when the program closes. It should be in the journal below.

If you want to measure how long it takes for a particular line or function, I would suggest researching clock() or QueryPerformanceFrequency() and how to use them.

The clock() function is slow, but easier to use. example:

 float start_time = clock()/CLOCKS_PER_SEC; func(); float end_time = clock()/CLOCKS_PER_SEC; float dtime = start_time - end_time; 
+2
source

I had very good experience with AQtime from Smart Bear, it is not free, but you can get a free trial. It integrates very well with Visual C ++ and RAD Studio from Embarcardero.

http://smartbear.com/products/qa-tools/application-performance-profiling

Data is easily accessible in the IDE, and especially the number of hits and the time spent on the number in the gutter section next to the line numbers are useful.

+2
source

All Articles