RevisionGCStats implements RevisionGCStatsCollector, RevisionGCStatsMBean { @Override public void finished(VersionGCStats stats) { activeTimer.update(stats.active.elapsed(MICROSECONDS), MICROSECONDS); readDocTimer.update(stats.collectDeletedDocsElapsed, MICROSECONDS); checkDeletedTimer.update(stats.checkDeletedDocsElapsed, MICROSECONDS); deletedDocTimer.update(stats.deleteDeletedDocsElapsed, MICROSECONDS); deletedSplitDocTimer.update(stats.collectAndDeleteSplitDocsElapsed, MICROSECONDS); sortIdsTimer.update(stats.sortDocIdsElapsed, MICROSECONDS); resetDeletedFlagTimer.update(stats.updateResurrectedDocumentsElapsed, MICROSECONDS); if (!stats.success) { failureCounter.inc(); } } RevisionGCStats(StatisticsProvider provider); @Override void documentRead(); @Override void documentsDeleted(long numDocs); @Override void leafDocumentsDeleted(long numDocs); @Override void splitDocumentsDeleted(long numDocs); @Override void intermediateSplitDocumentsDeleted(long numDocs); @Override void deletedOnceFlagReset(); @Override void started(); @Override void finished(VersionGCStats stats); @Override long getReadDocCount(); @Override long getDeletedDocCount(); @Override long getDeletedLeafDocCount(); @Override long getDeletedSplitDocCount(); @Override long getDeletedIntSplitDocCount(); @Override long getResetDeletedFlagCount(); @Override CompositeData getReadDocHistory(); @Override CompositeData getDeletedDocHistory(); @Override CompositeData getDeletedLeafDocHistory(); @Override CompositeData getDeletedSplitDocHistory(); @Override CompositeData getDeletedIntSplitDocHistory(); @Override CompositeData getResetDeletedFlagHistory();  }
@Test public void timers() { VersionGCStats vgcs = new VersionGCStats(); vgcs.collectDeletedDocsElapsed = MILLISECONDS.toMicros(2); vgcs.checkDeletedDocsElapsed = MILLISECONDS.toMicros(3); vgcs.deleteDeletedDocsElapsed = MILLISECONDS.toMicros(5); vgcs.collectAndDeleteSplitDocsElapsed = MILLISECONDS.toMicros(7); vgcs.sortDocIdsElapsed = MILLISECONDS.toMicros(11); vgcs.updateResurrectedDocumentsElapsed = MILLISECONDS.toMicros(13); vgcs.active.start(); while (vgcs.active.elapsed(MILLISECONDS) < 5) { assertTrue(vgcs.active.isRunning()); } vgcs.active.stop(); stats.finished(vgcs); assertTimer(vgcs.active.elapsed(MILLISECONDS), RevisionGCStats.ACTIVE_TIMER); assertTimer(2, RevisionGCStats.READ_DOC_TIMER); assertTimer(3, RevisionGCStats.CHECK_DELETED_TIMER); assertTimer(5, RevisionGCStats.DELETE_DOC_TIMER); assertTimer(7, RevisionGCStats.DELETE_SPLIT_DOC_TIMER); assertTimer(11, RevisionGCStats.SORT_IDS_TIMER); assertTimer(13, RevisionGCStats.RESET_DELETED_FLAG_TIMER); }