tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject tinkerpop git commit: TINKERPOP-1130 Made the test data for metrics static.
Date Thu, 15 Dec 2016 19:00:12 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1130 a400a53bb -> ff5e4b025


TINKERPOP-1130 Made the test data for metrics static.

This helps prevent the data from regenerating on every build.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ff5e4b02
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ff5e4b02
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ff5e4b02

Branch: refs/heads/TINKERPOP-1130
Commit: ff5e4b02589c52d94becea4387d15b59aa1558fe
Parents: a400a53
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Thu Dec 15 13:58:20 2016 -0500
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Thu Dec 15 13:58:20 2016 -0500

----------------------------------------------------------------------
 .../process/traversal/util/MutableMetrics.java  |   2 +-
 .../tinkerpop/gremlin/structure/io/Model.java   |  63 ++++++++++++++-----
 .../_3_2_3/manual-graphson-generator.groovy     |  48 ++++++++++++--
 .../graphson/_3_2_3/metrics-v2d0-no-types.json  |  14 ++---
 .../graphson/_3_2_3/metrics-v2d0-partial.json   |  14 ++---
 .../_3_2_3/traversalmetrics-v2d0-no-types.json  |  18 +++---
 .../_3_2_3/traversalmetrics-v2d0-partial.json   |  18 +++---
 .../graphson/_3_3_0/metrics-v2d0-no-types.json  |  14 ++---
 .../graphson/_3_3_0/metrics-v2d0-partial.json   |  14 ++---
 .../_3_3_0/traversalmetrics-v2d0-no-types.json  |  18 +++---
 .../_3_3_0/traversalmetrics-v2d0-partial.json   |  18 +++---
 .../io/gryo/_3_2_3/manual-gryo-generator.groovy |  48 ++++++++++++--
 .../structure/io/gryo/_3_2_3/metrics-v1d0.kryo  | Bin 185 -> 187 bytes
 .../io/gryo/_3_2_3/traversalmetrics-v1d0.kryo   | Bin 429 -> 294 bytes
 .../structure/io/gryo/_3_3_0/metrics-v1d0.kryo  | Bin 185 -> 187 bytes
 .../io/gryo/_3_3_0/traversalmetrics-v1d0.kryo   | Bin 429 -> 294 bytes
 16 files changed, 201 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/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 19e2069..0ed3a7b 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
@@ -54,7 +54,7 @@ public class MutableMetrics extends ImmutableMetrics implements Cloneable
{
         other.getNested().forEach(nested -> this.addNested(new MutableMetrics(nested)));
     }
 
-    public void addNested(MutableMetrics metrics) {
+    public void addNested(final MutableMetrics metrics) {
         this.nested.put(metrics.getId(), metrics);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
b/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
index 26f70bc..1123e89 100644
--- a/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
+++ b/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics;
 import org.apache.tinkerpop.gremlin.structure.Column;
@@ -71,6 +72,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -139,16 +141,16 @@ public class Model {
         addGraphProcessEntry(TraversalOptionParent.Pick.any, "Pick");
         addGraphProcessEntry(Pop.all, "Pop");
         addGraphProcessEntry(org.apache.tinkerpop.gremlin.util.function.Lambda.function("{
it.get() }"), "Lambda");
-        final TraversalMetrics tm = g.V().hasLabel("person").out().out().tree().profile().next();
-        final MutableMetrics metrics = new MutableMetrics(tm.getMetrics(0));
-        metrics.addNested(new MutableMetrics(tm.getMetrics(1)));
+        final TraversalMetrics tm = createStaticTraversalMetrics();
+        final MutableMetrics metrics = new MutableMetrics(tm.getMetrics("7.0.0()"));
+        metrics.addNested(new MutableMetrics(tm.getMetrics("3.0.0()")));
         addGraphProcessEntry(metrics, "Metrics");
         addGraphProcessEntry(P.gt(0), "P");
         addGraphProcessEntry(P.gt(0).and(P.lt(10)), "P and", "", GRAPHSON_ONLY);
         addGraphProcessEntry(P.gt(0).or(P.within(-1, -10, -100)), "P or", "", GRAPHSON_ONLY);
         addGraphProcessEntry(Scope.local, "Scope");
         addGraphProcessEntry(T.label, "T", "", GRYO_ONLY);
-        addGraphProcessEntry(g.V().hasLabel("person").out().out().tree().profile().next(),
"TraversalMetrics");
+        addGraphProcessEntry(createStaticTraversalMetrics(), "TraversalMetrics");
         addGraphProcessEntry(g.V().hasLabel("person").asAdmin().nextTraverser(), "Traverser");
 
         final Map<String,Object> requestBindings = new HashMap<String,Object>(){{
@@ -221,7 +223,41 @@ public class Model {
         addExtendedEntry(ZonedDateTime.of(2016, 12, 23, 12, 12, 24, 36, ZoneId.of("GMT+2")),
"ZonedDateTime");
         addExtendedEntry(ZoneOffset.ofHoursMinutesSeconds(3, 6, 9), "ZoneOffset", "The following
example is a `ZoneOffset` of three hours, six minutes, and nine seconds.");
     }
-    
+
+    private static DefaultTraversalMetrics createStaticTraversalMetrics() {
+        // based on g.V().hasLabel("person").out().out().tree().profile().next()
+        final List<MutableMetrics> traversalMutableMetrics = new ArrayList<>();
+        final MutableMetrics m7 = new MutableMetrics("7.0.0()", "TinkerGraphStep(vertex,[~label.eq(person)])");
+        m7.setDuration(100, TimeUnit.MILLISECONDS);
+        m7.setCount("traverserCount", 4);
+        m7.setCount("elementCount", 4);
+        m7.setAnnotation("percentDur", 25.0d);
+        traversalMutableMetrics.add(m7);
+
+        final MutableMetrics m2 = new MutableMetrics("2.0.0()", "VertexStep(OUT,vertex)");
+        m2.setDuration(100, TimeUnit.MILLISECONDS);
+        m2.setCount("traverserCount", 13);
+        m2.setCount("elementCount", 13);
+        m2.setAnnotation("percentDur", 25.0d);
+        traversalMutableMetrics.add(m2);
+
+        final MutableMetrics m3 = new MutableMetrics("3.0.0()", "VertexStep(OUT,vertex)");
+        m3.setDuration(100, TimeUnit.MILLISECONDS);
+        m3.setCount("traverserCount", 7);
+        m3.setCount("elementCount", 7);
+        m3.setAnnotation("percentDur", 25.0d);
+        traversalMutableMetrics.add(m3);
+
+        final MutableMetrics m4 = new MutableMetrics("4.0.0()", "TreeStep");
+        m4.setDuration(100, TimeUnit.MILLISECONDS);
+        m4.setCount("traverserCount", 1);
+        m4.setCount("elementCount", 1);
+        m4.setAnnotation("percentDur", 25.0d);
+        traversalMutableMetrics.add(m4);
+
+        return new DefaultTraversalMetrics(4000, traversalMutableMetrics);
+    }
+
     public static Model instance() {
         return model;
     }
@@ -327,28 +363,25 @@ public class Model {
         headers.add("resource");
         headers.addAll(compatibilities.stream().map(c -> {
             if (c instanceof GryoCompatibility)
-                return ((GryoCompatibility) c).name();
+                return "gryo-" + ((GryoCompatibility) c).name();
             else if (c instanceof GraphSONCompatibility)
-                return ((GraphSONCompatibility) c).name();
+                return "graphson-" + ((GraphSONCompatibility) c).name();
             else
                 throw new IllegalStateException("No support for the provided Compatibility
type");
         }).collect(Collectors.toList()));
 
         try (final PrintWriter writer = new PrintWriter(f)) {
-            writer.println(String.join("\t", headers));
+            writer.println(String.join(",", headers));
 
             final List<Entry> sorted = new ArrayList<>(entries());
             Collections.sort(sorted, (o1, o2) -> o1.getResourceName().compareTo(o2.getResourceName()));
 
             sorted.forEach(e -> {
                 writer.write(e.getResourceName());
-                writer.write("\t");
-                compatibilities.forEach(c -> {
-                    writer.print(e.isCompatibleWith(c));
-                    writer.print("\t");
-                });
-
-                writer.println();
+                writer.write(",");
+                final List<String> compatibleList = new ArrayList<>();
+                compatibilities.forEach(c -> compatibleList.add(Boolean.toString(e.isCompatibleWith(c))));
+                writer.println(String.join(",", compatibleList));
             });
         }
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/manual-graphson-generator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/manual-graphson-generator.groovy
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/manual-graphson-generator.groovy
index a3117c7..2e6c5bc 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/manual-graphson-generator.groovy
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/manual-graphson-generator.groovy
@@ -17,6 +17,10 @@
  * under the License.
  */
 
+
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics
+import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics
+
 import java.time.*
 import java.nio.file.*
 import org.apache.tinkerpop.gremlin.driver.ser.*
@@ -29,6 +33,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.*
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent.Pick
 import org.apache.tinkerpop.gremlin.structure.io.gryo.*
 
+import java.util.concurrent.TimeUnit
+
 new File("dev-docs/").mkdirs()
 new File("test-case-data/io/graphson").mkdirs()
 
@@ -126,6 +132,40 @@ writeSupportedV1Objects = { writer, mapper ->
     writer.write(toJsonV1d0NoTypes(ZoneOffset.ofHoursMinutesSeconds(3, 6, 9), "ZoneOffset",
mapper, "The following example is a `ZoneOffset` of three hours, six minutes, and nine seconds."))
 }
 
+createStaticTraversalMetrics = {
+    // based on g.V().hasLabel("person").out().out().tree().profile().next()
+    def traversalMutableMetrics = new ArrayList<>()
+    def m7 = new MutableMetrics("7.0.0()", "TinkerGraphStep(vertex,[~label.eq(person)])")
+    m7.setDuration(100, TimeUnit.MILLISECONDS)
+    m7.setCount("traverserCount", 4)
+    m7.setCount("elementCount", 4)
+    m7.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m7)
+
+    def m2 = new MutableMetrics("2.0.0()", "VertexStep(OUT,vertex)")
+    m2.setDuration(100, TimeUnit.MILLISECONDS)
+    m2.setCount("traverserCount", 13)
+    m2.setCount("elementCount", 13)
+    m2.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m2)
+
+    def m3 = new MutableMetrics("3.0.0()", "VertexStep(OUT,vertex)")
+    m3.setDuration(100, TimeUnit.MILLISECONDS)
+    m3.setCount("traverserCount", 7)
+    m3.setCount("elementCount", 7)
+    m3.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m3)
+
+    def m4 = new MutableMetrics("4.0.0()", "TreeStep")
+    m4.setDuration(100, TimeUnit.MILLISECONDS)
+    m4.setCount("traverserCount", 1)
+    m4.setCount("elementCount", 1)
+    m4.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m4)
+
+    return new DefaultTraversalMetrics(4000, traversalMutableMetrics)
+}
+
 mapper = GraphSONMapper.build().
         addRegistry(TinkerIoRegistry.getInstance()).
         addCustomModule(new AbstractGraphSONMessageSerializerV1d0.GremlinServerModule()).
@@ -180,16 +220,16 @@ writeSupportedV2Objects = { writer, mapper, toJsonFunction ->
     writer.write(toJsonFunction(Order.incr, "Order", mapper))
     writer.write(toJsonFunction(Pop.all, "Pop", mapper))
     writer.write(toJsonFunction(org.apache.tinkerpop.gremlin.util.function.Lambda.function("{
it.get() }"), "Lambda", mapper))
-    tm = g.V().hasLabel('person').out().out().tree().profile().next()
-    metrics = new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(0));
-    metrics.addNested(new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(1)));
+    def tm = createStaticTraversalMetrics()
+    def metrics = new MutableMetrics(tm.getMetrics("7.0.0()"))
+    metrics.addNested(new MutableMetrics(tm.getMetrics("3.0.0()")))
     writer.write(toJsonFunction(metrics, "Metrics", mapper))
     writer.write(toJsonFunction(P.gt(0), "P", mapper))
     writer.write(toJsonFunction(P.gt(0).and(P.lt(10)), "P and", mapper))
     writer.write(toJsonFunction(P.gt(0).or(P.within(-1, -10, -100)), "P or", mapper))
     writer.write(toJsonFunction(Scope.local, "Scope", mapper))
     writer.write(toJsonFunction(T.label, "T", mapper))
-    writer.write(toJsonFunction(g.V().hasLabel('person').out().out().tree().profile().next(),
"TraversalMetrics", mapper))
+    writer.write(toJsonFunction(createStaticTraversalMetrics(), "TraversalMetrics", mapper))
     writer.write(toJsonFunction(g.V().hasLabel('person').nextTraverser(), "Traverser", mapper))
 
     writer.write("\n")

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-no-types.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-no-types.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-no-types.json
index 9d647f0..1855cb5 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-no-types.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-no-types.json
@@ -1,24 +1,24 @@
 {
-  "dur" : 0.112874,
+  "dur" : 100.0,
   "counts" : {
     "traverserCount" : 4,
     "elementCount" : 4
   },
   "name" : "TinkerGraphStep(vertex,[~label.eq(person)])",
   "annotations" : {
-    "percentDur" : 12.93474299884718
+    "percentDur" : 25.0
   },
   "id" : "7.0.0()",
   "metrics" : [ {
-    "dur" : 0.2619,
+    "dur" : 100.0,
     "counts" : {
-      "traverserCount" : 13,
-      "elementCount" : 13
+      "traverserCount" : 7,
+      "elementCount" : 7
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 30.012307452540675
+      "percentDur" : 25.0
     },
-    "id" : "2.0.0()"
+    "id" : "3.0.0()"
   } ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-partial.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-partial.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-partial.json
index 5d2a919..7b1e964 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-partial.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/metrics-v2d0-partial.json
@@ -3,7 +3,7 @@
   "@value" : {
     "dur" : {
       "@type" : "g:Double",
-      "@value" : 0.173382
+      "@value" : 100.0
     },
     "counts" : {
       "traverserCount" : {
@@ -19,7 +19,7 @@
     "annotations" : {
       "percentDur" : {
         "@type" : "g:Double",
-        "@value" : 17.538702446366866
+        "@value" : 25.0
       }
     },
     "id" : "7.0.0()",
@@ -28,26 +28,26 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.259902
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
             "@type" : "g:Int64",
-            "@value" : 13
+            "@value" : 7
           },
           "elementCount" : {
             "@type" : "g:Int64",
-            "@value" : 13
+            "@value" : 7
           }
         },
         "name" : "VertexStep(OUT,vertex)",
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 26.29075592169684
+            "@value" : 25.0
           }
         },
-        "id" : "2.0.0()"
+        "id" : "3.0.0()"
       }
     } ]
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-no-types.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-no-types.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-no-types.json
index 604a166..06fc02d 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-no-types.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-no-types.json
@@ -1,47 +1,47 @@
 {
-  "dur" : 1.101297,
+  "dur" : 0.004,
   "metrics" : [ {
-    "dur" : 0.224678,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 4,
       "elementCount" : 4
     },
     "name" : "TinkerGraphStep(vertex,[~label.eq(person)])",
     "annotations" : {
-      "percentDur" : 20.401217836786987
+      "percentDur" : 25.0
     },
     "id" : "7.0.0()"
   }, {
-    "dur" : 0.323779,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 13,
       "elementCount" : 13
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 29.399789520901265
+      "percentDur" : 25.0
     },
     "id" : "2.0.0()"
   }, {
-    "dur" : 0.276658,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 7,
       "elementCount" : 7
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 25.121107203597212
+      "percentDur" : 25.0
     },
     "id" : "3.0.0()"
   }, {
-    "dur" : 0.276182,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 1,
       "elementCount" : 1
     },
     "name" : "TreeStep",
     "annotations" : {
-      "percentDur" : 25.077885438714535
+      "percentDur" : 25.0
     },
     "id" : "4.0.0()"
   } ]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-partial.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-partial.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-partial.json
index b40c565..fdd18a4 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-partial.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_2_3/traversalmetrics-v2d0-partial.json
@@ -3,14 +3,14 @@
   "@value" : {
     "dur" : {
       "@type" : "g:Double",
-      "@value" : 0.701505
+      "@value" : 0.004
     },
     "metrics" : [ {
       "@type" : "g:Metrics",
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.100826
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -26,7 +26,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 14.372812738326884
+            "@value" : 25.0
           }
         },
         "id" : "7.0.0()"
@@ -36,7 +36,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.169312
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -52,7 +52,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 24.135537166520553
+            "@value" : 25.0
           }
         },
         "id" : "2.0.0()"
@@ -62,7 +62,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.268548
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -78,7 +78,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 38.28169435713217
+            "@value" : 25.0
           }
         },
         "id" : "3.0.0()"
@@ -88,7 +88,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.162819
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -104,7 +104,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 23.209955738020398
+            "@value" : 25.0
           }
         },
         "id" : "4.0.0()"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-no-types.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-no-types.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-no-types.json
index 10495e1..1855cb5 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-no-types.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-no-types.json
@@ -1,24 +1,24 @@
 {
-  "dur" : 0.206618,
+  "dur" : 100.0,
   "counts" : {
     "traverserCount" : 4,
     "elementCount" : 4
   },
   "name" : "TinkerGraphStep(vertex,[~label.eq(person)])",
   "annotations" : {
-    "percentDur" : 18.82133676326716
+    "percentDur" : 25.0
   },
   "id" : "7.0.0()",
   "metrics" : [ {
-    "dur" : 0.274299,
+    "dur" : 100.0,
     "counts" : {
-      "traverserCount" : 13,
-      "elementCount" : 13
+      "traverserCount" : 7,
+      "elementCount" : 7
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 24.9865638658172
+      "percentDur" : 25.0
     },
-    "id" : "2.0.0()"
+    "id" : "3.0.0()"
   } ]
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-partial.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-partial.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-partial.json
index 54a034a..7b1e964 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-partial.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/metrics-v2d0-partial.json
@@ -3,7 +3,7 @@
   "@value" : {
     "dur" : {
       "@type" : "g:Double",
-      "@value" : 0.206618
+      "@value" : 100.0
     },
     "counts" : {
       "traverserCount" : {
@@ -19,7 +19,7 @@
     "annotations" : {
       "percentDur" : {
         "@type" : "g:Double",
-        "@value" : 18.82133676326716
+        "@value" : 25.0
       }
     },
     "id" : "7.0.0()",
@@ -28,26 +28,26 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.274299
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
             "@type" : "g:Int64",
-            "@value" : 13
+            "@value" : 7
           },
           "elementCount" : {
             "@type" : "g:Int64",
-            "@value" : 13
+            "@value" : 7
           }
         },
         "name" : "VertexStep(OUT,vertex)",
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 24.9865638658172
+            "@value" : 25.0
           }
         },
-        "id" : "2.0.0()"
+        "id" : "3.0.0()"
       }
     } ]
   }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-no-types.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-no-types.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-no-types.json
index 5b4cd6f..06fc02d 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-no-types.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-no-types.json
@@ -1,47 +1,47 @@
 {
-  "dur" : 0.599635,
+  "dur" : 0.004,
   "metrics" : [ {
-    "dur" : 0.095118,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 4,
       "elementCount" : 4
     },
     "name" : "TinkerGraphStep(vertex,[~label.eq(person)])",
     "annotations" : {
-      "percentDur" : 15.862649778615324
+      "percentDur" : 25.0
     },
     "id" : "7.0.0()"
   }, {
-    "dur" : 0.168285,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 13,
       "elementCount" : 13
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 28.064572615007464
+      "percentDur" : 25.0
     },
     "id" : "2.0.0()"
   }, {
-    "dur" : 0.142567,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 7,
       "elementCount" : 7
     },
     "name" : "VertexStep(OUT,vertex)",
     "annotations" : {
-      "percentDur" : 23.77563017502314
+      "percentDur" : 25.0
     },
     "id" : "3.0.0()"
   }, {
-    "dur" : 0.193665,
+    "dur" : 100.0,
     "counts" : {
       "traverserCount" : 1,
       "elementCount" : 1
     },
     "name" : "TreeStep",
     "annotations" : {
-      "percentDur" : 32.29714743135408
+      "percentDur" : 25.0
     },
     "id" : "4.0.0()"
   } ]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-partial.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-partial.json
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-partial.json
index ed6d4cb..fdd18a4 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-partial.json
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_3_0/traversalmetrics-v2d0-partial.json
@@ -3,14 +3,14 @@
   "@value" : {
     "dur" : {
       "@type" : "g:Double",
-      "@value" : 0.599635
+      "@value" : 0.004
     },
     "metrics" : [ {
       "@type" : "g:Metrics",
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.095118
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -26,7 +26,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 15.862649778615324
+            "@value" : 25.0
           }
         },
         "id" : "7.0.0()"
@@ -36,7 +36,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.168285
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -52,7 +52,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 28.064572615007464
+            "@value" : 25.0
           }
         },
         "id" : "2.0.0()"
@@ -62,7 +62,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.142567
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -78,7 +78,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 23.77563017502314
+            "@value" : 25.0
           }
         },
         "id" : "3.0.0()"
@@ -88,7 +88,7 @@
       "@value" : {
         "dur" : {
           "@type" : "g:Double",
-          "@value" : 0.193665
+          "@value" : 100.0
         },
         "counts" : {
           "traverserCount" : {
@@ -104,7 +104,7 @@
         "annotations" : {
           "percentDur" : {
             "@type" : "g:Double",
-            "@value" : 32.29714743135408
+            "@value" : 25.0
           }
         },
         "id" : "4.0.0()"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/manual-gryo-generator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/manual-gryo-generator.groovy
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/manual-gryo-generator.groovy
index 2d9f967..9a14e20 100644
--- a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/manual-gryo-generator.groovy
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/manual-gryo-generator.groovy
@@ -17,6 +17,10 @@
  * under the License.
  */
 
+
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics
+import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalMetrics
 import org.apache.tinkerpop.shaded.kryo.io.Output
 
 import java.time.*
@@ -31,12 +35,48 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.*
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent.Pick
 import org.apache.tinkerpop.gremlin.structure.io.gryo.*
 
+import java.util.concurrent.TimeUnit
+
 new File("dev-docs/").mkdirs()
 new File("test-case-data/io/gryo").mkdirs()
 
 graph = TinkerFactory.createTheCrew()
 g = graph.traversal()
 
+createStaticTraversalMetrics = {
+    // based on g.V().hasLabel("person").out().out().tree().profile().next()
+    def traversalMutableMetrics = new ArrayList<>()
+    def m7 = new MutableMetrics("7.0.0()", "TinkerGraphStep(vertex,[~label.eq(person)])")
+    m7.setDuration(100, TimeUnit.MILLISECONDS)
+    m7.setCount("traverserCount", 4)
+    m7.setCount("elementCount", 4)
+    m7.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m7)
+
+    def m2 = new MutableMetrics("2.0.0()", "VertexStep(OUT,vertex)")
+    m2.setDuration(100, TimeUnit.MILLISECONDS)
+    m2.setCount("traverserCount", 13)
+    m2.setCount("elementCount", 13)
+    m2.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m2)
+
+    def m3 = new MutableMetrics("3.0.0()", "VertexStep(OUT,vertex)")
+    m3.setDuration(100, TimeUnit.MILLISECONDS)
+    m3.setCount("traverserCount", 7)
+    m3.setCount("elementCount", 7)
+    m3.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m3)
+
+    def m4 = new MutableMetrics("4.0.0()", "TreeStep")
+    m4.setDuration(100, TimeUnit.MILLISECONDS)
+    m4.setCount("traverserCount", 1)
+    m4.setCount("elementCount", 1)
+    m4.setAnnotation("percentDur", 25.0d)
+    traversalMutableMetrics.add(m4)
+
+    return new DefaultTraversalMetrics(4000, traversalMutableMetrics)
+}
+
 toGryo = { o, type, mapper, suffix = "" ->
     def fileToWriteTo = new File("test-case-data/io/gryo/" + type.toLowerCase().replace("
","") + "-" + suffix + ".kryo")
     if (fileToWriteTo.exists()) fileToWriteTo.delete()
@@ -78,16 +118,16 @@ writeSupportedObjects = { mapper, toGryoFunction ->
     toGryoFunction(Order.incr, "Order", mapper)
     toGryoFunction(Pop.all, "Pop", mapper)
     toGryoFunction(org.apache.tinkerpop.gremlin.util.function.Lambda.function("{ it.get()
}"), "Lambda", mapper)
-    tm = g.V().hasLabel('person').out().out().tree().profile().next()
-    metrics = new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(0))
-    metrics.addNested(new org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics(tm.getMetrics(1)))
+    def tm = createStaticTraversalMetrics()
+    def metrics = new MutableMetrics(tm.getMetrics("7.0.0()"))
+    metrics.addNested(new MutableMetrics(tm.getMetrics("3.0.0()")))
     toGryoFunction(metrics, "Metrics", mapper)
     toGryoFunction(P.gt(0), "P", mapper)
     toGryoFunction(P.gt(0).and(P.lt(10)), "P and", mapper)
     toGryoFunction(P.gt(0).or(P.within(-1, -10, -100)), "P or", mapper)
     toGryoFunction(Scope.local, "Scope", mapper)
     toGryoFunction(T.label, "T", mapper)
-    toGryoFunction(g.V().hasLabel('person').out().out().tree().profile().next(), "TraversalMetrics",
mapper)
+    toGryoFunction(createStaticTraversalMetrics(), "TraversalMetrics", mapper)
     toGryoFunction(g.V().hasLabel('person').nextTraverser(), "Traverser", mapper)
 
     /* not directly supported yet - there is a custom serializer in the way

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/metrics-v1d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/metrics-v1d0.kryo
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/metrics-v1d0.kryo
index a160f8b..c098e38 100644
Binary files a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/metrics-v1d0.kryo
and b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/metrics-v1d0.kryo
differ

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/traversalmetrics-v1d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/traversalmetrics-v1d0.kryo
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/traversalmetrics-v1d0.kryo
index 5ac54d3..1aee9e9 100644
Binary files a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/traversalmetrics-v1d0.kryo
and b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_2_3/traversalmetrics-v1d0.kryo
differ

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/metrics-v1d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/metrics-v1d0.kryo
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/metrics-v1d0.kryo
index a46801c..c098e38 100644
Binary files a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/metrics-v1d0.kryo
and b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/metrics-v1d0.kryo
differ

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ff5e4b02/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/traversalmetrics-v1d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/traversalmetrics-v1d0.kryo
b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/traversalmetrics-v1d0.kryo
index e29154a..1aee9e9 100644
Binary files a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/traversalmetrics-v1d0.kryo
and b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_3_0/traversalmetrics-v1d0.kryo
differ


Mime
View raw message