public void recordProcessed(OperationTimer operationTimer) { operationTimer.end(overallTiming); }
@Override public void finish() { OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticsAggregationOperator.finish(); timer.end(statisticsTiming); if (state == State.RUNNING) { state = State.FINISHING; } }
@Test public void testOperationAfterEndAreNotAllowed() { OperationTiming timing = new OperationTiming(); OperationTimer timer = new OperationTimer(true, false); timer.end(timing); assertThatThrownBy(() -> timer.end(timing)).isInstanceOf(IllegalStateException.class); assertThatThrownBy(() -> timer.recordOperationComplete(timing)).isInstanceOf(IllegalStateException.class); }
@Override public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(needsInput(), "Operator does not need input"); Block[] blocks = new Block[columnChannels.size()]; for (int outputChannel = 0; outputChannel < columnChannels.size(); outputChannel++) { blocks[outputChannel] = page.getBlock(columnChannels.get(outputChannel)); } OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticAggregationOperator.addInput(page); timer.end(statisticsTiming); ListenableFuture<?> blockedOnAggregation = statisticAggregationOperator.isBlocked(); CompletableFuture<?> future = pageSink.appendPage(new Page(blocks)); updateMemoryUsage(); ListenableFuture<?> blockedOnWrite = toListenableFuture(future); blocked = allAsList(blockedOnAggregation, blockedOnWrite); rowCount += page.getPositionCount(); updateWrittenBytes(); }
@Override public void addInput(Page page) { requireNonNull(page, "page is null"); checkState(state == State.RUNNING, "Operator is %s", state); Block rowCountBlock = page.getBlock(ROW_COUNT_CHANNEL); Block fragmentBlock = page.getBlock(FRAGMENT_CHANNEL); for (int position = 0; position < page.getPositionCount(); position++) { if (!rowCountBlock.isNull(position)) { rowCount += BIGINT.getLong(rowCountBlock, position); } if (!fragmentBlock.isNull(position)) { fragmentBuilder.add(VARBINARY.getSlice(fragmentBlock, position)); } } extractStatisticsRows(page).ifPresent(statisticsPage -> { OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticsAggregationOperator.addInput(statisticsPage); timer.end(statisticsTiming); }); }
@Override public void finish() { ListenableFuture<?> currentlyBlocked = blocked; OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); statisticAggregationOperator.finish(); timer.end(statisticsTiming); ListenableFuture<?> blockedOnAggregation = statisticAggregationOperator.isBlocked(); ListenableFuture<?> blockedOnFinish = NOT_BLOCKED; if (state == State.RUNNING) { state = State.FINISHING; finishFuture = pageSink.finish(); blockedOnFinish = toListenableFuture(finishFuture); updateWrittenBytes(); } this.blocked = allAsList(currentlyBlocked, blockedOnAggregation, blockedOnFinish); }
OperationTimer timer = new OperationTimer(statisticsCpuTimerEnabled); Page aggregationOutput = statisticAggregationOperator.getOutput(); timer.end(statisticsTiming);
timer.end(statisticsTiming);