Commit d1a23ee7 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[oilpan] Fix estimated marking time computation

Compute estimated marking time in PostSweep were both, marked bytes
and marking time, refer to the same garbage collection cycle.

Bug: chromium:830196, chromium:757440
Change-Id: I80ea0c028ba7668f05b94b1acbe9b0c38afa801a
Reviewed-on: https://chromium-review.googlesource.com/1039566
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555531}
parent 76993c10
......@@ -980,8 +980,8 @@ void ThreadState::PostSweep() {
ThreadHeap::ReportMemoryUsageForTracing();
if (IsMainThread()) {
double collection_rate =
1.0 - heap_->HeapStats().LiveObjectRateSinceLastGC();
ThreadHeapStats& stats = heap_->HeapStats();
double collection_rate = 1.0 - stats.LiveObjectRateSinceLastGC();
TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"),
"ThreadState::collectionRate",
static_cast<int>(100 * collection_rate));
......@@ -990,19 +990,20 @@ void ThreadState::PostSweep() {
<< " PostSweep: collection_rate: " << std::setprecision(2)
<< (100 * collection_rate) << "%";
// ThreadHeap::markedObjectSize() may be underestimated here if any other
// thread has not yet finished lazy sweeping.
heap_->HeapStats().SetMarkedObjectSizeAtLastCompleteSweep(
heap_->HeapStats().MarkedObjectSize());
stats.SetMarkedObjectSizeAtLastCompleteSweep(stats.MarkedObjectSize());
stats.SetEstimatedMarkingTimePerByte(
stats.MarkedObjectSize()
? (current_gc_data_.marking_time_in_milliseconds / 1000 /
stats.MarkedObjectSize())
: 0);
DEFINE_STATIC_LOCAL(CustomCountHistogram, object_size_before_gc_histogram,
("BlinkGC.ObjectSizeBeforeGC", 1, 4 * 1024 * 1024, 50));
object_size_before_gc_histogram.Count(
heap_->HeapStats().ObjectSizeAtLastGC() / 1024);
object_size_before_gc_histogram.Count(stats.ObjectSizeAtLastGC() / 1024);
DEFINE_STATIC_LOCAL(CustomCountHistogram, object_size_after_gc_histogram,
("BlinkGC.ObjectSizeAfterGC", 1, 4 * 1024 * 1024, 50));
object_size_after_gc_histogram.Count(heap_->HeapStats().MarkedObjectSize() /
1024);
object_size_after_gc_histogram.Count(stats.MarkedObjectSize() / 1024);
DEFINE_STATIC_LOCAL(CustomCountHistogram, collection_rate_histogram,
("BlinkGC.CollectionRate", 1, 100, 20));
collection_rate_histogram.Count(static_cast<int>(100 * collection_rate));
......@@ -1425,9 +1426,6 @@ void ThreadState::MarkPhasePrologue(BlinkGC::StackState stack_state,
Heap().FlushHeapDoesNotContainCacheIfNeeded();
Heap().ClearArenaAges();
current_gc_data_.marked_object_size =
Heap().HeapStats().AllocatedObjectSize() +
Heap().HeapStats().MarkedObjectSize();
if (marking_type != BlinkGC::kTakeSnapshot)
Heap().ResetHeapCounters();
}
......@@ -1495,12 +1493,6 @@ void ThreadState::MarkPhaseEpilogue(BlinkGC::MarkingType marking_type) {
if (ShouldVerifyMarking())
VerifyMarking(marking_type);
Heap().HeapStats().SetEstimatedMarkingTimePerByte(
current_gc_data_.marked_object_size
? (current_gc_data_.marking_time_in_milliseconds / 1000 /
current_gc_data_.marked_object_size)
: 0);
ThreadHeap::ReportMemoryUsageHistogram();
WTF::Partitions::ReportMemoryUsageHistogram();
......
......@@ -750,7 +750,6 @@ class PLATFORM_EXPORT ThreadState {
BlinkGC::MarkingType marking_type;
BlinkGC::GCReason reason;
double marking_time_in_milliseconds;
size_t marked_object_size;
std::unique_ptr<MarkingVisitor> visitor;
};
GCData current_gc_data_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment