Returns the average web page load time for given interval and {@link TimeUnit}.

@param intervalName name of the interval
@param unit         {@link TimeUnit}
@return average web page load time
778691
public double getAverageWindowLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName);
	}
112910
public static final TimeUnit getDurationTimeUnits(int type)
   {
      TimeUnit units;

      switch (type & DURATION_UNITS_MASK)
      {
         case 3:
         {
            units = TimeUnit.MINUTES;
            break;
         }

         case 4:
         {
            units = TimeUnit.ELAPSED_MINUTES;
            break;
         }

         case 5:
         {
            units = TimeUnit.HOURS;
            break;
         }

         case 6:
         {
            units = TimeUnit.ELAPSED_HOURS;
            break;
         }

         case 8:
         {
            units = TimeUnit.ELAPSED_DAYS;
            break;
         }

         case 9:
         {
            units = TimeUnit.WEEKS;
            break;
         }

         case 10:
         {
            units = TimeUnit.ELAPSED_WEEKS;
            break;
         }

         case 11:
         {
            units = TimeUnit.MONTHS;
            break;
         }

         case 12:
         {
            units = TimeUnit.ELAPSED_MONTHS;
            break;
         }

         default:
         case 7:
         {
            units = TimeUnit.DAYS;
            break;
         }
      }

      return (units);
   }
845270
def page_load_time(self):
        
        load_times = self.get_load_times('page')
        return round(mean(load_times), self.decimal_precision)
182983
@Override public final long getDelay( TimeUnit unit ) {
    long delay = (_started+_retry)-System.currentTimeMillis();
    return unit.convert( delay, TimeUnit.MILLISECONDS );
  }
910
private Duration getDuration(TimeUnit units, Double duration)
   {
      Duration result = null;
      if (duration != null)
      {
         double durationValue = duration.doubleValue() * 100.0;

         switch (units)
         {
            case MINUTES:
            {
               durationValue *= MINUTES_PER_DAY;
               break;
            }

            case HOURS:
            {
               durationValue *= HOURS_PER_DAY;
               break;
            }

            case DAYS:
            {
               durationValue *= 3.0;
               break;
            }

            case WEEKS:
            {
               durationValue *= 0.6;
               break;
            }

            case MONTHS:
            {
               durationValue *= 0.15;
               break;
            }

            default:
            {
               throw new IllegalArgumentException("Unsupported time units " + units);
            }
         }

         durationValue = Math.round(durationValue) / 100.0;

         result = Duration.getInstance(durationValue, units);
      }

      return result;
   }
288443
static final int guessLengthFromName(String aName) {
		
		if (aName.startsWith(Constants.PREFIX_SNAPSHOT_INTERVAL))
			return -1;
		
		int unitFactor;
		int value;
		
		try {
			value = Integer.parseInt(aName.substring(0, aName.length() - 1));
		} catch (NumberFormatException e) {
			throw new UnknownIntervalLengthException("Unsupported Interval name format: " + aName);
		}

		char lastChar = aName.charAt(aName.length() - 1);
		TimeUnit unit = lookupMap.get(Character.toLowerCase(lastChar));

		if (unit==null)
			throw new UnknownIntervalLengthException(aName + ", " + lastChar + " is not a supported unit.");
		
		unitFactor = unit.getFactor();

		if (value == 0)
			throw new UnknownIntervalLengthException(aName	+ ", zero duration is not allowed.");

		return value * unitFactor;
	}
1099929
@ReflectiveAccess
    protected void setInterval(String interval) {
        this.interval = ConversionService.SHARED.convert(interval, Duration.class).orElseThrow(() -> new IllegalArgumentException("Invalid Duration Specified"));
    }
1297760
public long getTotalWindowLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName));
	}
548780
public long get(final TimeUnit toUnit)
	{
		if (this.unit == toUnit)
			return period;
		else
			return toUnit.convert(period, this.unit);
	}
525620
public static ChronoUnit chronoUnit(TimeUnit unit) {
        Objects.requireNonNull(unit, "unit");
        switch (unit) {
            case NANOSECONDS:
                return ChronoUnit.NANOS;
            case MICROSECONDS:
                return ChronoUnit.MICROS;
            case MILLISECONDS:
                return ChronoUnit.MILLIS;
            case SECONDS:
                return ChronoUnit.SECONDS;
            case MINUTES:
                return ChronoUnit.MINUTES;
            case HOURS:
                return ChronoUnit.HOURS;
            case DAYS:
                return ChronoUnit.DAYS;
            default:
                throw new IllegalArgumentException("Unknown TimeUnit constant");
        }
    }
767104
public long getDomLastLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(domLastLoadTime.getValueAsLong(intervalName));
	}
228904
private static Interval<DateUnit> parseDateInterval(JsonNode node) {
		try {
			if (node.hasNonNull("dateInterval") && node.get("dateInterval").hasNonNull("aggregationType")) {
				JsonNode dateInterval = node.get("dateInterval");
				DateUnit unit = DateUnit.valueOf(dateInterval.get("aggregationType").asText().toUpperCase(Locale.ENGLISH));
				JsonNode interval = dateInterval.get("interval");
				String type = interval.get("type").asText().toLowerCase(Locale.ENGLISH);
				if ("relative".equals(type)) {
					// the server may send numbers inside strings
					// or numbers as decimals, e.g. 3.0
					// regardless, we treat them all as int
					String from = interval.get("from").asText();
					String to = interval.get("to").asText();
					return new RelativeInterval<DateUnit>(unit, (int) Float.parseFloat(from), (int) Float.parseFloat(to));
				} else if ("absolute".equals(type)) {
					// an absolute interval
					return new AbsoluteInterval<DateUnit>(unit, unit.parseAbsolute(interval.get("from")),
						unit.parseAbsolute(interval.get("to")));
				} else if ("custom".equals(type)) {
					// a custom interval
					return new CustomInterval<DateUnit>(unit, interval.get("from").asText(), interval.get("to").asText());
				}
			}
		} catch (InvalidIntervalException e) {
			// ignore the interval
		} catch (NumberFormatException e) {
			// ignore the interval
		} catch (IllegalArgumentException e) {
			// ignore the interval
		}
		return null;
	}
1211938
public static Timer newTimer(String name, TimeUnit unit) {
    return new BasicTimer(MonitorConfig.builder(name).build(), unit);
  }
876565
@GET
  @Path("/{dataSourceName}/intervals/{interval}/serverview")
  @Produces(MediaType.APPLICATION_JSON)
  @ResourceFilters(DatasourceResourceFilter.class)
  public Response getSegmentDataSourceSpecificInterval(
      @PathParam("dataSourceName") String dataSourceName,
      @PathParam("interval") String interval,
      @QueryParam("partial") final boolean partial
  )
  {
    TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline(
        new TableDataSource(dataSourceName)
    );
    final Interval theInterval = Intervals.of(interval.replace('_', '/'));
    if (timeline == null) {
      log.debug("No timeline found for datasource[%s]", dataSourceName);
      return Response.ok(new ArrayList<ImmutableSegmentLoadInfo>()).build();
    }

    Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval);
    FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable
        .create(lookup).transformCat(
            (TimelineObjectHolder<String, SegmentLoadInfo> input) ->
                Iterables.transform(
                    input.getObject(),
                    (PartitionChunk<SegmentLoadInfo> chunk) ->
                        chunk.getObject().toImmutableSegmentLoadInfo()
                )
        );
    return Response.ok(retval).build();
  }
300721
@Override
    public long get(TemporalUnit unit) {
        if (unit == ChronoUnit.YEARS) {
            return years;
        } else if (unit == ChronoUnit.MONTHS) {
            return months;
        } else if (unit == ChronoUnit.DAYS) {
            return days;
        } else {
            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
        }
    }
921553
public GetStatAvgSpeedResponse getStatAvgSpeed(GetStatAvgSpeedRequest request) {
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, STAT, "avgspeed");
        
        if (request.getStartTime() != null) {
            internalRequest.addParameter("startTime", DateUtils.formatAlternateIso8601Date(request.getStartTime()));
        }
        
        if (request.getEndTime() != null) {
            internalRequest.addParameter("endTime", DateUtils.formatAlternateIso8601Date(request.getEndTime()));
        }
        
        if (request.getDomain() != null) {
            internalRequest.addParameter("domain", request.getDomain());
        }
        
        if (request.getPeriod() != null) {
            internalRequest.addParameter("period", String.valueOf(request.getPeriod()));
        }
        
        return this.invokeHttpClient(internalRequest, GetStatAvgSpeedResponse.class);
    }
1000281
public long getTotalDomLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName));
	}