Home | History | Annotate | Download | only in bridge
      1 /*
      2  * Copyright (C) 2011 Google Inc.
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.caliper.bridge;
     18 
     19 import com.google.caliper.model.BenchmarkSpec;
     20 import com.google.common.collect.ImmutableList;
     21 import com.google.common.collect.ImmutableMap;
     22 
     23 import java.io.Serializable;
     24 import java.util.UUID;
     25 
     26 /**
     27  * This object is sent from the parent process to the child to tell it what to do. If the child
     28  * does not do it, it will not get its allowance this week.
     29  */
     30 public final class WorkerSpec implements Serializable {
     31   private static final long serialVersionUID = 1L;
     32 
     33   public final UUID trialId;
     34   // Should be ? extends Worker but circular build deps prevent that.
     35   public final Class<?> workerClass;
     36   public final ImmutableMap<String, String> workerOptions;
     37   public final BenchmarkSpec benchmarkSpec;
     38 
     39   /**
     40    * The names of the benchmark method parameters so that the method can be uniquely identified.
     41    */
     42   public final ImmutableList<Class<?>> methodParameterClasses;
     43   public final int port;
     44 
     45   public WorkerSpec(
     46       UUID trialId,
     47       Class<?> workerClass,
     48       ImmutableMap<String, String> workerOptions,
     49       BenchmarkSpec benchmarkSpec,
     50       ImmutableList<Class<?>> methodParameterClasses,
     51       int port) {
     52     this.trialId = trialId;
     53     this.workerClass = workerClass;
     54     this.workerOptions = workerOptions;
     55     this.benchmarkSpec = benchmarkSpec;
     56     this.methodParameterClasses = methodParameterClasses;
     57     this.port = port;
     58   }
     59 }
     60