Closed ghkdqhrbals closed 6 months ago
index 가 음수일 경우 예외처리
public double calculateTpsPercentile(double percentile) {
log.info("in calculate");
Map<LocalDateTime, Double> tpsSnapshot = new ConcurrentHashMap<>(tpsMap);
tpsSnapshot.values().stream().toList();
List<Double> tpsValues = tpsSnapshot.values().stream().sorted().toList(); // <-- Here STOP!
log.info(tpsValues.toString());
int index = (int) Math.ceil((percentile / 100) * tpsValues.size()) - 1;
if (index < 0) {
return 0; // 예외처리: 인덱스가 음수인 경우
}
return tpsValues.get(index);
}
해당 메소드에서 다음 단계로 진행이 불가능했습니다.