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:
parent
151ca650f8
commit
29c296b980
1 changed files with 12 additions and 0 deletions
|
@ -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).
|
||||||
|
|
Loading…
Add table
Reference in a new issue