in simulator/src/main/java/com/google/cloud/StatsTracker.java [110:129]
List<Long> getPercentile(List<Double> percentile) {
// Biggest to smallest!
Collections.sort(this.points);
// Assume correct percentile values
ArrayList<Long> timings = new ArrayList<Long>();
long total = this.total; // start at 100%
for (int i = 0, j = 0; i < points.size() && j < percentile.size(); i++) {
total -= points.get(i).weight;
double curr_perc = (double)total / (double)this.total;
while (j < percentile.size() && curr_perc <= percentile.get(j)) {
timings.add(points.get(i).nanoDuration);
j++;
}
}
return timings;
}