|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsofya.ed.structural.SequenceTraceWriter
public final class SequenceTraceWriter
The sequence trace writer is responsible for generating basic block and branch edge sequence trace files from the event streams produced by a structural event dispatcher.
@author Alex Kinneer
@version 04/24/2006
| Field Summary | |
|---|---|
static java.lang.String |
relaySocketAddr
Machine address to which the relay socket will attempt to connect. |
static int |
relaySocketPort
Port to which the relay socket will attempt to connect. |
| Constructor Summary | |
|---|---|
SequenceTraceWriter()
Creates a new sequence trace writer using the default configuration. |
|
SequenceTraceWriter(boolean toSocket,
java.lang.String preData,
java.lang.String postData,
java.lang.String trName,
boolean appendToTrace)
Creates a new sequence trace writer. |
|
| Method Summary | |
|---|---|
void |
callBlockExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a call block was executed. |
void |
callBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a call branch was executed. |
void |
codeBlockExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a general basic block was executed. |
void |
commitEventStream(int streamId)
Notification that an event stream has completed. |
java.util.List |
configure(java.util.List params)
Configures this component from command line parameters. |
void |
entryBlockExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that an entry block was executed. |
void |
entryBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that an entry branch was executed. |
void |
exitBlockExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that an exit block was executed. |
java.lang.String |
getPostData()
Gets the data set to be inserted at the end of the trace. |
java.lang.String |
getPreData()
Gets the data set to be inserted at the beginning of the trace. |
java.lang.String |
getTraceFileName()
Gets the name of the trace file that will be written. |
void |
ifBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that an if branch was executed. |
void |
initialize()
Initializes the event listener. |
boolean |
isAppending()
Reports whether the trace writer is set to append the trace data for the current event stream to any existing trace file or whether it will overwrite it. |
boolean |
isForJUnit()
Reports whether trace files are being generated from JUnit test cases. |
boolean |
isReady()
Reports whether this component is ready for the event dispatcher to begin dispatching events. |
void |
methodEnterEvent(java.lang.String classAndSignature,
int count)
Notification that a new method has been entered. |
void |
newEventStream(int streamId)
Notification that a new event stream is starting. |
void |
otherBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a summary branch was executed. |
void |
register(EventDispatcherConfiguration edConfig)
Registers this component with the event dispatcher. |
void |
release()
Notifies this component that its current lifecycle has expired and that it should commit any stored state and release resources. |
void |
reset()
Notifies this component to clear its configuration and reset any internal state. |
void |
returnBlockExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a return block was executed. |
void |
setAppending(boolean enable)
Sets whether the trace writer will append the trace data for the current event stream to any existing trace file or whether it will overwrite it. |
void |
setForJUnit(boolean enable)
Specifies whether trace files are being generated from JUnit test cases. |
void |
setPostData(java.lang.String data)
Sets the data to be inserted at the end of the trace. |
void |
setPreData(java.lang.String data)
Sets the data to be inserted at the beginning of the trace. |
void |
setTraceFileName(java.lang.String value)
Sets the name of the trace file to be written. |
void |
switchBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a switch branch was executed. |
void |
throwBranchExecuteEvent(java.lang.String classAndSignature,
int id)
Notification that a throws branch was executed. |
void |
useRelaySocket(boolean enable)
Sets whether the trace writer is to relay trace information to a socket. |
boolean |
usingRelaySocket()
Reports whether the trace writer will relay trace information to a socket. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String relaySocketAddr
public static final int relaySocketPort
| Constructor Detail |
|---|
public SequenceTraceWriter()
public SequenceTraceWriter(boolean toSocket,
java.lang.String preData,
java.lang.String postData,
java.lang.String trName,
boolean appendToTrace)
toSocket - Flag to indicate whether trace information should be
related to a socket.preData - Data to be inserted at the beginning of each trace.postData - Data to be appended at the end of each trace.trName - Name of the trace file to be created.appendToTrace - Flag specifying whether the trace writer should
append current trace data to any existing trace file of the same name.| Method Detail |
|---|
public void register(EventDispatcherConfiguration edConfig)
ActiveComponentRegisters this component with the event dispatcher.
This method is called each time an event dispatcher prepares to
initiate a new event stream, caused by a call to
ProgramEventDispatcher.startDispatcher().
register in interface ActiveComponentedConfig - The current configuration of system global resources
and settings that the component may (and should) use as appropriate.public java.util.List configure(java.util.List params)
ActiveComponentConfigures this component from command line parameters.
This method provides a component the opportunity to define and process command line parameters required to configure itself. Components participate in a processing chain, initiated in Sofya-provided event dispatchers by calling this method on the processing strategy. The processing strategies provided by Sofya in turn invoke this method on any listeners implementing this interface.
configure in interface ActiveComponentparams - A list of command line tokens that have not yet
been processed by any previous components.
public void reset()
ActiveComponentNotifies this component to clear its configuration and reset any internal state.
Calls to this method are chained similary to the ActiveComponent.configure(java.util.List)
method. This method is invoked by the event dispatcher prior to
reconfiguration. Normally it should be used to clear any configuration
state to avoid using stale values.
reset in interface ActiveComponentpublic boolean isReady()
ActiveComponentReports whether this component is ready for the event dispatcher to begin dispatching events.
Calls to this method are chained similarly to the ActiveComponent.configure(java.util.List)
method. The event dispatcher will fail with an error if a client
invokes ProgramEventDispatcher.startDispatcher() when any
attached component returns false from this method.
isReady in interface ActiveComponenttrue if this component is ready for the event
dispatcher to begin dispatching events, false otherwise.public void initialize()
BlockEventListenerInitializes the event listener. Listeners that need to perform configuration or setup of state that will persist across multiple event streams should implement this method.
This method is called automatically by a
JUnitEventDispatcher prior to beginning
execution of test cases. It is the responsibility of the applications
using other event dispatchers to call this method at the appropriate
time.
initialize in interface BlockEventListenerinitialize in interface BranchEventListenerpublic void release()
ActiveComponentNotifies this component that its current lifecycle has expired and that it should commit any stored state and release resources.
Calls to this method are chained similary to the ActiveComponent.configure(java.util.List)
method. This method is invoked directly by a client of the event
dispatcher. Normally, it should be used to release any resources that
were required to persist over multiple runs of the event dispatcher.
release in interface ActiveComponentpublic boolean isAppending()
true if the trace writer will append the trace
data for the current event stream to any existing trace file,
false otherwise.public void setAppending(boolean enable)
enable - true if the trace writer is to append the
trace data for the current event stream to any existing trace file,
false otherwise.public java.lang.String getTraceFileName()
public void setTraceFileName(java.lang.String value)
value - The name of the trace file to be written.public boolean usingRelaySocket()
true if trace information will be relayed to
a socket, false otherwise.
public void useRelaySocket(boolean enable)
throws java.lang.IllegalStateException
enable - true to specify that trace data should
be sent to a socket, false to specify that trace data
should be written to file.
java.lang.IllegalStateExceptionpublic java.lang.String getPreData()
public void setPreData(java.lang.String data)
throws java.lang.IllegalStateException
data - Data which will be inserted at the beginning of the
trace.
java.lang.IllegalStateExceptionpublic java.lang.String getPostData()
public void setPostData(java.lang.String data)
throws java.lang.IllegalStateException
data - Data which will be inserted at the end of the trace.
java.lang.IllegalStateExceptionpublic boolean isForJUnit()
true if trace data is being generated from JUnit
test cases, false otherwise.public void setForJUnit(boolean enable)
enable - true if trace data is being generated from
JUnit test cases, false otherwise.public void newEventStream(int streamId)
Note that if the trace writer is generating trace files, this is
the point at which a new trace file is opened for output. Any
previous trace file must be moved or copied before this event is
received unless the trace writer is configured to append to the
existing trace. This is handled automatically by when the trace
writer is being used by a JUnit SelectiveTestRunner
and the '-o' option was passed to the test runner.
newEventStream in interface BlockEventListenernewEventStream in interface BranchEventListenerstreamId - Identifier associated with the event stream, such as
a test case number.public void commitEventStream(int streamId)
Note that if the trace writer is generating trace files, this is the point at which the output stream to the trace file is closed.
commitEventStream in interface BlockEventListenercommitEventStream in interface BranchEventListenerstreamId - Identifier associated with the finished event stream,
such as a test case number.
public void methodEnterEvent(java.lang.String classAndSignature,
int count)
methodEnterEvent in interface BlockEventListenermethodEnterEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method entered.count - The number of structural entities in the method.
public void codeBlockExecuteEvent(java.lang.String classAndSignature,
int id)
BlockEventListenerNotification that a general basic block was executed.
codeBlockExecuteEvent in interface BlockEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
basic block was executed.id - Identifier of the basic block that was executed. Correlates
to the basic block identifiers reported in a
CFG.
public void callBlockExecuteEvent(java.lang.String classAndSignature,
int id)
BlockEventListenerNotification that a call block was executed.
callBlockExecuteEvent in interface BlockEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
basic block was executed.id - Identifier of the basic block that was executed. Correlates
to the basic block identifiers reported in a
CFG.
public void returnBlockExecuteEvent(java.lang.String classAndSignature,
int id)
BlockEventListenerNotification that a return block was executed.
A return block is a virtual block that does not correlate to any code in the executing program. It serves only as a marker that execution has returned to a caller following execution of a call block.
returnBlockExecuteEvent in interface BlockEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
basic block was executed.id - Identifier of the basic block that was executed. Correlates
to the basic block identifiers reported in a
CFG.
public void entryBlockExecuteEvent(java.lang.String classAndSignature,
int id)
BlockEventListenerNotification that an entry block was executed.
An entry block is a virtual block that does not correlate to any code in the executing program. It serves only as a marker that execution has entered a new method.
entryBlockExecuteEvent in interface BlockEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
basic block was executed.id - Identifier of the basic block that was executed. Correlates
to the basic block identifiers reported in a
CFG.
public void exitBlockExecuteEvent(java.lang.String classAndSignature,
int id)
BlockEventListenerNotification that an exit block was executed.
An exit block is a virtual block that does not correlate to any code in the executing program. It serves only as a marker that execution has exited a method.
There is only one normal exit block in a method, but there may be multiple exceptional exit blocks in a method.
exitBlockExecuteEvent in interface BlockEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
basic block was executed.id - Identifier of the basic block that was executed. Correlates
to the basic block identifiers reported in a
CFG.
public void ifBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that an if branch was executed.
ifBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
public void switchBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that a switch branch was executed.
switchBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
public void throwBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that a throws branch was executed.
Note that a particular throws statement is not
considered a branch if the control flow graph builder determines that
only one type of exception can ever be thrown.
throwBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
public void callBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that a call branch was executed.
callBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
public void entryBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that an entry branch was executed.
Method entry is not actually a branch, however, this event is provided for the benefit of analyses that may wish to have information about method entry inlined in the event stream as a type-compatible entity.
entryBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
public void otherBranchExecuteEvent(java.lang.String classAndSignature,
int id)
BranchEventListenerNotification that a summary branch was executed.
A summary branch is used to capture any branching of execution that causes exit from the currently executing method. This is normally associated with asynchronous exceptions and runtime exceptions that can potentially be raised at too many locations to be practically encoded in a control flow representation.
otherBranchExecuteEvent in interface BranchEventListenerclassAndSignature - Concatenation of the fully qualified class
name, method name, and JNI signature of the method in which the
branch was executed.id - Identifier of the branch that was executed. Correlates
to the branch identifiers reported in a
CFG.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||