DocumentNodeStoreStats implements DocumentNodeStoreStatsCollector { @Override public void doneBackgroundRead(BackgroundReadStats stats) { readHead.update(stats.readHead, TimeUnit.MILLISECONDS); readCacheInvalidate.update(stats.cacheInvalidationTime, TimeUnit.MILLISECONDS); readDiffCache.update(stats.populateDiffCache, TimeUnit.MILLISECONDS); readLock.update(stats.lock, TimeUnit.MILLISECONDS); readDispatch.update(stats.dispatchChanges, TimeUnit.MILLISECONDS); readTotalTime.update(stats.totalReadTime, TimeUnit.MILLISECONDS); numChangesRate.mark(stats.numExternalChanges); numChangesHisto.update(stats.numExternalChanges); changesLag.mark(stats.externalChangesLag); } DocumentNodeStoreStats(StatisticsProvider sp); @Override void doneBackgroundRead(BackgroundReadStats stats); @Override void doneBackgroundUpdate(BackgroundWriteStats stats); @Override void doneLeaseUpdate(long timeMicros); @Override void doneBranchCommit(); @Override void doneMergeBranch(int numCommits, int numChanges); @Override void doneMerge(int numChanges,
                          int numRetries,
                          long timeMillis,
                          long suspendMillis,
                          boolean exclusive); @Override void failedMerge(int numRetries, long timeMillis, long suspendMillis, boolean exclusive); @Override void doneWaitUntilHead(long waitMicros); @Override void doneMergeLockAcquired(long timeMicros); @Override void doneCommitHookProcessed(long timeMicros); @Override void doneChangesApplied(long timeMicros);  }
@Test public void backgroundRead() { BackgroundReadStats readStats = new BackgroundReadStats(); readStats.numExternalChanges = 5; stats.doneBackgroundRead(readStats); assertEquals(5, getMeter(DocumentNodeStoreStats.BGR_NUM_CHANGES_RATE).getCount()); }
@Test public void externalChangesLag() { BackgroundReadStats readStats = new BackgroundReadStats(); readStats.externalChangesLag = 42; stats.doneBackgroundRead(readStats); Meter m = getMeter(DocumentNodeStoreStats.BGR_LAG); assertEquals(42, m.getCount()); readStats.externalChangesLag = 63; stats.doneBackgroundRead(readStats); assertEquals(105, m.getCount()); }