diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-11-04 14:41:47 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-11-04 14:41:47 +0000 |
commit | 86392292ee722abb03af4befe2d2c8baaeadaf22 (patch) | |
tree | b33cb35c56c65b9d9ad8db8bc49159a4246f138a /tools | |
parent | 36272db3cad448211389168cced4baac39a1a0d1 (diff) | |
download | src-test2-86392292ee722abb03af4befe2d2c8baaeadaf22.tar.gz src-test2-86392292ee722abb03af4befe2d2c8baaeadaf22.zip |
Notes
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-xray/xray-account.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/llvm-xray/xray-account.cpp b/tools/llvm-xray/xray-account.cpp index 2776a8888481..77de1de496f6 100644 --- a/tools/llvm-xray/xray-account.cpp +++ b/tools/llvm-xray/xray-account.cpp @@ -358,8 +358,11 @@ void LatencyAccountant::exportStats(const XRayFileHeader &Header, F Fn) const { break; } - if (AccountTop > 0) - Results.erase(Results.begin() + AccountTop.getValue(), Results.end()); + if (AccountTop > 0) { + auto MaxTop = + std::min(AccountTop.getValue(), static_cast<int>(Results.size())); + Results.erase(Results.begin() + MaxTop, Results.end()); + } for (const auto &R : Results) Fn(std::get<0>(R), std::get<1>(R), std::get<2>(R)); |