[PATCH] D42690: [XRay] fix 99th percentile lookups by sorting the array correctly
Martin Pelikán via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 10:20:45 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL323800: [XRay] fix 99th percentile lookups by sorting the array correctly (authored by pelikan, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D42690
Files:
llvm/trunk/tools/llvm-xray/xray-account.cc
Index: llvm/trunk/tools/llvm-xray/xray-account.cc
===================================================================
--- llvm/trunk/tools/llvm-xray/xray-account.cc
+++ llvm/trunk/tools/llvm-xray/xray-account.cc
@@ -237,16 +237,19 @@
auto MinMax = std::minmax_element(Timings.begin(), Timings.end());
R.Min = *MinMax.first;
R.Max = *MinMax.second;
+ R.Count = Timings.size();
+
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() + Pct90Off, Timings.end());
+ std::nth_element(Timings.begin(), Timings.begin() + Pct99Off, Timings.end());
R.Pct99 = Timings[Pct99Off];
- R.Count = Timings.size();
return R;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42690.131999.patch
Type: text/x-patch
Size: 1009 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180130/1a1bbe60/attachment.bin>
More information about the llvm-commits
mailing list