Commit b62a7a83 authored by ulan's avatar ulan Committed by Commit bot

Add option to compute average scavenge speed w.r.t survived objects.

Use it in detection of low young generation allocation rate.

BUG=501314
LOG=NO
TBR=hpayer@chromium.org

Review URL: https://codereview.chromium.org/1186903005

Cr-Commit-Position: refs/heads/master@{#29094}
parent 789c0601
......@@ -184,6 +184,7 @@ void GCTracer::Stop(GarbageCollector collector) {
current_.end_object_size = heap_->SizeOfObjects();
current_.end_memory_size = heap_->isolate()->memory_allocator()->Size();
current_.end_holes_size = CountTotalHolesSize(heap_);
current_.survived_new_space_object_size = heap_->SurvivedNewSpaceObjectSize();
AddAllocation(current_.end_time);
......@@ -566,12 +567,14 @@ intptr_t GCTracer::IncrementalMarkingSpeedInBytesPerMillisecond() const {
}
intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond() const {
intptr_t GCTracer::ScavengeSpeedInBytesPerMillisecond(
ScavengeSpeedMode mode) const {
intptr_t bytes = 0;
double durations = 0.0;
EventBuffer::const_iterator iter = scavenger_events_.begin();
while (iter != scavenger_events_.end()) {
bytes += iter->new_space_object_size;
bytes += mode == kForAllObjects ? iter->new_space_object_size
: iter->survived_new_space_object_size;
durations += iter->end_time - iter->start_time;
++iter;
}
......
......@@ -85,6 +85,9 @@ class RingBuffer {
};
enum ScavengeSpeedMode { kForAllObjects, kForSurvivedObjects };
// GCTracer collects and prints ONE line after each garbage collector
// invocation IFF --trace_gc is used.
// TODO(ernstm): Unit tests.
......@@ -227,6 +230,8 @@ class GCTracer {
// Size of new space objects in constructor.
intptr_t new_space_object_size;
// Size of survived new space objects in desctructor.
intptr_t survived_new_space_object_size;
// Number of incremental marking steps since creation of tracer.
// (value at start of event)
......@@ -371,7 +376,8 @@ class GCTracer {
// Compute the average scavenge speed in bytes/millisecond.
// Returns 0 if no events have been recorded.
intptr_t ScavengeSpeedInBytesPerMillisecond() const;
intptr_t ScavengeSpeedInBytesPerMillisecond(
ScavengeSpeedMode mode = kForAllObjects) const;
// Compute the average mark-sweep speed in bytes/millisecond.
// Returns 0 if no events have been recorded.
......
......@@ -4682,11 +4682,11 @@ void Heap::MakeHeapIterable() {
bool Heap::HasLowYoungGenerationAllocationRate() {
const double high_mutator_utilization = 0.995;
const double high_mutator_utilization = 0.993;
double mutator_speed = static_cast<double>(
tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond());
double gc_speed =
static_cast<double>(tracer()->ScavengeSpeedInBytesPerMillisecond());
double gc_speed = static_cast<double>(
tracer()->ScavengeSpeedInBytesPerMillisecond(kForSurvivedObjects));
if (mutator_speed == 0 || gc_speed == 0) return false;
double mutator_utilization = gc_speed / (mutator_speed + gc_speed);
return mutator_utilization > high_mutator_utilization;
......@@ -4694,7 +4694,7 @@ bool Heap::HasLowYoungGenerationAllocationRate() {
bool Heap::HasLowOldGenerationAllocationRate() {
const double high_mutator_utilization = 0.995;
const double high_mutator_utilization = 0.993;
double mutator_speed = static_cast<double>(
tracer()->OldGenerationAllocationThroughputInBytesPerMillisecond());
double gc_speed = static_cast<double>(
......
......@@ -1277,6 +1277,10 @@ class Heap {
semi_space_copied_object_size_ += object_size;
}
inline intptr_t SurvivedNewSpaceObjectSize() {
return promoted_objects_size_ + semi_space_copied_object_size_;
}
inline void IncrementNodesDiedInNewSpace() { nodes_died_in_new_space_++; }
inline void IncrementNodesCopiedInNewSpace() { nodes_copied_in_new_space_++; }
......
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