private static class MethodTraceAspect.TraceData extends java.lang.Object implements MethodTraceAspect.ElapsedTimeable
The numeric fields which track invocation count and elapsed time are intended to be accessed directly by outside code, potentially on different threads. Updates to these fields individually are guaranteed to be atomic, but updates to all fields are not. Thus, there is a small window of opportunity for some of these fields and not others to be updated as data collection ends and the data is post-processed. This may introduce a small inconsistency in the data. However, given the purpose of profiling to get an overview of many method invocations, this potential for minor inconsistency is deemed acceptable, in order to avoid the overhead of thread synchronization during data collection.
Modifier and Type | Field and Description |
---|---|
private MethodTraceAspect.MethodIdentifier |
callee
The invoked method
|
private MethodTraceAspect.MethodIdentifier |
caller
The invoking method
|
(package private) java.util.concurrent.atomic.AtomicLong |
count
Number of times method has been invoked
|
(package private) java.util.concurrent.atomic.AtomicLong |
elapsed
Aggregate elapsed time spent in method (includes aspect overhead and called methods)
|
(package private) java.util.concurrent.atomic.AtomicLong |
ownTime
Aggregate own time spent in method, not including called (traced) methods
|
Constructor and Description |
---|
TraceData(MethodTraceAspect.MethodIdentifier caller,
MethodTraceAspect.MethodIdentifier callee)
Constructor which accepts an identifier of the invoked method.
|
Modifier and Type | Method and Description |
---|---|
long |
getElapsed()
Get the aggregate elapsed time for all method calls held by this trace data.
|
java.lang.String |
toString()
Debug string representation.
|
final java.util.concurrent.atomic.AtomicLong count
final java.util.concurrent.atomic.AtomicLong elapsed
final java.util.concurrent.atomic.AtomicLong ownTime
private final MethodTraceAspect.MethodIdentifier caller
private final MethodTraceAspect.MethodIdentifier callee
TraceData(MethodTraceAspect.MethodIdentifier caller, MethodTraceAspect.MethodIdentifier callee)
caller
- Invoking method.callee
- Invoked method.public long getElapsed()
getElapsed
in interface MethodTraceAspect.ElapsedTimeable
public java.lang.String toString()
toString
in class java.lang.Object