ExecutionProfile

To diagnose performance and timing issues an application can use the ExecutionProfile class. To use the ExecutionProfile class start by creating a new ExecutionProfile:

ExecutionProfile executionProfile = new ExecutionProfile("Timed Process");

You then start the timing of the ExecutionProfile by calling startProfile:

executionProfile.start();

To time a specific action call start and stop with a specific name:

e.start( "sleep 10" );
Thread.sleep( 10 );
e.endLastStarted();

You can also use a nested execution profile by calling:

e.startExecutionProfile( "1-0" );
e.start( "1-1-100" );
Thread.sleep( 100 );
e.endLastStarted();
e.endExecutionProfile( "1-0" );

When you are finished call end() and then print your ExecutionProfile by calling executionProfile.toString. This will print out formatted execution timings of your code:

[17:56:36.325-main][ExecutionProfileTest][INFO ] - 
[1ms.] initialBatch
------------------------------------
	[1ms.] retrieveBatch()
	------------------------------------
		[0ms.] executeQuery
		[1ms.] retrieveBatch()
		------------------------------------
			[1ms.] executeQuery
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© 2011 Metova, Inc.