private void renderTime(XMLWriter writer, Result result) {
        if ( ! result.getQuery().getPresentation().getTiming()) return;

        final String threeDecimals = "%.3f";
        final double milli = .001d;
        final long now = System.currentTimeMillis();
        final long searchTime = now - result.getElapsedTime().first();
        final double searchSeconds = ((double) searchTime) * milli;

        if (result.getElapsedTime().firstFill() != 0L) {
            final long queryTime = result.getElapsedTime().weightedSearchTime();
            final long summaryFetchTime = result.getElapsedTime().weightedFillTime();
            final double querySeconds = ((double) queryTime) * milli;
            final double summarySeconds = ((double) summaryFetchTime) * milli;
            writer.attribute(QUERY_TIME, String.format(threeDecimals, querySeconds));
            writer.attribute(SUMMARY_FETCH_TIME, String.format(threeDecimals, summarySeconds));
        }
        writer.attribute(SEARCH_TIME, String.format(threeDecimals, searchSeconds));
    }
Creates an XML renderer using a custom executor.
Using a custom executor is useful for tests to avoid creating new threads for each renderer registry.
container-search/src/main/java/com/yahoo/search/rendering/XmlRenderer.java