presto-main/src/main/java/io/prestosql/execution/QueryStateTimer.java/QueryStateTimer/endQuery
class QueryStateTimer:    private void endQuery(long now)
    {
        beginFinishing(now);
        finishingTime.compareAndSet(null, nanosSince(beginFinishingNanos, now));
        executionTime.compareAndSet(null, nanosSince(beginPlanningNanos, now));
        endNanos.compareAndSet(null, now);

        // Analysis is run in separate thread and there is no query state for analysis.
        // In case when analysis thread was canceled the analysis should be marked as finished.
        if (beginAnalysisNanos.get() == null) {
            analysisTime.compareAndSet(null, succinctNanos(0));
        }
        else {
            endAnalysis(now);
        }
    }