Methods Summary |
---|
public long | endTrace()
// If we have calls on the stack when the trace ends, then clean up
// the stack and compute the inclusive time of the methods by pretending
// that we are exiting from their methods now.
while (mCurrent != mRoot) {
long duration = mLastEventTime - mCurrent.mThreadStartTime;
pop();
Call caller = top();
mCurrent.addInclusiveTime(duration, caller);
mCurrent.mGlobalEndTime = mGlobalEndTime;
if (caller == null) {
caller = mRoot;
}
mCurrent = caller;
}
return mLastEventTime;
|
private void | enter(Call c, long elapsed)
Call caller = mCurrent;
push(c);
// Check the stack for a matching method to determine if this call
// is recursive.
MethodData md = c.mMethodData;
Integer num = mStackMethods.get(md);
if (num == null) {
num = 0;
} else if (num > 0) {
c.setRecursive(true);
}
num += 1;
mStackMethods.put(md, num);
mCurrent = c;
// Add the elapsed time to the caller's exclusive time
caller.addExclusiveTime(elapsed);
|
private void | exit(Call c, long elapsed, long globalTime)
mCurrent.mGlobalEndTime = globalTime;
Call top = pop();
if (top == null) {
return;
}
if (mCurrent.mMethodData != c.mMethodData) {
String error = "Method exit (" + c.getName()
+ ") does not match current method (" + mCurrent.getName()
+ ")";
throw new RuntimeException(error);
} else {
long duration = c.mThreadStartTime - mCurrent.mThreadStartTime;
Call caller = top();
mCurrent.addExclusiveTime(elapsed);
mCurrent.addInclusiveTime(duration, caller);
if (caller == null) {
caller = mRoot;
}
mCurrent = caller;
}
|
public Call | getCalltreeRoot()
return mRoot;
|
public long | getCpuTime()
return mCpuTime;
|
public long | getGlobalEndTime()
return mGlobalEndTime;
|
public long | getGlobalStartTime()
return mGlobalStartTime;
|
public int | getId()
return mId;
|
public Call | getLastContextSwitch()
return mLastContextSwitch;
|
public long | getLastEventTime()
return mLastEventTime;
|
public java.lang.String | getName()
return mName;
|
void | handleCall(Call call, long globalTime)
mIsEmpty = false;
long currentTime = call.mThreadStartTime;
if (currentTime < mLastEventTime) {
System.err
.printf(
"ThreadData: '%1$s' call time (%2$d) is less than previous time (%3$d) for thread '%4$s'\n",
call.getName(), currentTime, mLastEventTime, mName);
System.exit(1);
}
long elapsed = currentTime - mLastEventTime;
mCpuTime += elapsed;
if (call.getMethodAction() == 0) {
// This is a method entry.
enter(call, elapsed);
} else {
// This is a method exit.
exit(call, elapsed, globalTime);
}
mLastEventTime = currentTime;
mGlobalEndTime = globalTime;
|
public boolean | isEmpty()
return mIsEmpty;
|
public Call | pop()
ArrayList<Call> stack = mStack;
if (stack.size() == 0)
return null;
Call top = stack.get(stack.size() - 1);
stack.remove(stack.size() - 1);
// Decrement the count on the method in the hash table and remove
// the entry when it goes to zero.
MethodData md = top.mMethodData;
Integer num = mStackMethods.get(md);
if (num != null) {
num -= 1;
if (num <= 0) {
mStackMethods.remove(md);
} else {
mStackMethods.put(md, num);
}
}
return top;
|
public void | push(Call c)
mStack.add(c);
|
public void | setCpuTime(long cpuTime)
mCpuTime = cpuTime;
|
public void | setGlobalEndTime(long globalEndTime)
mGlobalEndTime = globalEndTime;
|
public void | setGlobalStartTime(long globalStartTime)
mGlobalStartTime = globalStartTime;
|
public void | setLastContextSwitch(Call lastContextSwitch)
mLastContextSwitch = lastContextSwitch;
|
public void | setLastEventTime(long lastEventTime)
mLastEventTime = lastEventTime;
|
public java.lang.String | toString()
return mName;
|
public Call | top()
ArrayList<Call> stack = mStack;
if (stack.size() == 0)
return null;
return stack.get(stack.size() - 1);
|