/** * Utility method for formatting a duration in nano seconds * into a human readable string. * @param nanos number of nano seconds * @return human readable string */ public static String formatTime(long nanos) { return TimeDurationFormatter.forLogging().format(nanos, TimeUnit.NANOSECONDS); }
/** * Utility method for formatting a duration in nano seconds * into a human readable string. * @param nanos number of nano seconds * @return human readable string */ public static String formatTime(long nanos) { return TimeDurationFormatter.forLogging().format(nanos, TimeUnit.NANOSECONDS); }
private String estimatePendingTraversal(double nodesPerSecond) { if (estimatedCount >= 0) { if (estimatedCount > traversalCount){ long pending = estimatedCount - traversalCount; long timeRequired = (long)(pending / nodesPerSecond); double percentComplete = ((double) traversalCount/estimatedCount) * 100; return String.format("(Elapsed %s, Expected %s, Completed %1.2f%%)", watch, TimeDurationFormatter.forLogging().format(timeRequired, TimeUnit.SECONDS), percentComplete ); } else { return String.format("(Elapsed %s)", watch); } } return ""; }
private String estimatePendingTraversal(double nodesPerSecond) { if (estimatedCount >= 0) { if (estimatedCount > traversalCount){ long pending = estimatedCount - traversalCount; long timeRequired = (long)(pending / nodesPerSecond); double percentComplete = ((double) traversalCount/estimatedCount) * 100; return String.format("(Elapsed %s, Expected %s, Completed %1.2f%%)", watch, TimeDurationFormatter.forLogging().format(timeRequired, TimeUnit.SECONDS), percentComplete ); } else { return String.format("(Elapsed %s)", watch); } } return ""; }
private String estimatePendingTraversal(double nodesPerSecond) { if (estimatedCount >= 0) { if (estimatedCount > traversalCount){ long pending = estimatedCount - traversalCount; long timeRequired = (long)(pending / nodesPerSecond); double percentComplete = ((double) traversalCount/estimatedCount) * 100; return String.format("(Elapsed %s, Expected %s, Completed %1.2f%%)", watch, TimeDurationFormatter.forLogging().format(timeRequired, TimeUnit.SECONDS), percentComplete ); } else { return String.format("(Elapsed %s)", watch); } } return ""; }
private VersionGCStats gc(long maxRevisionAgeInMillis) throws IOException { VersionGCStats stats = new VersionGCStats(); stats.active.start(); Recommendations rec = new Recommendations(maxRevisionAgeInMillis, options); GCPhases phases = new GCPhases(cancel, stats, gcMonitor); try { if (rec.ignoreDueToCheckPoint) { phases.stats.ignoredGCDueToCheckPoint = true; monitor.skipped("Checkpoint prevented revision garbage collection"); cancel.set(true); } else { final RevisionVector headRevision = nodeStore.getHeadRevision(); final RevisionVector sweepRevisions = nodeStore.getSweepRevisions(); monitor.info("Looking at revisions in {}", rec.scope); collectDeletedDocuments(phases, headRevision, rec); collectSplitDocuments(phases, sweepRevisions, rec); } } catch (LimitExceededException ex) { stats.limitExceeded = true; } finally { phases.close(); stats.canceled = cancel.get(); } rec.evaluate(stats); monitor.info("Revision garbage collection finished in {}. {}", TimeDurationFormatter.forLogging().format(phases.elapsed.elapsed(MICROSECONDS), MICROSECONDS), stats); stats.active.stop(); return stats; }
private VersionGCStats gc(long maxRevisionAgeInMillis) throws IOException { VersionGCStats stats = new VersionGCStats(); stats.active.start(); Recommendations rec = new Recommendations(maxRevisionAgeInMillis, options); GCPhases phases = new GCPhases(cancel, stats, gcMonitor); try { if (rec.ignoreDueToCheckPoint) { phases.stats.ignoredGCDueToCheckPoint = true; monitor.skipped("Checkpoint prevented revision garbage collection"); cancel.set(true); } else { final RevisionVector headRevision = nodeStore.getHeadRevision(); final RevisionVector sweepRevisions = nodeStore.getSweepRevisions(); monitor.info("Looking at revisions in {}", rec.scope); collectDeletedDocuments(phases, headRevision, rec); collectSplitDocuments(phases, sweepRevisions, rec); } } catch (LimitExceededException ex) { stats.limitExceeded = true; } finally { phases.close(); stats.canceled = cancel.get(); } rec.evaluate(stats); monitor.info("Revision garbage collection finished in {}. {}", TimeDurationFormatter.forLogging().format(phases.elapsed.elapsed(MICROSECONDS), MICROSECONDS), stats); stats.active.stop(); return stats; }