public void logSelectionStats() {
    if (LOG.isDebugEnabled()) {
      final var notSelectedTxs = getNotSelectedTransactions();
      final Map<TransactionSelectionResult, Long> notSelectedStats =
          notSelectedTxs.values().stream()
              .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));

      LOG.debug(
          "Selection stats: Totals[Evaluated={}, Selected={}, NotSelected={}, Discarded={}]; Detailed[{}]",
          selectedTransactions.size() + notSelectedTxs.size(),
          selectedTransactions.size(),
          notSelectedTxs.size(),
          notSelectedStats.entrySet().stream()
              .filter(e -> e.getKey().discard())
              .map(Map.Entry::getValue)
              .mapToInt(Long::intValue)
              .sum(),
          notSelectedStats.entrySet().stream()
              .map(e -> e.getKey().toString() + "=" + e.getValue())
              .sorted()
              .collect(Collectors.joining(", ")));
    }
  }
Access to this field needs to be guarded, since it is possible to read it while another
processing thread is writing, when the selection time is over.
ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/TransactionSelectionResults.java