Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1235)

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 1706343002: Unsampling for the sampling heap profiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Compute percent change in tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index e720d92109ca13d23d08f42cde1edf79cf98fc9e..37a207a2fc999f5bd40ca5e5eb2a6166b026bd44 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -2929,7 +2929,7 @@ TEST(SamplingHeapProfiler) {
CHECK(profile == nullptr);
}
- // Sampling at a higher rate should give us more sampled objects.
+ // Sampling at a higher rate should give us similar numbers of objects.
{
heap_profiler->StartSamplingHeapProfiler(32 * 1024);
CompileRun(script_source);
@@ -2949,10 +2949,16 @@ TEST(SamplingHeapProfiler) {
count_32kb += allocation.count;
}
- // We should have roughly 16x as many sampled allocations. However,
- // alignment and boundaries might tweak the numbers slightly. We use a
- // slightly weaker test to account for this.
- CHECK_GT(count_32kb, 8 * count_512kb);
+ // We should have similar unsampled counts of allocations. Though
+ // we will sample different numbers of objects at different rates,
+ // the unsampling process should produce similar final estimates
+ // at the true number of allocations. However, the process to
+ // determine these unsampled counts is probabilisitic so we need to
+ // account for error.
+ double max_count = std::max(count_32kb, count_512kb);
+ double min_count = std::min(count_32kb, count_512kb);
+ double percent_difference = (max_count - min_count) / min_count;
+ CHECK_LT(percent_difference, 0.15);
heap_profiler->StopSamplingHeapProfiler();
}
« src/profiler/sampling-heap-profiler.cc ('K') | « src/profiler/sampling-heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698