You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/01/11 16:44:57 UTC
[1/2] incubator-tinkerpop git commit: Fix the way
DependantMutableMetrics profiler durations are calculated.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master b4cb00dd7 -> 1e5dcaf67
Fix the way DependantMutableMetrics profiler durations are calculated.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/20891069
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/20891069
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/20891069
Branch: refs/heads/master
Commit: 208910695b3b37bfc7a80c3cdfe945c931edf2c5
Parents: b44253d
Author: rjbriody <bo...@datastax.com>
Authored: Thu Jan 7 15:52:19 2016 -0500
Committer: rjbriody <bo...@datastax.com>
Committed: Thu Jan 7 15:52:19 2016 -0500
----------------------------------------------------------------------
.../traversal/util/DependantMutableMetrics.java | 34 +++++++++++---------
.../process/traversal/util/MutableMetrics.java | 3 +-
2 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/20891069/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DependantMutableMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DependantMutableMetrics.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DependantMutableMetrics.java
index fd580fe..0ce939a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DependantMutableMetrics.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DependantMutableMetrics.java
@@ -18,9 +18,11 @@
*/
package org.apache.tinkerpop.gremlin.process.traversal.util;
+import java.util.concurrent.TimeUnit;
+
/**
* This Metrics class handles a metrics chain in which durations are "double counted" by upstream metrics. Durations are
- * corrected on-the-fly by subtracting upstream durations on every call to stop().
+ * corrected upon retrieval by subtracting upstream durations.
*
* @author Bob Briody (http://bobbriody.com)
*/
@@ -38,22 +40,24 @@ public class DependantMutableMetrics extends MutableMetrics {
this.upStreamMetrics = upStreamMetrics;
}
- public void start() {
- super.start();
- }
-
- public void stop() {
- super.stop();
- // root step will not have an upstream metrics
- if (upStreamMetrics != null) {
- // subtract time that is "double counted" by upstream metrics
- super.durationNs -= upStreamMetrics.getAndResetIncrementalDur();
+ /**
+ * Returns the actual duration taken by this Metrics by subtracting the duration taken by the upstream Step, if one exists.
+ * @param unit
+ * @return
+ */
+ @Override
+ public long getDuration(final TimeUnit unit) {
+ if (upStreamMetrics == null){
+ return unit.convert(super.durationNs, unit);
+ } else {
+ // upStreamMetrics exists. Subtract that duration since it is time not spent in this step.
+ return unit.convert(super.durationNs - upStreamMetrics.durationNs, unit);
}
}
- public long getAndResetIncrementalDur() {
- long incrementalDur = super.durationNs - prevDur;
- prevDur = super.durationNs;
- return incrementalDur;
+ @Override
+ protected void copyMembers(final ImmutableMetrics clone) {
+ super.copyMembers(clone);
+ clone.durationNs = this.getDuration(TimeUnit.NANOSECONDS);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/20891069/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/MutableMetrics.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/MutableMetrics.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/MutableMetrics.java
index 5305020..72c1076 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/MutableMetrics.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/MutableMetrics.java
@@ -157,9 +157,10 @@ public class MutableMetrics extends ImmutableMetrics implements Cloneable {
return clone;
}
- private void copyMembers(final ImmutableMetrics clone) {
+ protected void copyMembers(final ImmutableMetrics clone) {
clone.id = this.id;
clone.name = this.name;
+ // Note: This value is overwritten in the DependantMutableMetrics overridden copyMembers method.
clone.durationNs = this.durationNs;
for (Map.Entry<String, AtomicLong> c : this.counts.entrySet()) {
clone.counts.put(c.getKey(), new AtomicLong(c.getValue().get()));
[2/2] incubator-tinkerpop git commit: Merge branch
'TINKERPOP-1075-fix-profile-duration-cap-step' of
https://github.com/rjbriody/incubator-tinkerpop
Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1075-fix-profile-duration-cap-step' of https://github.com/rjbriody/incubator-tinkerpop
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1e5dcaf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1e5dcaf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1e5dcaf6
Branch: refs/heads/master
Commit: 1e5dcaf67e3b4aed2ea03ba59b902481d775118c
Parents: b4cb00d 2089106
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Jan 11 08:44:46 2016 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Mon Jan 11 08:44:46 2016 -0700
----------------------------------------------------------------------
.../traversal/util/DependantMutableMetrics.java | 34 +++++++++++---------
.../process/traversal/util/MutableMetrics.java | 3 +-
2 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------