mirror of https://github.com/apache/druid.git
In CPUTimeMetricQueryRunner, account CPU consumed in baseSequence.toYielder() (#3587)
This commit is contained in:
parent
2c5c8198db
commit
b113a34355
|
@ -85,11 +85,16 @@ public class CPUTimeMetricQueryRunner<T> implements QueryRunner<T>
|
|||
}
|
||||
|
||||
@Override
|
||||
public <OutType> Yielder<OutType> toYielder(
|
||||
OutType initValue, YieldingAccumulator<OutType, T> accumulator
|
||||
)
|
||||
public <OutType> Yielder<OutType> toYielder(OutType initValue, YieldingAccumulator<OutType, T> accumulator)
|
||||
{
|
||||
final Yielder<OutType> delegateYielder = baseSequence.toYielder(initValue, accumulator);
|
||||
final long start = VMUtils.getCurrentThreadCpuTime();
|
||||
final Yielder<OutType> delegateYielder;
|
||||
try {
|
||||
delegateYielder = baseSequence.toYielder(initValue, accumulator);
|
||||
}
|
||||
finally {
|
||||
cpuTimeAccumulator.addAndGet(VMUtils.getCurrentThreadCpuTime() - start);
|
||||
}
|
||||
return new Yielder<OutType>()
|
||||
{
|
||||
@Override
|
||||
|
@ -100,9 +105,7 @@ public class CPUTimeMetricQueryRunner<T> implements QueryRunner<T>
|
|||
return delegateYielder.get();
|
||||
}
|
||||
finally {
|
||||
cpuTimeAccumulator.addAndGet(
|
||||
VMUtils.getCurrentThreadCpuTime() - start
|
||||
);
|
||||
cpuTimeAccumulator.addAndGet(VMUtils.getCurrentThreadCpuTime() - start);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,9 +117,7 @@ public class CPUTimeMetricQueryRunner<T> implements QueryRunner<T>
|
|||
return delegateYielder.next(initValue);
|
||||
}
|
||||
finally {
|
||||
cpuTimeAccumulator.addAndGet(
|
||||
VMUtils.getCurrentThreadCpuTime() - start
|
||||
);
|
||||
cpuTimeAccumulator.addAndGet(VMUtils.getCurrentThreadCpuTime() - start);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue