1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

[293324] Support for executor depth in DSFExecutor traces

This commit is contained in:
Marc Khouzam 2009-10-26 16:45:41 +00:00
parent 151ca650f8
commit 29c296b980

View file

@ -88,6 +88,16 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
return Thread.currentThread().equals( ((DsfThreadFactory)getThreadFactory()).fThread ); return Thread.currentThread().equals( ((DsfThreadFactory)getThreadFactory()).fThread );
} }
/**
* @since 2.1
*/
public int getCurrentExecutionDepth() {
if (fCurrentlyExecuting != null) {
return fCurrentlyExecuting.fDepth;
}
return -1;
}
protected String getName() { protected String getName() {
return fName; return fName;
} }
@ -153,6 +163,7 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
abstract class TracingWrapper { abstract class TracingWrapper {
/** Sequence number of this runnable/callable */ /** Sequence number of this runnable/callable */
int fSequenceNumber = -1; int fSequenceNumber = -1;
int fDepth = 0;
/** Trace of where the runnable/callable was submitted to the executor */ /** Trace of where the runnable/callable was submitted to the executor */
StackTraceWrapper fSubmittedAt = null; StackTraceWrapper fSubmittedAt = null;
@ -210,6 +221,7 @@ public class DefaultDsfExecutor extends ScheduledThreadPoolExecutor
void traceExecution() { void traceExecution() {
fSequenceNumber = fSequenceCounter++; fSequenceNumber = fSequenceCounter++;
fDepth = fSubmittedBy == null ? 0 : fSubmittedBy.fDepth + 1;
fCurrentlyExecuting = this; fCurrentlyExecuting = this;
// Write to console only if tracing is enabled (as opposed to tracing or assertions). // Write to console only if tracing is enabled (as opposed to tracing or assertions).