core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/statistic/OPerformanceStatisticManager.java
private void fetchComponentCounters(String componentName, PerformanceCountersHolder componentCountersHolder) {
    //go through all threads and accumulate statistic only for live threads
    //all dead threads will be removed and statistics from them will be
    //later accumulated in #deadThreadsStatistic field, then result statistic from this field
    //will be aggregated to componentCountersHolder

    //To decrease inter thread communication delay we fetch snapshots first
    //and only after that we aggregate data from immutable snapshots
    final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<>(statistics.size());

    final List<Thread> threadsToRemove = new ArrayList<>();
    for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
      final Thread thread = entry.getKey();
      final OSessionStoragePerformanceStatistic statistic = entry.getValue();
      snapshots.add(new ORawPair<>(thread, statistic.getSnapshot()));
    }

    for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
      final Thread thread = pair.getFirst();
      if (thread.isAlive()) {
        final PerformanceSnapshot snapshot = pair.getSecond();
        final PerformanceCountersHolder holder = snapshot.countersByComponent.get(componentName);
        if (holder != null)
          holder.pushData(componentCountersHolder);
      } else {
        threadsToRemove.add(thread);
      }
    }

    if (!threadsToRemove.isEmpty()) {
      updateDeadThreadsStatistic(threadsToRemove);
    }

    final ImmutableStatistic ds = deadThreadsStatistic;
    if (ds != null) {
      final PerformanceCountersHolder dch = ds.countersByComponents.get(componentName);
      if (dch != null) {
        dch.pushData(componentCountersHolder);
      }
    }
  }
private void fetchComponentCounters(String componentName, PerformanceCountersHolder componentCountersHolder) {
    //go through all threads and accumulate statistic only for live threads
    //all dead threads will be removed and statistics from them will be
    //later accumulated in #deadThreadsStatistic field, then result statistic from this field
    //will be aggregated to componentCountersHolder

    //To decrease inter thread communication delay we fetch snapshots first
    //and only after that we aggregate data from immutable snapshots
    final Collection<ORawPair<Thread, PerformanceSnapshot>> snapshots = new ArrayList<>(statistics.size());

    final List<Thread> threadsToRemove = new ArrayList<>();
    for (Map.Entry<Thread, OSessionStoragePerformanceStatistic> entry : statistics.entrySet()) {
      final Thread thread = entry.getKey();
      final OSessionStoragePerformanceStatistic statistic = entry.getValue();
      snapshots.add(new ORawPair<>(thread, statistic.getSnapshot()));
    }

    for (ORawPair<Thread, PerformanceSnapshot> pair : snapshots) {
      final Thread thread = pair.getFirst();
      if (thread.isAlive()) {
        final PerformanceSnapshot snapshot = pair.getSecond();
        final PerformanceCountersHolder holder = snapshot.countersByComponent.get(componentName);
        if (holder != null)
          holder.pushData(componentCountersHolder);
      } else {
        threadsToRemove.add(thread);
      }
    }

    if (!threadsToRemove.isEmpty()) {
      updateDeadThreadsStatistic(threadsToRemove);
    }

    final ImmutableStatistic ds = deadThreadsStatistic;
    if (ds != null) {
      final PerformanceCountersHolder dch = ds.countersByComponents.get(componentName);
      if (dch != null) {
        dch.pushData(componentCountersHolder);
      }
    }
  }
Iterates over all live threads and accumulates performance statics gathered form threads for provided component,
also accumulates statistic from dead threads which were alive when when gathering of performance measurements is started.

@param componentCountersHolder Holder which is used to accumulate all performance statistic data for given component
@param componentName           Name of component