Exemplo n.º 1
0
  /**
   * Analyzes System Throughput for a specific job class or for every class
   *
   * @param jobClass specified job class. If null measure will be job independent
   * @param Measure reference to a Measure object
   */
  public void analyzeThroughput(JobClass jobClass, Measure Measure) {
    if (jobClass != null) {
      // If array is not initialized, initialize it
      if (throughputPerClass == null) {
        throughputPerClass = new InverseMeasure[numClass];
      }

      // Sets measure
      throughputPerClass[jobClass.getId()] = (InverseMeasure) Measure;
    } else {
      throughput = (InverseMeasure) Measure;
    }
  }
Exemplo n.º 2
0
  /**
   * Analyzes Drop Rate for a specific job class or for every class
   *
   * @param jobClass specified job class. If null measure will be job independent
   * @param Measure reference to a Measure object
   */
  public void analyzeDropRate(JobClass jobClass, Measure Measure) {
    if (jobClass != null) {
      // If array is not initialized, initialize it
      if (dropRatePerClass == null) {
        dropRatePerClass = new InverseMeasure[numClass];
      }

      // Sets measure
      dropRatePerClass[jobClass.getId()] = (InverseMeasure) Measure;
    } else {
      dropRate = (InverseMeasure) Measure;
    }
  }
Exemplo n.º 3
0
  /**
   * Analyzes System Number of Jobs for a specific job class or for every class
   *
   * @param jobClass specified job class. If null measure will be job independent
   * @param Measure reference to a Measure object
   */
  public void analyzeJobNumber(JobClass jobClass, Measure Measure) {
    if (jobClass != null) {
      // If array is not initialized, initialize it
      if (jobNumPerClass == null) {
        jobNumPerClass = new Measure[numClass];
      }

      // Sets measure
      jobNumPerClass[jobClass.getId()] = Measure;
    } else {
      jobNum = Measure;
    }
  }
Exemplo n.º 4
0
  /**
   * Analyzes System Response Time for a specific job class or for every class
   *
   * @param jobClass specified job class. If null measure will be job independent
   * @param Measure reference to a Measure object
   */
  public void analyzeResponseTime(JobClass jobClass, Measure Measure) {
    if (jobClass != null) {
      // If array is not initialized, initialize it
      if (responseTimePerClass == null) {
        responseTimePerClass = new Measure[numClass];
      }

      // Sets measure
      responseTimePerClass[jobClass.getId()] = Measure;
    } else {
      responseTime = Measure;
    }
  }
  /**
   * Indicates whether this optimization algorithm may be used when running the specified type of
   * job. This algorithm is only available for jobs that report at least one "searchable" stat
   * tracker.
   *
   * @param jobClass The job class for which to make the determination.
   * @return <CODE>true</CODE> if this optimization algorithm may be used with the provided job
   *     class, or <CODE>false</CODE> if not.
   */
  @Override()
  public boolean availableWithJobClass(JobClass jobClass) {
    StatTracker[] jobStats = jobClass.getStatTrackerStubs("", "", 1);
    if ((jobStats == null) || (jobStats.length == 0)) {
      return false;
    }

    for (int i = 0; i < jobStats.length; i++) {
      if (jobStats[i].isSearchable()) {
        return true;
      }
    }

    return false;
  }
Exemplo n.º 6
0
  /**
   * Analyzes System Power for a specific job class or for every class
   *
   * @param jobClass specified job class. If null measure will be job independent
   * @param Measure reference to a Measure object
   */
  public void analyzeSystemPower(JobClass jobClass, Measure Measure) {
    if (jobClass != null) {
      // If array is not initialized, initialize it
      if (systemPowerPerClass == null) {
        systemPowerPerClass = new InverseMeasure[numClass];
        // systemPowerPerClass = new Measure[numClass];
      }

      // Sets measure
      systemPowerPerClass[jobClass.getId()] = (InverseMeasure) Measure;
      // systemPowerPerClass[jobClass.getId()] = Measure;
    } else {
      systemPower = (InverseMeasure) Measure;
      // systemPower = Measure;
    }
  }
Exemplo n.º 7
0
  /**
   * It changes the class of @job, the new class will be @newClass. It also updates the performance
   * indexes.
   *
   * @param job the job you want to switch
   * @param newClass the new class of @job
   */
  public void performJobClassSwitch(Job job, JobClass newClass) {
    // Get the identifiers of old and new classes
    int oldClassId = job.getJobClass().getId();
    int newClassId = newClass.getId();

    // Updates old class measure (if not null)
    if (jobNumPerClass != null && jobNumPerClass[oldClassId] != null) {
      jobNumPerClass[oldClassId].update(
          jobsPerClass[oldClassId], NetSystem.getTime() - lastModifyNumberPerClass[oldClassId]);
    }
    lastModifyNumberPerClass[oldClassId] = NetSystem.getTime();

    // Updates new class measure (if not null)
    if (jobNumPerClass != null && jobNumPerClass[newClassId] != null) {
      jobNumPerClass[newClassId].update(
          jobsPerClass[newClassId], NetSystem.getTime() - lastModifyNumberPerClass[newClassId]);
    }
    lastModifyNumberPerClass[newClassId] = NetSystem.getTime();

    // Switch job class
    job.setClass(newClass);
    jobsPerClass[oldClassId]--;
    jobsPerClass[newClassId]++;
  }
  /**
   * Retrieves a set of parameter stubs that should be used to prompt the end user for the settings
   * to use when executing the optimizing job.
   *
   * @param jobClass The job class that will be used for the optimizing job.
   * @return A set of parameter stubs that should be used to prompt the end user for the settings to
   *     use when executing the optimizing job.
   */
  @Override()
  public ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass) {
    // First, compile a list of all the "searchable" statistics that this job
    // reports it collects.
    ArrayList<String> availableStatList = new ArrayList<String>();
    StatTracker[] jobStats = jobClass.getStatTrackerStubs("", "", 1);
    for (int i = 0; i < jobStats.length; i++) {
      if (jobStats[i].isSearchable()) {
        availableStatList.add(jobStats[i].getDisplayName());
      }
    }

    int numAvailable = availableStatList.size();
    if (numAvailable == 0) {
      return new ParameterList();
    }

    String[] searchableStatNames = new String[numAvailable];
    availableStatList.toArray(searchableStatNames);
    if (optimizeStat == null) {
      optimizeStat = searchableStatNames[0];
    }

    String[] optimizationTypes = {
      Constants.OPTIMIZE_TYPE_MAXIMIZE, Constants.OPTIMIZE_TYPE_MINIMIZE
    };
    String optimizeTypeStr;
    switch (optimizeType) {
      case OPTIMIZE_TYPE_MAXIMIZE:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MAXIMIZE;
        break;
      case OPTIMIZE_TYPE_MINIMIZE:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MINIMIZE;
        break;
      default:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MAXIMIZE;
        break;
    }

    optimizeStatParameter =
        new MultiChoiceParameter(
            PARAM_OPTIMIZE_STAT,
            "Statistic to Optimize",
            "The name of the statistic for which to " + "try to find the optimal value.",
            searchableStatNames,
            optimizeStat);
    optimizeTypeParameter =
        new MultiChoiceParameter(
            PARAM_OPTIMIZE_TYPE,
            "Optimization Type",
            "The type of optimization to perform for " + "the statistic to optimize.",
            optimizationTypes,
            optimizeTypeStr);
    maxLatencyParameter =
        new FloatParameter(
            PARAM_MAX_REPLICA_LATENCY,
            "Maximum Acceptable Replication Latency (ms)",
            "The maximum average replication latency in "
                + "milliseconds that will be allowed for an "
                + "iteration to be considered acceptable.  A "
                + "negative value indicates that there will be no "
                + "maximum latency.",
            false,
            (float) maxLatency);
    maxIncreaseParameter =
        new FloatParameter(
            PARAM_MAX_PERCENT_INCREASE,
            "Maximum Acceptable Percent Increase in Latency",
            "The maximum percentage of increase in "
                + "replication latency that will be allowed for an "
                + "iteration to be considered acceptable.",
            true,
            (float) maxIncrease,
            true,
            (float) 0.0,
            false,
            (float) 0.0);

    minPctImprovementParameter =
        new FloatParameter(
            PARAM_MIN_PCT_IMPROVEMENT,
            "Min. % Improvement for New Best Iteration",
            "The minimum percentage improvement in "
                + "performance that an iteration must have over "
                + "the previous best to be considered the new best "
                + "iteration.",
            false,
            minPctImprovement,
            true,
            0.0F,
            false,
            0.0F);

    Parameter[] algorithmParams = {
      new PlaceholderParameter(),
      optimizeStatParameter,
      optimizeTypeParameter,
      maxLatencyParameter,
      maxIncreaseParameter,
      minPctImprovementParameter
    };

    return new ParameterList(algorithmParams);
  }
  /**
   * Retrieves a set of parameter stubs that should be used to prompt the end user for the settings
   * to use when executing the optimizing job.
   *
   * @param jobClass The job class that will be used for the optimizing job.
   * @return A set of parameter stubs that should be used to prompt the end user for the settings to
   *     use when executing the optimizing job.
   */
  @Override()
  public ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass) {
    // First, compile a list of all the "searchable" statistics that this job
    // reports it collects.
    ArrayList<String> availableStatList = new ArrayList<String>();
    StatTracker[] jobStats = jobClass.getStatTrackerStubs("", "", 1);
    for (int i = 0; i < jobStats.length; i++) {
      if (jobStats[i].isSearchable()) {
        availableStatList.add(jobStats[i].getDisplayName());
      }
    }

    int numAvailable = availableStatList.size();
    if (numAvailable == 0) {
      return new ParameterList();
    }

    String[] searchableStatNames = new String[numAvailable];
    availableStatList.toArray(searchableStatNames);
    if (optimizeStat == null) {
      optimizeStat = searchableStatNames[0];
    }

    String[] optimizationTypes = {
      Constants.OPTIMIZE_TYPE_MAXIMIZE, Constants.OPTIMIZE_TYPE_MINIMIZE
    };
    String optimizeTypeStr;
    switch (optimizeType) {
      case OPTIMIZE_TYPE_MAXIMIZE:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MAXIMIZE;
        break;
      case OPTIMIZE_TYPE_MINIMIZE:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MINIMIZE;
        break;
      default:
        optimizeTypeStr = Constants.OPTIMIZE_TYPE_MAXIMIZE;
        break;
    }

    String[] utilizationComponents = {
      UTILIZATION_COMPONENT_USER_STRING,
      UTILIZATION_COMPONENT_SYSTEM_STRING,
      UTILIZATION_COMPONENT_BUSY_STRING
    };

    String componentStr;
    switch (utilizationComponent) {
      case UTILIZATION_COMPONENT_USER_TIME:
        componentStr = UTILIZATION_COMPONENT_USER_STRING;
        break;
      case UTILIZATION_COMPONENT_SYSTEM_TIME:
        componentStr = UTILIZATION_COMPONENT_SYSTEM_STRING;
        break;
      case UTILIZATION_COMPONENT_BUSY_TIME:
        componentStr = UTILIZATION_COMPONENT_BUSY_STRING;
        break;
      default:
        componentStr = UTILIZATION_COMPONENT_BUSY_STRING;
        break;
    }

    optimizeStatParameter =
        new MultiChoiceParameter(
            PARAM_OPTIMIZE_STAT,
            "Statistic to Optimize",
            "The name of the statistic for which to " + "try to find the optimal value.",
            searchableStatNames,
            optimizeStat);
    optimizeTypeParameter =
        new MultiChoiceParameter(
            PARAM_OPTIMIZE_TYPE,
            "Optimization Type",
            "The type of optimization to perform for " + "the statistic to optimize.",
            optimizationTypes,
            optimizeTypeStr);
    maxUtilizationParameter =
        new FloatParameter(
            PARAM_MAX_CPU_UTILIZATION,
            "Maximum Acceptable CPU Utilization",
            "The maximum CPU utilization that will be "
                + "allowed for the specified CPU component for "
                + "an iteration to be considered acceptable.",
            true,
            (float) maxUtilization,
            true,
            (float) 0.0,
            true,
            (float) 100.0);
    utilizationComponentParameter =
        new MultiChoiceParameter(
            PARAM_UTILIZATION_COMPONENT,
            "Utilization Component to Consider",
            "The CPU utilization component to consider "
                + "when deciding whether an iteration is "
                + "acceptable.",
            utilizationComponents,
            componentStr);

    minPctImprovementParameter =
        new FloatParameter(
            PARAM_MIN_PCT_IMPROVEMENT,
            "Min. % Improvement for New Best Iteration",
            "The minimum percentage improvement in "
                + "performance that an iteration must have over "
                + "the previous best to be considered the new best "
                + "iteration.",
            false,
            minPctImprovement,
            true,
            0.0F,
            false,
            0.0F);

    Parameter[] algorithmParams = {
      new PlaceholderParameter(),
      optimizeStatParameter,
      optimizeTypeParameter,
      maxUtilizationParameter,
      utilizationComponentParameter,
      minPctImprovementParameter
    };

    return new ParameterList(algorithmParams);
  }