コード例 #1
0
ファイル: DataRetriever.java プロジェクト: steria/log-parser
 public List<TimeMeasurement> getTimeMeasurements(
     int procedureId, DateTime fromDate, DateTime toDate, TimeMeasurement.Field orderBy)
     throws NoSuchElementException {
   if (toDate == null) {
     toDate = new DateTime();
   }
   Procedure procedure = logRepository.getProcedure(procedureId);
   if (procedure == null) {
     throw new NoSuchElementException();
   }
   return logRepository.getTimeMeasurementsByProcedure(fromDate, toDate, procedure, orderBy);
 }
コード例 #2
0
ファイル: DataRetriever.java プロジェクト: steria/log-parser
 public TimeMeasurement getMaxDurationTimeMeasurement(
     int procedureId, DateTime from, DateTime to) {
   List<TimeMeasurement> timeMeasurements =
       logRepository.getTimeMeasurementsByProcedure(
           from, to, logRepository.getProcedure(procedureId));
   Duration maxDuration = new Duration(0);
   Duration checkDuration;
   TimeMeasurement maxDurationTimeMeasurement = null;
   for (TimeMeasurement tm : timeMeasurements) {
     checkDuration = new Duration(tm.getDuration());
     if (checkDuration.isLongerThan(maxDuration)) {
       maxDuration = checkDuration;
       maxDurationTimeMeasurement = tm;
     }
   }
   return maxDurationTimeMeasurement;
 }
コード例 #3
0
ファイル: DataRetriever.java プロジェクト: steria/log-parser
  public Map<String, Object> getPercentileByProcedure(
      int procedureId, DateTime fromDate, DateTime toDate, int[] percentages) {
    Map<String, Object> percentilesMap = Maps.newHashMap();

    List<TimeMeasurement> timeMeasurements =
        logRepository.getTimeMeasurementsByProcedure(
            fromDate,
            toDate,
            logRepository.getProcedure(procedureId),
            TimeMeasurement.Field.DURATION);
    Map<Integer, String> percentiles = Maps.newHashMap();

    for (int i = 0; i < percentages.length; i++) {
      String percentile =
          new Duration((long) analyzer.percentile(timeMeasurements, percentages[i])).toString();
      percentiles.put(percentages[i], percentile);
    }
    percentilesMap.put("id", procedureId);
    percentilesMap.put("percentiles", percentiles);
    return percentilesMap;
  }