PerformanceResult calculatePerformanceResult(PerformanceArea area, long time,
      List<AlertParameter> parameters) {
    AlertState alertState = AlertState.OK;
    int warningThreshold = area.m_defaultWarningThreshold;
    int criticalThreshold = area.m_defaultCriticalThreshold;

    for (AlertParameter parameter : parameters) {
      Object value = parameter.getValue();

      if (StringUtils.equals(parameter.getName(), area.m_warningParameter)) {
        warningThreshold = alertHelper.getThresholdValue(value, warningThreshold);
      }

      if (StringUtils.equals(parameter.getName(), area.m_criticalParameter)) {
        criticalThreshold = alertHelper.getThresholdValue(value, criticalThreshold);
      }
    }

    if (time >= warningThreshold && time < criticalThreshold) {
      alertState = AlertState.WARNING;
    }

    if (time >= criticalThreshold) {
      alertState = AlertState.CRITICAL;
    }

    String resultLabel = MessageFormat.format(PERFORMANCE_AREA_TEMPLATE, area.m_label, time,
        alertState);

    return new PerformanceResult(resultLabel, alertState);
  }
Calculates the state based on the threshold values for a
{@link PerformanceArea} and an actual run time.

@param area
         the area to calculate the result for (not {@code null}).
@param time
         the time taken, in milliseconds, to run the test.
@param parameters
         a list of parameters from the alert definition which contain the
         threshold values.
@return a result of running the performance area (never {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnable.java