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

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: Adjust sampling rates in comparatives rate test 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
« no previous file with comments | « src/profiler/sampling-heap-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..87119b8571394118af54f9e48b6124faad2ca70d 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -2901,9 +2901,9 @@ TEST(SamplingHeapProfiler) {
CHECK(profile == nullptr);
}
- int count_512kb = 0;
+ int count_1024 = 0;
{
- heap_profiler->StartSamplingHeapProfiler(512 * 1024);
+ heap_profiler->StartSamplingHeapProfiler(1024);
CompileRun(script_source);
v8::base::SmartPointer<v8::AllocationProfile> profile(
@@ -2917,7 +2917,7 @@ TEST(SamplingHeapProfiler) {
// Count the number of allocations we sampled from bar.
for (auto allocation : node_bar->allocations) {
- count_512kb += allocation.count;
+ count_1024 += allocation.count;
}
heap_profiler->StopSamplingHeapProfiler();
@@ -2929,9 +2929,9 @@ 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);
+ heap_profiler->StartSamplingHeapProfiler(128);
CompileRun(script_source);
v8::base::SmartPointer<v8::AllocationProfile> profile(
@@ -2944,15 +2944,21 @@ TEST(SamplingHeapProfiler) {
CHECK(node_bar);
// Count the number of allocations we sampled from bar.
- int count_32kb = 0;
+ int count_128 = 0;
for (auto allocation : node_bar->allocations) {
- count_32kb += allocation.count;
+ count_128 += 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_128, count_1024);
+ double min_count = std::min(count_128, count_1024);
+ double percent_difference = (max_count - min_count) / min_count;
+ CHECK_LT(percent_difference, 0.15);
heap_profiler->StopSamplingHeapProfiler();
}
« no previous file with comments | « src/profiler/sampling-heap-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698