Skip to content

Commit

Permalink
Fix Throttler unit test
Browse files Browse the repository at this point in the history
Summary: For some reason, the math library behaves differently on windows and requires handling the 0 edge case.

Reviewed By: finik

Differential Revision: D53157851

fbshipit-source-id: 2a901c2ce1c1cc9c7bc0e2d54a2fe9ff6f1d1783
  • Loading branch information
Georges Berenger authored and facebook-github-bot committed Jan 28, 2024
1 parent 406cf4a commit ee02184
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vrs/helpers/Throttler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ bool Throttler::report(int line, const void* throttledObjectPtr) {
return doIt;
}

// 0-10 -> 1, 11-100 -> 10, 101-1000 -> 100, 1001-10000 -> 10000, etc
// 0-10 -> 1, 11-100 -> 10, 101-1000 -> 100, 1001-1000 -> 1000, etc
int64_t Throttler::reportFrequency(int64_t counter) {
if (counter <= 10) {
return 1;
}
int64_t power = log10(counter - 1);
int64_t res = 1;
for (int64_t p = 1; p <= power; p++) {
Expand Down

0 comments on commit ee02184

Please sign in to comment.