Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>May I suggest my own open source profiler raven::set::cRunWatch? It is designed for exactly this problem and works on Windows using Visual Studio 2008 Standard Edition, so you do not need to pay for the version that has the profiler included.</p> <p>I have taken your code, rearranged it slightly so it compiles without forward declarations and added the necessary calls to cRunWatch</p> <pre><code>// RunWatchDemo.cpp : Defines the entry point for the console application. // #include "stdafx.h" void highly_optimised_subroutine() { raven::set::cRunWatch runwatch("highly_optimised_subroutine"); Sleep( 2 ); } void badly_written_function() { raven::set::cRunWatch runwatch("badly_written_function"); for (int k = 1; k &lt; 1000; k++ ) { highly_optimised_subroutine(); } } void well_written_function() { raven::set::cRunWatch runwatch("well_written_function"); for (int k = 1; k &lt; 10; k++ ) { highly_optimised_subroutine(); } } int _tmain(int argc, _TCHAR* argv[]) { raven::set::cRunWatch::Start(); well_written_function(); badly_written_function(); raven::set::cRunWatch::Report(); return 0; } </code></pre> <p>When run this produces the output</p> <pre><code>raven::set::cRunWatch code timing profile Scope Calls Mean (secs) Total highly_optimised_subroutine 1008 0.002921 2.944146 badly_written_function 1 2.926662 2.926662 well_written_function 1 0.026239 0.026239 </code></pre> <p>This shows badly_written_function to be the very close second time user, and therefore the culprit.</p> <p>You can obtain cRunWatch from <a href="http://66.199.140.183/cgi-bin/ravenset.cgi/index" rel="nofollow noreferrer">here</a> You will recognize the sample code in the User Guide :-)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload