@Override public void workerIterationEnd(final Memory memory) { // store profile metrics in proper ProfileStep metrics if (this.profile) { List<ProfileStep> profileSteps = TraversalHelper.getStepsOfAssignableClassRecursively(ProfileStep.class, this.traversal.get()); // guess the profile step to store data int profileStepIndex = memory.getIteration(); // if we guess wrongly write timing into last step profileStepIndex = profileStepIndex >= profileSteps.size() ? profileSteps.size() - 1 : profileStepIndex; this.iterationMetrics.finish(0); // reset counts this.iterationMetrics.setCount(TraversalMetrics.TRAVERSER_COUNT_ID,0); if (null != MemoryTraversalSideEffects.getMemorySideEffectsPhase(this.traversal.get())) { this.traversal.get().getSideEffects().add(profileSteps.get(profileStepIndex).getId(), this.iterationMetrics); } this.iterationMetrics = null; } }
@Override public Traverser.Admin<S> next() { Traverser.Admin<S> start = null; this.initializeIfNeeded(); this.metrics.start(); try { start = super.next(); return start; } finally { if (start != null) { this.metrics.finish(start.bulk()); if (this.onGraphComputer) { this.getTraversal().getSideEffects().add(this.getId(), this.metrics); this.metrics = null; } } else { this.metrics.stop(); if (this.onGraphComputer) { this.getTraversal().getSideEffects().add(this.getId(), this.metrics); this.metrics = null; } } } }
@Override public void workerIterationEnd(final Memory memory) { // store profile metrics in proper ProfileStep metrics if (this.profile) { List<ProfileStep> profileSteps = TraversalHelper.getStepsOfAssignableClassRecursively(ProfileStep.class, this.traversal.get()); // guess the profile step to store data int profileStepIndex = memory.getIteration(); // if we guess wrongly write timing into last step profileStepIndex = profileStepIndex >= profileSteps.size() ? profileSteps.size() - 1 : profileStepIndex; this.iterationMetrics.finish(0); // reset counts this.iterationMetrics.setCount(TraversalMetrics.TRAVERSER_COUNT_ID,0); if (null != MemoryTraversalSideEffects.getMemorySideEffectsPhase(this.traversal.get())) { this.traversal.get().getSideEffects().add(profileSteps.get(profileStepIndex).getId(), this.iterationMetrics); } this.iterationMetrics = null; } }
@Override public Traverser.Admin<S> next() { Traverser.Admin<S> start = null; this.initializeIfNeeded(); this.metrics.start(); try { start = super.next(); return start; } finally { if (start != null) { this.metrics.finish(start.bulk()); if (this.onGraphComputer) { this.getTraversal().getSideEffects().add(this.getId(), this.metrics); this.metrics = null; } } else { this.metrics.stop(); if (this.onGraphComputer) { this.getTraversal().getSideEffects().add(this.getId(), this.metrics); this.metrics = null; } } } }