raven::set
RunWatch User Guide
Not logged in

To start profiling:

	raven::set::cRunWatch::Start();

Notes:

To profile a code scope:

 	raven::set::cRunWatch runwatch("<unique name of scope>");

Notes:

To write a report to standard output:

	raven::set::cRunWatch::Report();

Notes:

Example of Use


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 < 1000; k++ )
    {
        highly_optimised_subroutine();
    }
}

void well_written_function()
{
 	raven::set::cRunWatch runwatch("well_written_function");
   for (int k = 1; k < 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;
}

Report produced:

raven::set::cRunWatch code timing profile
                    Scope   Calls       Mean (secs)     Total
highly_optimised_subroutine     1008    0.002923        2.946213
   badly_written_function        1      2.926662        2.926662
    well_written_function        1      0.026161        0.026161
<verbatim>