*/
private void pop() {
boolean clean = true;
TraceRecord parent = ttop.getParent();
popException();
// Submit data if trace marker found
if (ttop.hasFlag(TraceRecord.TRACE_BEGIN)) {
int flags = ttop.getMarker().getFlags();
if ((ttop.getTime() >= ttop.getMarker().getMinimumTime() && 0 == (flags & TraceMarker.DROP_TRACE))
|| 0 != (flags & TraceMarker.SUBMIT_TRACE)) {
submit(ttop);
AgentDiagnostics.inc(AgentDiagnostics.TRACES_SUBMITTED);
clean = false;
} else {
AgentDiagnostics.inc(AgentDiagnostics.TRACES_DROPPED);
}
if (parent != null) {
parent.getMarker().inheritFlags(ttop.getMarker().getFlags());
}
}
// Determine how the top of stack should be rolled back
if (parent != null) {
if ((ttop.getTime() > Tracer.getMinMethodTime() || ttop.getErrors() > 0)
|| 0 != (ttop.getMarker().getFlags() & TraceMarker.ALL_METHODS)) {
if (!ttop.hasFlag(TraceRecord.OVERFLOW_FLAG)) {
reparentTop(parent);
} else {
parent.getMarker().markFlags(TraceMarker.OVERFLOW_FLAG);
}
clean = false;
}
parent.setCalls(parent.getCalls() + ttop.getCalls());
parent.setErrors(parent.getErrors() + ttop.getErrors());
}
if (clean) {
ttop.clean();
numRecords--;
} else {
if (parent != null) {
ttop = parent;
} else {
ttop = new TraceRecord(null);
numRecords = 0;
}
}
}