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

Unified Diff: src/profile-generator.cc

Issue 9463008: Tune snapshot taking progress indicator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update to the test. Created 8 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 | « no previous file | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index b936e79a5c4a50953d67620bd267c835d391afd7..156fbc7b63cb29782bbf85f1d8120554f7e53609 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -3166,7 +3166,7 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
debug_heap->Verify();
#endif
- SetProgressTotal(4); // 2 passes + dominators + sizes.
+ SetProgressTotal(2); // 2 passes.
#ifdef DEBUG
debug_heap->Verify();
@@ -3303,10 +3303,9 @@ bool HeapSnapshotGenerator::BuildDominatorTree(
affected[children[i].to()->ordered_index()] = true;
}
- int changed = 1;
- const int base_progress_counter = progress_counter_;
- while (changed != 0) {
- changed = 0;
+ bool changed = true;
+ while (changed) {
+ changed = false;
for (int i = root_index - 1; i >= 0; --i) {
// If dominator of the entry has already been set to root,
// then it can't propagate any further.
@@ -3330,17 +3329,13 @@ bool HeapSnapshotGenerator::BuildDominatorTree(
if (new_idom_index != kNoDominator
&& dominators->at(i) != new_idom_index) {
(*dominators)[i] = new_idom_index;
- ++changed;
+ changed = true;
Vector<HeapGraphEdge> children = entries[i]->children();
for (int j = 0; j < children.length(); ++j) {
affected[children[j].to()->ordered_index()] = true;
}
}
}
- int remaining = entries_length - changed;
- ASSERT(remaining >= 0);
- progress_counter_ = base_progress_counter + remaining;
- if (!ProgressReport(true)) return false;
}
return true;
}
@@ -3364,21 +3359,19 @@ bool HeapSnapshotGenerator::ApproximateRetainedSizes() {
// As for the dominators tree we only know parent nodes, not
// children, to sum up total sizes we "bubble" node's self size
// adding it to all of its parents.
- for (int i = 0; i < snapshot_->entries()->length(); ++i) {
- HeapEntry* entry = snapshot_->entries()->at(i);
+ List<HeapEntry*>& entries = *snapshot_->entries();
+ for (int i = 0; i < entries.length(); ++i) {
+ HeapEntry* entry = entries[i];
entry->set_retained_size(entry->self_size());
}
- for (int i = 0;
- i < snapshot_->entries()->length();
- ++i, ProgressStep()) {
- HeapEntry* entry = snapshot_->entries()->at(i);
+ for (int i = 0; i < entries.length(); ++i) {
+ HeapEntry* entry = entries[i];
int entry_size = entry->self_size();
for (HeapEntry* dominator = entry->dominator();
dominator != entry;
entry = dominator, dominator = entry->dominator()) {
dominator->add_retained_size(entry_size);
}
- if (!ProgressReport()) return false;
}
return true;
}
« no previous file with comments | « no previous file | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698