Skip to content

Commit

Permalink
Handle the case when there are no sample above threshold
Browse files Browse the repository at this point in the history
Closes PR #1
  • Loading branch information
rigtorp committed Sep 25, 2023
1 parent 3b7604b commit 071656c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ build
cmake-build-*
*~
.idea/
.vscode/
.vscode/
.cache/
6 changes: 3 additions & 3 deletions src/hiccups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ int main(int argc, char *argv[]) {
for (auto &[cpu, s] : samples) {
std::sort(s.begin(), s.end());
std::cout << cpu << " " << threshold.count() << " " << s.size() << " "
<< s[s.size() * 0.99].count() << " "
<< s[s.size() * 0.999].count() << " " << s.back().count()
<< std::endl;
<< (s.empty() ? 0 : s[s.size() * 0.99].count()) << " "
<< (s.empty() ? 0 : s[s.size() * 0.999].count()) << " "
<< (s.empty() ? 0 : s.back().count()) << std::endl;
}

return 0;
Expand Down

0 comments on commit 071656c

Please sign in to comment.