|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Interface for trace recording facilities, which provide means to
create a tree of nested ActivityRecords for each thread
invoking traced methods, and a biography sequencing records of
entrances into synchronized activities for each synchronized
object. Principle: if used so that all records are created by the
TraceRecorder, provides modularity for changing the recording
mechanism without changing the traced program (e.g., see
Trace). Currently Traveler comes with two implementations:
TraceRecorderDefault and TraceRecorderObservable.
(Based in part on "Traveler: the Apiary Observatory", ECOOP'1987).
Message Passing:
Method received(java.lang.Object, java.lang.reflect.Member, java.lang.Object[]) is for callees to record call
invocation; if callee method is synchronized, received(java.lang.Object, java.lang.reflect.Member, java.lang.Object[]) must be
called while synchronization is held so that arrival order is
recorded correctly. It creates a CallRecord, links it
into records via entering(edu.mit.ai.psg.traveler.ActivityRecord) or enteredSynchronization(edu.mit.ai.psg.traveler.SynchronizationRecord),
and returns it. Method invoking(java.lang.Object, java.lang.reflect.Member, java.lang.Object[]) is for callers
to record call invocation (e.g., calls to native methods).
Methods throwing(edu.mit.ai.psg.traveler.CallRecord, java.lang.Throwable), returningVoid(edu.mit.ai.psg.traveler.CallRecord), and returning(edu.mit.ai.psg.traveler.CallRecord, java.lang.Object)
keep the call record stack current via exitting(edu.mit.ai.psg.traveler.ActivityRecord), and complete the
call record by adding the result information.
Blocks:
Method beginning(java.lang.String) starts a record for an activity described
by a string. Method doing(java.lang.String) starts and exits such an activity
(like a print statement). Method beganSynchronization(java.lang.Object, java.lang.reflect.Member)
starts an activity for a synchronization region.
Access:
Method getCurrentRecord() returns the current record for
the current thread.
Method getBiography(java.lang.Object) returns a list of records of
synchronization entries and exits on an object.
Trace,
TraceRecorderObservable| Method Summary | |
void |
addEntryToBiography(SynchronizationRecord record)
add record to biography of target of synchronization |
void |
addExitToBiography(SynchronizationRecord record)
add record to biography of target of synchronization |
SynchronizationRecord |
beganSynchronization(Object target,
Member inMember)
Creates and links a record for a synchronized region. |
ActivityRecord |
beginning(String string)
Creates and links a record for an activity (e.g., a block) described by string. |
void |
clearBiographies()
clear all biographies |
void |
clearBiography(Object target)
clear biography of target. |
ActivityRecord |
doing(ActivityRecord record)
convenience function for entering followed immediately by exitting |
ActivityRecord |
doing(String string)
Convenience function for beginning followed immedately by exitting. |
SynchronizationRecord |
enteredSynchronization(SynchronizationRecord record)
If record is not the current activity, call entering(record). |
ActivityRecord |
entering(ActivityRecord record)
Link record to parent activity within thread, and makes
record the current activity. |
ActivityRecord |
exitting(ActivityRecord record)
make parent of record, if any, the current record. |
List |
getBiography(Object target)
return a List of activities recorded for this target, e.g., traced calls on synchronized methods |
ActivityRecord |
getCurrentRecord()
get top record on activity stack; may be inherited from thread which created the current thread. |
SynchronizationRecord |
getSynchronizationHolder(Object target)
return entry record of activity currently holding synchronization on target or null if none. |
ActivityRecord |
getThreadOutermostRecord()
get bottom record on activity stack which is specific to this thread, or null. |
CallRecord |
invoking(Object target,
Member member,
Object[] parameters)
For recording a call from caller: Should be followed by call to returningVoid(edu.mit.ai.psg.traveler.CallRecord),
returning(edu.mit.ai.psg.traveler.CallRecord, java.lang.Object), or throwing(edu.mit.ai.psg.traveler.CallRecord, java.lang.Throwable) to record completion of call. |
CallRecord |
received(Object target,
Member member,
Object[] parameters)
For recording a call from callee: Should be followed by call to returningVoid(edu.mit.ai.psg.traveler.CallRecord),
returning(edu.mit.ai.psg.traveler.CallRecord, java.lang.Object), or throwing(edu.mit.ai.psg.traveler.CallRecord, java.lang.Throwable) to record completion of call. |
Object |
returning(CallRecord record,
Object value)
Record value in record, and make record parent current
activity in this thread (see exitting(edu.mit.ai.psg.traveler.ActivityRecord)) |
void |
returningVoid(CallRecord record)
record completion, and make record parent current activity in this thread (see exitting(edu.mit.ai.psg.traveler.ActivityRecord)) |
Throwable |
throwing(CallRecord record,
Throwable thrown)
Record thrown in record, and make record parent current
activity in this thread (see exitting(edu.mit.ai.psg.traveler.ActivityRecord)) |
| Method Detail |
public CallRecord received(Object target,
Member member,
Object[] parameters)
returningVoid(edu.mit.ai.psg.traveler.CallRecord),
returning(edu.mit.ai.psg.traveler.CallRecord, java.lang.Object), or throwing(edu.mit.ai.psg.traveler.CallRecord, java.lang.Throwable) to record completion of call.
Creates a CallRecord recording the invocation,
makes record the current record, returning record.
If callRecord.SynchronizationRecord.isSynchronized()()
(i.e., member is synchronized),
calls enteredSynchronization(edu.mit.ai.psg.traveler.SynchronizationRecord), else calls entering(edu.mit.ai.psg.traveler.ActivityRecord).target - target of invocation, or null for static methods
and constructors. If target is Cloneable, record will
contain a clone of target, preserving its state at
time of recording.member - member invoked, Method or Constructorparameters - array of actual parameters.
public CallRecord invoking(Object target,
Member member,
Object[] parameters)
returningVoid(edu.mit.ai.psg.traveler.CallRecord),
returning(edu.mit.ai.psg.traveler.CallRecord, java.lang.Object), or throwing(edu.mit.ai.psg.traveler.CallRecord, java.lang.Throwable) to record completion of call.
Creates a CallRecord recording the invocation,
makes record the current record, returning record.
If callRecord.SynchronizationRecord.isSynchronizedWait()(),
calls enteredSynchronization(edu.mit.ai.psg.traveler.SynchronizationRecord), else calls entering(edu.mit.ai.psg.traveler.ActivityRecord).target - target of invocation, or null for static methods
and constructors. If target is Cloneable, record will
contain a clone of target, preserving its state at
time of call.member - member invoked, Method or Constructorparameters - array of actual parameters.public void returningVoid(CallRecord record)
exitting(edu.mit.ai.psg.traveler.ActivityRecord))
public Object returning(CallRecord record,
Object value)
value in record, and make record parent current
activity in this thread (see exitting(edu.mit.ai.psg.traveler.ActivityRecord))
public Throwable throwing(CallRecord record,
Throwable thrown)
thrown in record, and make record parent current
activity in this thread (see exitting(edu.mit.ai.psg.traveler.ActivityRecord))public ActivityRecord beginning(String string)
exitting(edu.mit.ai.psg.traveler.ActivityRecord)(record).public ActivityRecord doing(String string)
public SynchronizationRecord beganSynchronization(Object target,
Member inMember)
exitting(edu.mit.ai.psg.traveler.ActivityRecord)(record).target - target of synchronization (e.g., locked object).inMember - Method or Constructor in which block
is found (used for identifying record in its print string), or null
if in a class initializerpublic ActivityRecord entering(ActivityRecord record)
record to parent activity within thread, and makes
record the current activity.
Should be followed by call to exitting(edu.mit.ai.psg.traveler.ActivityRecord) at end of activity.public SynchronizationRecord enteredSynchronization(SynchronizationRecord record)
record to biography of
record.SynchronizationRecord.getTargetNow()().
Must be called while activity holds synchronization lock (otherwise
record may not be added to biography in actual synchronization order).record.SynchronizationRecord.isSynchronized()().public ActivityRecord exitting(ActivityRecord record)
(record instanceof SynchronizationRecord &&
(record.SynchronizationRecord.isSynchronized()() ||
record.SynchronizationRecord.isSynchronizedWait()()))
create exit record and add to biography. (Also exit any child record
that haven't been exited.)public ActivityRecord doing(ActivityRecord record)
public ActivityRecord getCurrentRecord()
public ActivityRecord getThreadOutermostRecord()
public void clearBiographies()
public void clearBiography(Object target)
public List getBiography(Object target)
public SynchronizationRecord getSynchronizationHolder(Object target)
ActivityRecord.getParent().public void addEntryToBiography(SynchronizationRecord record)
recordpublic void addExitToBiography(SynchronizationRecord record)
record
|
Copyright (c) 1996-1999 Massachusetts Institute of Technology Feedback: jeva-feedback@ai.mit.edu |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||