Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics#setDuration()
The following examples show how to use
org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics#setDuration() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetricsSerializer.java From tinkerpop with Apache License 2.0 | 5 votes |
@Override protected Metrics readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException { // Consider using a custom implementation, like "DefaultMetrics" final MutableMetrics result = new MutableMetrics( context.readValue(buffer, String.class, false), context.readValue(buffer, String.class, false)); result.setDuration(context.readValue(buffer, Long.class, false), TimeUnit.NANOSECONDS); final Map<String, Long> counts = context.readValue(buffer, Map.class, false); counts.forEach(result::setCount); final Map<String, Object> annotations = context.readValue(buffer, Map.class, false); annotations.forEach(result::setAnnotation); final Collection<MutableMetrics> nestedMetrics = collectionSerializer.readValue(buffer, context); nestedMetrics.forEach(result::addNested); return result; }
Example 2
Source File: Model.java From tinkerpop with Apache License 2.0 | 5 votes |
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); }