diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-11-16 19:31:28 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-11-16 19:31:28 -0800 |
commit | 177039b2f89e73ad0d048da021f939f3a153c4e2 (patch) | |
tree | c7f10f04cd9a0872863e2b181162bc9928160cd8 /test/core/debug | |
parent | 995aa91bbbc68deb6dfd7c667cfee3af2bedec08 (diff) | |
parent | 82c8f945302f128495e261b853ac49f1dfbe69a1 (diff) |
Merge master
Diffstat (limited to 'test/core/debug')
-rw-r--r-- | test/core/debug/stats_test.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc index a3bb44f496..1623e7c8a4 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/debug/stats_test.cc @@ -106,11 +106,12 @@ TEST_P(HistogramTest, IncHistogram) { } }; std::vector<int> test_values; - for (int j = -1000; - j < grpc_stats_histo_bucket_boundaries - [kHistogram][grpc_stats_histo_buckets[kHistogram] - 1] + - 1000; - j++) { + // largest bucket boundary for current histogram type. + int max_bucket_boundary = + grpc_stats_histo_bucket_boundaries[kHistogram] + [grpc_stats_histo_buckets[kHistogram] - + 1]; + for (int j = -1000; j < max_bucket_boundary + 1000;) { int expected_bucket = FindExpectedBucket(kHistogram, j); if (cur_bucket != expected_bucket) { threads.emplace_back( @@ -119,6 +120,14 @@ TEST_P(HistogramTest, IncHistogram) { test_values.clear(); } test_values.push_back(j); + if (j < max_bucket_boundary && + FindExpectedBucket(kHistogram, j + 1000) == expected_bucket && + FindExpectedBucket(kHistogram, j - 1000) == expected_bucket) { + // if we are far from bucket boundary, skip values to speed-up the tests + j += 500; + } else { + j++; + } } run(test_values, cur_bucket); for (auto& t : threads) { |