Search in sources :

Example 1 with StatsAndCosts

use of io.prestosql.cost.StatsAndCosts in project hetu-core by openlookeng.

the class QueryMonitor method createQueryStatistics.

private QueryStatistics createQueryStatistics(QueryInfo queryInfo) {
    ImmutableList.Builder<String> operatorSummaries = ImmutableList.builder();
    for (OperatorStats summary : queryInfo.getQueryStats().getOperatorSummaries()) {
        operatorSummaries.add(operatorStatsCodec.toJson(summary));
    }
    Optional<StatsAndCosts> planNodeStatsAndCosts = queryInfo.getOutputStage().map(StatsAndCosts::create);
    Optional<String> serializedPlanNodeStatsAndCosts = planNodeStatsAndCosts.map(statsAndCostsCodec::toJson);
    QueryStats queryStats = queryInfo.getQueryStats();
    return new QueryStatistics(ofMillis(queryStats.getTotalCpuTime().toMillis()), ofMillis(queryStats.getTotalScheduledTime().toMillis()), ofMillis(queryStats.getQueuedTime().toMillis()), Optional.of(ofMillis(queryStats.getResourceWaitingTime().toMillis())), Optional.of(ofMillis(queryStats.getAnalysisTime().toMillis())), Optional.of(ofMillis(queryStats.getDistributedPlanningTime().toMillis())), queryStats.getPeakUserMemoryReservation().toBytes(), queryStats.getPeakTotalMemoryReservation().toBytes(), queryStats.getPeakTaskUserMemory().toBytes(), queryStats.getPeakTaskTotalMemory().toBytes(), queryStats.getPhysicalInputDataSize().toBytes(), queryStats.getPhysicalInputPositions(), queryStats.getInternalNetworkInputDataSize().toBytes(), queryStats.getInternalNetworkInputPositions(), queryStats.getRawInputDataSize().toBytes(), queryStats.getRawInputPositions(), queryStats.getOutputDataSize().toBytes(), queryStats.getOutputPositions(), queryStats.getLogicalWrittenDataSize().toBytes(), queryStats.getWrittenPositions(), queryStats.getCumulativeUserMemory(), queryStats.getStageGcStatistics(), queryStats.getCompletedDrivers(), queryInfo.isCompleteInfo(), getCpuDistributions(queryInfo), operatorSummaries.build(), serializedPlanNodeStatsAndCosts);
}
Also used : QueryStats(io.prestosql.execution.QueryStats) QueryStatistics(io.prestosql.spi.eventlistener.QueryStatistics) ImmutableList(com.google.common.collect.ImmutableList) StatsAndCosts(io.prestosql.cost.StatsAndCosts) OperatorStats(io.prestosql.operator.OperatorStats)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 StatsAndCosts (io.prestosql.cost.StatsAndCosts)1 QueryStats (io.prestosql.execution.QueryStats)1 OperatorStats (io.prestosql.operator.OperatorStats)1 QueryStatistics (io.prestosql.spi.eventlistener.QueryStatistics)1