cppgc: Reduce noise and increase tolerance in flaky test

Bug: v8:11367
Change-Id: I2d21d3deea73a9930acb3bf2efd3268ec1fd64b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2919830
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74788}
This commit is contained in:
Omer Katz 2021-05-26 14:52:50 +02:00 committed by V8 LUCI CQ
parent d2a4e8ec92
commit c2d5e408b5

View File

@ -153,6 +153,12 @@ TEST_F(MetricRecorderTest, CycleEndMetricsReportedOnGcEnd) {
TEST_F(MetricRecorderTest, CycleEndHistogramReportsCorrectValues) {
StartGC();
{
// Warmup scope to make sure everything is loaded in memory and reduce noise
// in timing measurements.
StatsCollector::EnabledScope scope(Heap::From(GetHeap())->stats_collector(),
StatsCollector::kIncrementalMark);
}
EndGC(1000);
StartGC();
{
@ -207,7 +213,7 @@ TEST_F(MetricRecorderTest, CycleEndHistogramReportsCorrectValues) {
}
EndGC(300);
// Check durations.
static constexpr int64_t kDurationComparisonTolerance = 500;
static constexpr int64_t kDurationComparisonTolerance = 5000;
EXPECT_LT(std::abs(MetricRecorderImpl::CppGCFullCycle_event
.main_thread_incremental.mark_duration_us -
10000),
@ -269,7 +275,7 @@ TEST_F(MetricRecorderTest, CycleEndHistogramReportsCorrectValues) {
// Check collection rate and efficiency.
EXPECT_DOUBLE_EQ(
0.3, MetricRecorderImpl::CppGCFullCycle_event.collection_rate_in_percent);
static constexpr double kEfficiencyComparisonTolerance = 0.00001;
static constexpr double kEfficiencyComparisonTolerance = 0.0005;
EXPECT_LT(
std::abs(
MetricRecorderImpl::CppGCFullCycle_event.efficiency_in_bytes_per_us -