DocumentNodeStoreStats implements DocumentNodeStoreStatsCollector { @Override public void doneBackgroundUpdate(BackgroundWriteStats stats) { writeClean.update(stats.clean, TimeUnit.MILLISECONDS); writeSplit.update(stats.split, TimeUnit.MILLISECONDS); writeSweep.update(stats.sweep, TimeUnit.MILLISECONDS); writeWrite.update(stats.write, TimeUnit.MILLISECONDS); writeTotal.update(stats.totalWriteTime, TimeUnit.MILLISECONDS); writeNum.update(stats.num); numWritesRate.mark(stats.num); } 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 backgroundWrite() { BackgroundWriteStats writeStats = new BackgroundWriteStats(); writeStats.num = 7; stats.doneBackgroundUpdate(writeStats); assertEquals(7, getMeter(DocumentNodeStoreStats.BGW_NUM_WRITES_RATE).getCount()); }