public class LazyProfilingListener
extends Object
implements TraceListener
Modifier and Type | Class and Description |
---|---|
static class |
LazyProfilingListener.ProfileCount
Simple data structure to keep track of counts.
|
Modifier and Type | Field and Description |
---|---|
private static LazyProfilingListener.ProfileCount |
emptyInstr
Dummy used for counting nodes when no instruction is specified
|
private ThreadLocal |
tlCountMap
Keeps a count of how many nodes are accessed by each instruction.
|
private ThreadLocal |
tlInstructionStack
Stack of instructions, used to keep track of what XSLT instruction is
being processed.
|
Constructor and Description |
---|
LazyProfilingListener() |
Modifier and Type | Method and Description |
---|---|
void |
bumpCount(int nodeNum)
Increases the count by one for the current instruction.
|
void |
close()
Unused
|
void |
endCurrentItem(Item currentItem)
Unused
|
void |
enter(InstructionInfo instruction,
XPathContext context)
Record the instruction being entered, so that subsequent counts can
be attributed to it.
|
private HashMap |
getCountMap()
Get a thread-local count map
|
LazyProfilingListener.ProfileCount[] |
getCounts()
Gets a list of all the counts, sorted by ascending count.
|
private LinkedList |
getInstructionStack()
Get a thread-local instruction stack
|
void |
leave(InstructionInfo instruction)
Called when an instruction is exited.
|
void |
open()
Unused
|
void |
printProfile()
Prints the results of a trace run, to Trace.info().
|
void |
startCurrentItem(Item currentItem)
Unused
|
private ThreadLocal tlInstructionStack
private static final LazyProfilingListener.ProfileCount emptyInstr
private ThreadLocal tlCountMap
public void open()
open
in interface TraceListener
public void close()
close
in interface TraceListener
private LinkedList getInstructionStack()
private HashMap getCountMap()
public void enter(InstructionInfo instruction, XPathContext context)
enter
in interface TraceListener
public void leave(InstructionInfo instruction)
leave
in interface TraceListener
public void startCurrentItem(Item currentItem)
startCurrentItem
in interface TraceListener
public void endCurrentItem(Item currentItem)
endCurrentItem
in interface TraceListener
public void bumpCount(int nodeNum)
public LazyProfilingListener.ProfileCount[] getCounts()
public void printProfile() throws IOException
IOException