use of io.airlift.units.Duration in project presto by prestodb.
the class QueryStateMachine method recordDoneStats.
private void recordDoneStats() {
Duration durationSinceCreation = nanosSince(createNanos).convertToMostSuccinctTimeUnit();
queuedTime.compareAndSet(null, durationSinceCreation);
totalPlanningStartNanos.compareAndSet(null, tickerNanos());
totalPlanningTime.compareAndSet(null, nanosSince(totalPlanningStartNanos.get()));
DateTime now = DateTime.now();
executionStartTime.compareAndSet(null, now);
finishingStartNanos.compareAndSet(null, tickerNanos());
finishingTime.compareAndSet(null, nanosSince(finishingStartNanos.get()));
endTime.compareAndSet(null, now);
endNanos.compareAndSet(0, tickerNanos());
}
use of io.airlift.units.Duration in project presto by prestodb.
the class QueryStateMachine method transitionToRunning.
public boolean transitionToRunning() {
Duration durationSinceCreation = nanosSince(createNanos).convertToMostSuccinctTimeUnit();
queuedTime.compareAndSet(null, durationSinceCreation);
totalPlanningStartNanos.compareAndSet(null, tickerNanos());
totalPlanningTime.compareAndSet(null, nanosSince(totalPlanningStartNanos.get()));
executionStartTime.compareAndSet(null, DateTime.now());
return queryState.setIf(RUNNING, currentState -> currentState != RUNNING && currentState != FINISHING && !currentState.isDone());
}
use of io.airlift.units.Duration in project presto by prestodb.
the class SqlQueryExecution method getTotalCpuTime.
@Override
public Duration getTotalCpuTime() {
SqlQueryScheduler scheduler = queryScheduler.get();
Optional<QueryInfo> finalQueryInfo = stateMachine.getFinalQueryInfo();
if (finalQueryInfo.isPresent()) {
return finalQueryInfo.get().getQueryStats().getTotalCpuTime();
}
if (scheduler == null) {
return new Duration(0, SECONDS);
}
return scheduler.getTotalCpuTime();
}
use of io.airlift.units.Duration in project presto by prestodb.
the class Backoff method getTimeSinceLastSuccess.
public synchronized Duration getTimeSinceLastSuccess() {
long lastSuccessfulRequest = this.lastSuccessTime;
long value = ticker.read() - lastSuccessfulRequest;
return new Duration(value, NANOSECONDS).convertToMostSuccinctTimeUnit();
}
use of io.airlift.units.Duration in project presto by prestodb.
the class TestMemoryManagerConfig method testExplicitPropertyMappings.
@Test
public void testExplicitPropertyMappings() {
Map<String, String> properties = new ImmutableMap.Builder<String, String>().put("query.low-memory-killer.enabled", "true").put("query.low-memory-killer.delay", "20s").put("query.max-memory", "2GB").build();
MemoryManagerConfig expected = new MemoryManagerConfig().setKillOnOutOfMemory(true).setKillOnOutOfMemoryDelay(new Duration(20, SECONDS)).setMaxQueryMemory(new DataSize(2, GIGABYTE));
assertFullMapping(properties, expected);
}
Aggregations