core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/statistic/OSessionStoragePerformanceStatistic.java
private void makeSnapshotIfNeeded(long currentTime) {
    if (currentTime < 0) {
      currentTime = nanoTimer.getNano();
    }

    if (lastSnapshotTimestamp == -1)
      lastSnapshotTimestamp = 0;

    if (lastSnapshotTimestamp < 0 || currentTime - lastSnapshotTimestamp >= intervalBetweenSnapshots) {
      snapshot = new PerformanceSnapshot(performanceCountersHolder, countersByComponent, writCacheCountersHolder,
          storageCountersHolder, walCountersHolder);
      lastSnapshotTimestamp = currentTime;
    }

    if (cleanUpInterval > 0) {
      if (currentTime - lastCleanUpTimeStamp >= cleanUpInterval) {
        performanceCountersHolder.clean();

        for (PerformanceCountersHolder pch : countersByComponent.values()) {
          pch.clean();
        }

        if (writCacheCountersHolder != null)
          writCacheCountersHolder.clean();

        if (storageCountersHolder != null)
          storageCountersHolder.clean();

        if (writCacheCountersHolder != null)
          walCountersHolder.clean();

        lastCleanUpTimeStamp = currentTime;
      }
    }
  }
private void makeSnapshotIfNeeded(long currentTime) {
    if (currentTime < 0) {
      currentTime = nanoTimer.getNano();
    }

    if (lastSnapshotTimestamp == -1)
      lastSnapshotTimestamp = 0;

    if (lastSnapshotTimestamp < 0 || currentTime - lastSnapshotTimestamp >= intervalBetweenSnapshots) {
      snapshot = new PerformanceSnapshot(performanceCountersHolder, countersByComponent, writCacheCountersHolder,
          storageCountersHolder, walCountersHolder);
      lastSnapshotTimestamp = currentTime;
    }

    if (cleanUpInterval > 0) {
      if (currentTime - lastCleanUpTimeStamp >= cleanUpInterval) {
        performanceCountersHolder.clean();

        for (PerformanceCountersHolder pch : countersByComponent.values()) {
          pch.clean();
        }

        if (writCacheCountersHolder != null)
          writCacheCountersHolder.clean();

        if (storageCountersHolder != null)
          storageCountersHolder.clean();

        if (writCacheCountersHolder != null)
          walCountersHolder.clean();

        lastCleanUpTimeStamp = currentTime;
      }
    }
  }
Makes snapshot of data if time for next snapshot is passed. Also clear all data if {@link #cleanUpInterval} interval is over.

@param currentTime Time of last measurement in nanoseconds or -1 if time is unknown