FileDocCategorySizeDatePackage
Profiler.javaAPI DocGlassfish v2 API4555Fri May 04 22:35:54 BST 2007com.sun.enterprise.tools.common.util.diagnostics

Profiler

public class Profiler extends Object
author
bnevins
version

Fields Summary
Item
currItem
List
items
Constructors Summary
public Profiler()

    
Methods Summary
public voidbeginItem()

		beginItem("No Description"); // NOI18N
	
public voidbeginItem(java.lang.String desc)

		//if(currItem != null)
			//Reporter.assertIt(currItem.hasEnded());
		
		currItem = new Item(desc);
		items.add(currItem);
	
public voidendItem()

		Item item = getLastNotEnded();
		
		if(item != null)
			item.end();
	
private com.sun.enterprise.tools.common.util.diagnostics.Profiler$ItemgetLastNotEnded()

		int index = items.size();
		
		while(--index >= 0)
		{
			Item item = (Item)items.get(index);
			
			if(!item.hasEnded())
				return item;
		}
		return null;
	
public static voidmain(java.lang.String[] notUsed)


	    
	
		Profiler p = new Profiler();
		
		try
		{
			p.beginItem("first item"); // NOI18N
			Thread.sleep(3000);
			p.beginItem("second item here dude whoa yowser yowser"); // NOI18N
			Thread.sleep(1500);
			p.endItem();
			p.endItem();
			System.out.println("" + p); // NOI18N
		}
		catch(Exception e)
		{
		}
	
public voidreport()

		
	
public java.lang.StringtoString()

		StringBuffer sb = new StringBuffer(Item.getHeader());
		sb.append("\n\n"); // NOI18N
		
		for(Iterator iter = items.iterator(); iter.hasNext(); )
		{
			Item item = (Item)iter.next();
			sb.append(item.toString());
			sb.append("\n"); // NOI18N
		}
		return sb.toString();