FileDocCategorySizeDatePackage
Profiler.javaAPI DocGlassfish v2 API3699Fri May 04 22:32:14 BST 2007com.sun.enterprise.util.diagnostics

Profiler

public class Profiler extends Object
A easy-to-use class that wraps one global ProfilerImpl object. Use it to begin and end profiling in one 'profiling thread'. I.e. use this object to get timing for sub-operations. Use separate ProfilerImpl objects to get timings for overlapping profile needs.

WARNING: Call reset at the end to avoid memory leaks.

author
bnevins
version

Fields Summary
static ProfilerImpl
profiler
Constructors Summary
private Profiler()

    
Methods Summary
public static voidbeginItem()
Start timing an item.

		profiler.beginItem();
	
public static voidbeginItem(java.lang.String desc)
Start timing an item.

param
desc - Descriptive text for the item

		profiler.beginItem(desc);
	
public static voidendItem()
Stop timing of the latest item

		profiler.endItem();
	
public static voidmain(java.lang.String[] notUsed)

param
notUsed

		try
		{
			profiler.beginItem("first item");
			Thread.sleep(3000);
			profiler.beginItem("second item here dude whoa yowser yowser");
			Thread.sleep(1500);
			profiler.endItem();
			profiler.endItem();
			System.out.println("" + profiler);
		}
		catch(Exception e)
		{
		}
	
public static java.lang.Stringreport()
return a String report of all the timings

return

		return profiler.toString();
	
public static voidreset()
Reset the global ProfilerImpl instance.

		profiler.reset();