Methods Summary |
---|
public void | beginItem()Start timing an item.
beginItem("No Description");
|
public void | beginItem(java.lang.String desc)Start timing an item.
//if(currItem != null)
//Reporter.assert(currItem.hasEnded());
currItem = new Item(desc);
items.add(currItem);
++numBegins;
|
public void | endItem()Stop timing an item and store the information.
++numEnds;
Item item = getLastNotEnded();
if(item != null)
item.end();
++numActualEnds;
|
private com.sun.enterprise.util.diagnostics.ProfilerImpl$Item | getLastNotEnded()
int index = items.size();
while(--index >= 0)
{
Item item = (Item)items.get(index);
if(!item.hasEnded())
return item;
}
return null;
|
public static void | main(java.lang.String[] notUsed)Simple unit test
////////////////////////////////////////////////////////////////////////////
ProfilerImpl p = new ProfilerImpl();
try
{
p.beginItem("first item");
Thread.sleep(3000);
p.beginItem("second item here dude whoa yowser yowser");
Thread.sleep(1500);
p.endItem();
p.endItem();
System.out.println("" + p);
}
catch(Exception e)
{
}
|
public void | reset()Reset all the timing information
currItem = null;
items.clear();
numBegins = 0;
numEnds = 0;
numActualEnds = 0;
|
public java.lang.String | toString()Return a formatted String with the timing information
StringBuffer sb = new StringBuffer();
sb.append("\nBegins: " + numBegins + ", Ends: " + numEnds +
", Actual Ends: " + numActualEnds + "\n");
sb.append(Item.getHeader());
sb.append("\n");
for(Iterator iter = items.iterator(); iter.hasNext(); )
{
Item item = (Item)iter.next();
sb.append(item.toString());
sb.append("\n");
}
return sb.toString();
|