Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed 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 com.facebook.presto.operator;
 
 
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
 import static io.airlift.units.DataSize.Unit.BYTE;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 public class OperatorStats
 {
     private final int operatorId;
     private final String operatorType;
 
     private final long addInputCalls;
     private final Duration addInputWall;
     private final Duration addInputCpu;
     private final Duration addInputUser;
     private final DataSize inputDataSize;
     private final long inputPositions;
 
     private final long getOutputCalls;
     private final Duration getOutputWall;
     private final Duration getOutputCpu;
     private final Duration getOutputUser;
     private final DataSize outputDataSize;
     private final long outputPositions;
 
     private final Duration blockedWall;
 
     private final long finishCalls;
     private final Duration finishWall;
     private final Duration finishCpu;
     private final Duration finishUser;
 
     private final DataSize memoryReservation;
 
     private final Object info;
 
     @JsonCreator
     public OperatorStats(
             @JsonProperty("operatorId"int operatorId,
             @JsonProperty("operatorType"String operatorType,
 
             @JsonProperty("addInputCalls"long addInputCalls,
             @JsonProperty("addInputWall"Duration addInputWall,
             @JsonProperty("addInputCpu"Duration addInputCpu,
             @JsonProperty("addInputUser"Duration addInputUser,
             @JsonProperty("inputDataSize"DataSize inputDataSize,
             @JsonProperty("inputPositions"long inputPositions,
 
             @JsonProperty("getOutputCalls"long getOutputCalls,
             @JsonProperty("getOutputWall"Duration getOutputWall,
             @JsonProperty("getOutputCpu"Duration getOutputCpu,
             @JsonProperty("getOutputUser"Duration getOutputUser,
             @JsonProperty("outputDataSize"DataSize outputDataSize,
             @JsonProperty("outputPositions"long outputPositions,
 
             @JsonProperty("blockedWall"Duration blockedWall,
 
             @JsonProperty("finishCalls"long finishCalls,
             @JsonProperty("finishWall"Duration finishWall,
             @JsonProperty("finishCpu"Duration finishCpu,
             @JsonProperty("finishUser"Duration finishUser,
 
             @JsonProperty("memoryReservation"DataSize memoryReservation,
 
             @JsonProperty("info"Object info)
     {
         checkArgument(operatorId >= 0, "operatorId is negative");
         this. = operatorId;
         this. = checkNotNull(operatorType"operatorType is null");
 
         this. = addInputCalls;
         this. = checkNotNull(addInputWall"addInputWall is null");
         this. = checkNotNull(addInputCpu"addInputCpu is null");
         this. = checkNotNull(addInputUser"addInputUser is null");
         this. = checkNotNull(inputDataSize"inputDataSize is null");
        checkArgument(inputPositions >= 0, "inputPositions is negative");
        this. = inputPositions;
        this. = getOutputCalls;
        this. = checkNotNull(getOutputWall"getOutputWall is null");
        this. = checkNotNull(getOutputCpu"getOutputCpu is null");
        this. = checkNotNull(getOutputUser"getOutputUser is null");
        this. = checkNotNull(outputDataSize"outputDataSize is null");
        checkArgument(outputPositions >= 0, "outputPositions is negative");
        this. = outputPositions;
        this. = checkNotNull(blockedWall"blockedWall is null");
        this. = finishCalls;
        this. = checkNotNull(finishWall"finishWall is null");
        this. = checkNotNull(finishCpu"finishCpu is null");
        this. = checkNotNull(finishUser"finishUser is null");
        this. = checkNotNull(memoryReservation"memoryReservation is null");
        this. = info;
    }
    public int getOperatorId()
    {
        return ;
    }
    public String getOperatorType()
    {
        return ;
    }
    public long getAddInputCalls()
    {
        return ;
    }
    public Duration getAddInputWall()
    {
        return ;
    }
    public Duration getAddInputCpu()
    {
        return ;
    }
    public Duration getAddInputUser()
    {
        return ;
    }
    public DataSize getInputDataSize()
    {
        return ;
    }
    public long getInputPositions()
    {
        return ;
    }
    public long getGetOutputCalls()
    {
        return ;
    }
    public Duration getGetOutputWall()
    {
        return ;
    }
    public Duration getGetOutputCpu()
    {
        return ;
    }
    public Duration getGetOutputUser()
    {
        return ;
    }
    public DataSize getOutputDataSize()
    {
        return ;
    }
    public long getOutputPositions()
    {
        return ;
    }
    public Duration getBlockedWall()
    {
        return ;
    }
    public long getFinishCalls()
    {
        return ;
    }
    public Duration getFinishWall()
    {
        return ;
    }
    public Duration getFinishCpu()
    {
        return ;
    }
    public Duration getFinishUser()
    {
        return ;
    }
    {
        return ;
    }
    @Nullable
    public Object getInfo()
    {
        return ;
    }
    public OperatorStats add(OperatorStats... operators)
    {
        return add(ImmutableList.copyOf(operators));
    }
    public OperatorStats add(Iterable<OperatorStatsoperators)
    {
        long addInputCalls = this.;
        long addInputWall = this..roundTo();
        long addInputCpu = this..roundTo();
        long addInputUser = this..roundTo();
        long inputDataSize = this..toBytes();
        long inputPositions = this.;
        long getOutputCalls = this.;
        long getOutputWall = this..roundTo();
        long getOutputCpu = this..roundTo();
        long getOutputUser = this..roundTo();
        long outputDataSize = this..toBytes();
        long outputPositions = this.;
        long blockedWall = this..roundTo();
        long finishCalls = this.;
        long finishWall = this..roundTo();
        long finishCpu = this..roundTo();
        long finishUser = this..roundTo();
        long memoryReservation = this..toBytes();
        Mergeable<?> base = null;
        if ( instanceof Mergeable) {
            base = (Mergeable<?>) ;
        }
        for (OperatorStats operator : operators) {
            checkArgument(operator.getOperatorId() == "Expected operatorId to be %s but was %s"operator.getOperatorId());
            addInputCalls += operator.getAddInputCalls();
            addInputWall += operator.getAddInputWall().roundTo();
            addInputCpu += operator.getAddInputCpu().roundTo();
            addInputUser += operator.getAddInputUser().roundTo();
            inputDataSize += operator.getInputDataSize().toBytes();
            inputPositions += operator.getInputPositions();
            getOutputCalls += operator.getGetOutputCalls();
            getOutputWall += operator.getGetOutputWall().roundTo();
            getOutputCpu += operator.getGetOutputCpu().roundTo();
            getOutputUser += operator.getGetOutputUser().roundTo();
            outputDataSize += operator.getOutputDataSize().toBytes();
            outputPositions += operator.getOutputPositions();
            finishCalls += operator.getFinishCalls();
            finishWall += operator.getFinishWall().roundTo();
            finishCpu += operator.getFinishCpu().roundTo();
            finishUser += operator.getFinishUser().roundTo();
            blockedWall += operator.getBlockedWall().roundTo();
            memoryReservation += operator.getMemoryReservation().toBytes();
            Object info = operator.getInfo();
            if (base != null && info != null && base.getClass() == info.getClass()) {
                base = mergeInfo(baseinfo);
            }
        }
        return new OperatorStats(
                ,
                ,
                addInputCalls,
                new Duration(addInputWall).convertToMostSuccinctTimeUnit(),
                new Duration(addInputCpu).convertToMostSuccinctTimeUnit(),
                new Duration(addInputUser).convertToMostSuccinctTimeUnit(),
                new DataSize(inputDataSize).convertToMostSuccinctDataSize(),
                inputPositions,
                getOutputCalls,
                new Duration(getOutputWall).convertToMostSuccinctTimeUnit(),
                new Duration(getOutputCpu).convertToMostSuccinctTimeUnit(),
                new Duration(getOutputUser).convertToMostSuccinctTimeUnit(),
                new DataSize(outputDataSize).convertToMostSuccinctDataSize(),
                outputPositions,
                new Duration(blockedWall).convertToMostSuccinctTimeUnit(),
                finishCalls,
                new Duration(finishWall).convertToMostSuccinctTimeUnit(),
                new Duration(finishCpu).convertToMostSuccinctTimeUnit(),
                new Duration(finishUser).convertToMostSuccinctTimeUnit(),
                new DataSize(memoryReservation).convertToMostSuccinctDataSize(),
                base);
    }
    public static <T extends Mergeable<T>> Mergeable<?> mergeInfo(Object baseObject other)
    {
        return ((T) base).mergeWith(((T) other));
    }
New to GrepCode? Check out our FAQ X