>From Ian Maxon <[email protected]>:

Ian Maxon has submitted this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17747 )

Change subject: [NO ISSUE] Post-review cleanup for profiler
......................................................................

[NO ISSUE] Post-review cleanup for profiler

- user model changes: no
- storage format changes: no
- interface changes: yes

Details:

Address open comments on the profiler change.

Change-Id: Icf2a8f66f39e39eb6a39506c9f385c623176a87d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17747
Tested-by: Jenkins <[email protected]>
Reviewed-by: Ali Alsuliman <[email protected]>
---
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledOperatorNodePushable.java
M 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledFrameWriter.java
D 
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/HyracksConsumer.java
3 files changed, 41 insertions(+), 64 deletions(-)

Approvals:
  Ali Alsuliman: Looks good to me, approved
  Jenkins: Verified

Objections:
  Anon. E. Moose #1000171: Violations found




diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledFrameWriter.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledFrameWriter.java
index 6384e49..dc53bca 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledFrameWriter.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledFrameWriter.java
@@ -30,34 +30,24 @@
 import org.apache.hyracks.api.job.profiling.IStatsCollector;
 import org.apache.hyracks.api.job.profiling.OperatorStats;
 import org.apache.hyracks.api.job.profiling.counters.ICounter;
-import org.apache.hyracks.api.util.HyracksConsumer;
 import org.apache.hyracks.api.util.HyracksRunnable;
+import org.apache.hyracks.api.util.HyracksThrowingConsumer;
 import org.apache.hyracks.util.IntSerDeUtils;

 public class ProfiledFrameWriter implements IFrameWriter {

     // The downstream data consumer of this writer.
     private final IFrameWriter writer;
-    final ICounter timeCounter;
-    final ICounter tupleCounter;
-    final IStatsCollector collector;
-    final IOperatorStats stats;
-    final IOperatorStats parentStats;
-
+    private final ICounter tupleCounter;
+    private final IOperatorStats parentStats;
     private int minSz = Integer.MAX_VALUE;
     private int maxSz = -1;
     private long avgSz;
-    final String name;
-    public ICounter totalTime;
+    private ICounter totalTime;

-    public ProfiledFrameWriter(IFrameWriter writer, IStatsCollector collector, 
String name, IOperatorStats stats,
-            IOperatorStats parentStats) {
+    public ProfiledFrameWriter(IFrameWriter writer, IOperatorStats 
parentStats) {
         this.writer = writer;
-        this.collector = collector;
-        this.name = name;
-        this.stats = stats;
         this.parentStats = parentStats;
-        this.timeCounter = stats.getTimeCounter();
         this.tupleCounter = parentStats != null ? 
parentStats.getTupleCounter() : null;
         this.totalTime = new Counter("totalTime");
     }
@@ -72,7 +62,7 @@
         }
     }

-    private void timeMethod(HyracksConsumer<ByteBuffer> c, ByteBuffer buffer) 
throws HyracksDataException {
+    private void timeMethod(HyracksThrowingConsumer<ByteBuffer> c, ByteBuffer 
buffer) throws HyracksDataException {
         long nt = 0;
         try {
             nt = System.nanoTime();
@@ -152,7 +142,7 @@
             IStatsCollector statsCollector = ctx.getStatsCollector();
             IOperatorStats stats = new OperatorStats(name);
             statsCollector.add(stats);
-            return new ProfiledFrameWriter(writer, ctx.getStatsCollector(), 
name, stats, null);
+            return new ProfiledFrameWriter(writer, null);

         } else
             return writer;
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledOperatorNodePushable.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledOperatorNodePushable.java
index facf049..bde5611 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledOperatorNodePushable.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/dataflow/ProfiledOperatorNodePushable.java
@@ -34,25 +34,19 @@

 public class ProfiledOperatorNodePushable implements IOperatorNodePushable {

-    IOperatorNodePushable op;
-    ActivityId acId;
-    Map<Integer, ProfiledFrameWriter> inputs;
-    Map<Integer, ProfiledOperatorNodePushable> parents;
+    private final IOperatorNodePushable op;
+    private final Map<Integer, ProfiledFrameWriter> inputs;
+    private final Map<Integer, ProfiledOperatorNodePushable> parents;
+    private final Map<Integer, ProfiledFrameWriter> outputs;
+    private final IOperatorStats stats;
+    private final ICounter totalTime;

-    Map<Integer, ProfiledFrameWriter> outputs;
-    IOperatorStats stats;
-    IStatsCollector collector;
-
-    ICounter totalTime;
-
-    ProfiledOperatorNodePushable(IOperatorNodePushable op, ActivityId acId, 
IStatsCollector collector,
-            IOperatorStats stats, ProfiledOperatorNodePushable parentOp) {
+    ProfiledOperatorNodePushable(IOperatorNodePushable op, IOperatorStats 
stats,
+            ProfiledOperatorNodePushable parentOp) {
         this.stats = stats;
-        this.collector = collector;
         this.parents = new HashMap<>();
         parents.put(0, parentOp);
         this.op = op;
-        this.acId = acId;
         inputs = new HashMap<>();
         outputs = new HashMap<>();
         this.totalTime = new Counter("totalTime");
@@ -65,15 +59,15 @@

     @Override
     public void deinitialize() throws HyracksDataException {
-        long unNestTime = totalTime.get();
+        long ownTime = totalTime.get();
         for (ProfiledFrameWriter i : inputs.values()) {
-            unNestTime += i.getTotalTime();
+            ownTime += i.getTotalTime();
         }
         for (ProfiledFrameWriter w : outputs.values()) {
-            unNestTime -= w.getTotalTime();
+            ownTime -= w.getTotalTime();
         }
         op.deinitialize();
-        stats.getTimeCounter().set(unNestTime);
+        stats.getTimeCounter().set(ownTime);
     }

     @Override
@@ -95,8 +89,7 @@
     public IFrameWriter getInputFrameWriter(int index) {
         if (inputs.get(index) == null) {
             IOperatorStats parentStats = parents.get(index) == null ? null : 
parents.get(index).getStats();
-            ProfiledFrameWriter pfw = new 
ProfiledFrameWriter(op.getInputFrameWriter(index), collector,
-                    acId.toString() + "-" + op.getDisplayName(), stats, 
parentStats);
+            ProfiledFrameWriter pfw = new 
ProfiledFrameWriter(op.getInputFrameWriter(index), parentStats);
             inputs.put(index, pfw);
             return pfw;
         } else {
@@ -127,7 +120,7 @@
             ((IIntrospectingOperator) op).setOperatorStats(stats);
         }
         if (!(op instanceof ProfiledOperatorNodePushable) && !(op instanceof 
SuperActivityOperatorNodePushable)) {
-            return new ProfiledOperatorNodePushable(op, acId, 
ctx.getStatsCollector(), stats, source);
+            return new ProfiledOperatorNodePushable(op, stats, source);
         }
         return op;
     }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/HyracksConsumer.java
 
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/HyracksConsumer.java
deleted file mode 100644
index c5abb5e..0000000
--- 
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/HyracksConsumer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.hyracks.api.util;
-
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-@FunctionalInterface
-public interface HyracksConsumer<T> {
-    void accept(final T elem) throws HyracksDataException;
-}

--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17747
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: trinity
Gerrit-Change-Id: Icf2a8f66f39e39eb6a39506c9f385c623176a87d
Gerrit-Change-Number: 17747
Gerrit-PatchSet: 4
Gerrit-Owner: Ian Maxon <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-MessageType: merged

Reply via email to