Index: tools/llvm-xray/xray-account.cc =================================================================== --- tools/llvm-xray/xray-account.cc +++ tools/llvm-xray/xray-account.cc @@ -238,13 +238,13 @@ R.Min = *MinMax.first; R.Max = *MinMax.second; auto MedianOff = Timings.size() / 2; - std::nth_element(Timings.begin(), Timings.begin() + MedianOff, Timings.end()); - R.Median = Timings[MedianOff]; auto Pct90Off = std::floor(Timings.size() * 0.9); - std::nth_element(Timings.begin(), Timings.begin() + Pct90Off, Timings.end()); - R.Pct90 = Timings[Pct90Off]; auto Pct99Off = std::floor(Timings.size() * 0.99); + std::nth_element(Timings.begin(), Timings.begin() + MedianOff, Timings.end()); std::nth_element(Timings.begin(), Timings.begin() + Pct90Off, Timings.end()); + std::nth_element(Timings.begin(), Timings.begin() + Pct99Off, Timings.end()); + R.Median = Timings[MedianOff]; + R.Pct90 = Timings[Pct90Off]; R.Pct99 = Timings[Pct99Off]; R.Count = Timings.size(); return R;