Commit 509faa85 authored by ernstm@chromium.org's avatar ernstm@chromium.org

v8: GCTracer clean-up part 1.

- Split GCTracer::~GCTracer into printing functions and update of variables
tracked on Heap.
- Clean-up recording of time, object size and memory size at the beginning and
end of GC.
- Consistently use enum notation in ScopeId.
- Disallow copy and assign for Scope and GCTracer.
- Remove unused stats on GCTracer.

R=hpayer@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22439 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ee9ed361
......@@ -804,11 +804,6 @@ void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
}
double GCTracer::SizeOfHeapObjects() {
return (static_cast<double>(heap_->SizeOfObjects())) / MB;
}
} } // namespace v8::internal
#endif // V8_HEAP_INL_H_
This diff is collapsed.
......@@ -1236,6 +1236,12 @@ class Heap {
}
}
// Update GC statistics that are tracked on the Heap.
void UpdateGCStatistics(double start_time,
double end_time,
double spent_in_mutator,
double marking_time);
// Returns maximum GC pause.
double get_max_gc_pause() { return max_gc_pause_; }
......@@ -2535,7 +2541,7 @@ class GCTracer BASE_EMBEDDED {
MC_WEAKCOLLECTION_PROCESS,
MC_WEAKCOLLECTION_CLEAR,
MC_FLUSH_CODE,
kNumberOfScopes
NUMBER_OF_SCOPES
};
Scope(GCTracer* tracer, ScopeId scope)
......@@ -2545,7 +2551,7 @@ class GCTracer BASE_EMBEDDED {
}
~Scope() {
ASSERT(scope_ < kNumberOfScopes); // scope_ is unsigned.
ASSERT(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
tracer_->scopes_[scope_] += base::OS::TimeCurrentMillis() - start_time_;
}
......@@ -2553,22 +2559,16 @@ class GCTracer BASE_EMBEDDED {
GCTracer* tracer_;
ScopeId scope_;
double start_time_;
DISALLOW_COPY_AND_ASSIGN(Scope);
};
explicit GCTracer(Heap* heap,
GarbageCollector collector,
const char* gc_reason,
const char* collector_reason);
~GCTracer();
// Sets the collector.
void set_collector(GarbageCollector collector) { collector_ = collector; }
// Sets the GC count.
void set_gc_count(unsigned int count) { gc_count_ = count; }
// Sets the full GC count.
void set_full_gc_count(int count) { full_gc_count_ = count; }
void increment_nodes_died_in_new_space() {
nodes_died_in_new_space_++;
}
......@@ -2583,32 +2583,37 @@ class GCTracer BASE_EMBEDDED {
private:
// Returns a string matching the collector.
const char* CollectorString();
const char* CollectorString() const;
// Print one detailed trace line in name=value format.
void PrintNVP() const;
// Returns size of object in heap (in MB).
inline double SizeOfHeapObjects();
// Print one trace line.
void Print() const;
// Timestamp set in the constructor.
double start_time_;
// Timestamp set in the destructor.
double end_time_;
// Size of objects in heap set in constructor.
intptr_t start_object_size_;
// Size of objects in heap set in destructor.
intptr_t end_object_size_;
// Size of memory allocated from OS set in constructor.
intptr_t start_memory_size_;
// Size of memory allocated from OS set in destructor.
intptr_t end_memory_size_;
// Type of collector.
GarbageCollector collector_;
// A count (including this one, e.g. the first collection is 1) of the
// number of garbage collections.
unsigned int gc_count_;
// A count (including this one) of the number of full garbage collections.
int full_gc_count_;
// Amounts of time spent in different scopes during GC.
double scopes_[Scope::kNumberOfScopes];
double scopes_[Scope::NUMBER_OF_SCOPES];
// Total amount of space either wasted or contained in one of free lists
// before the current GC.
......@@ -2642,6 +2647,8 @@ class GCTracer BASE_EMBEDDED {
const char* gc_reason_;
const char* collector_reason_;
DISALLOW_COPY_AND_ASSIGN(GCTracer);
};
......
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