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

Side by Side Diff: src/heap-snapshot-generator.cc

Issue 1037803002: Return timestamp of the last recorded interval to the caller of HeapProfiler::GetHeapStats (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap-snapshot-generator-inl.h" 7 #include "src/heap-snapshot-generator-inl.h"
8 8
9 #include "src/allocation-tracker.h" 9 #include "src/allocation-tracker.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 PrintF("Last %d objects were skipped\n", 604 PrintF("Last %d objects were skipped\n",
605 heap_objects.length() - 1 - last_printed_object); 605 heap_objects.length() - 1 - last_printed_object);
606 } 606 }
607 PrintF("End HeapObjectsMap::FindUntrackedObjects. %d entries in map.\n\n", 607 PrintF("End HeapObjectsMap::FindUntrackedObjects. %d entries in map.\n\n",
608 entries_map_.occupancy()); 608 entries_map_.occupancy());
609 } 609 }
610 return untracked; 610 return untracked;
611 } 611 }
612 612
613 613
614 SnapshotObjectId HeapObjectsMap::PushHeapObjectsStats(OutputStream* stream) { 614 SnapshotObjectId HeapObjectsMap::PushHeapObjectsStats(OutputStream* stream,
615 int64_t* timestamp_us) {
615 UpdateHeapObjectsMap(); 616 UpdateHeapObjectsMap();
616 time_intervals_.Add(TimeInterval(next_id_)); 617 time_intervals_.Add(TimeInterval(next_id_));
617 int prefered_chunk_size = stream->GetChunkSize(); 618 int prefered_chunk_size = stream->GetChunkSize();
618 List<v8::HeapStatsUpdate> stats_buffer; 619 List<v8::HeapStatsUpdate> stats_buffer;
619 DCHECK(!entries_.is_empty()); 620 DCHECK(!entries_.is_empty());
620 EntryInfo* entry_info = &entries_.first(); 621 EntryInfo* entry_info = &entries_.first();
621 EntryInfo* end_entry_info = &entries_.last() + 1; 622 EntryInfo* end_entry_info = &entries_.last() + 1;
622 for (int time_interval_index = 0; 623 for (int time_interval_index = 0;
623 time_interval_index < time_intervals_.length(); 624 time_interval_index < time_intervals_.length();
624 ++time_interval_index) { 625 ++time_interval_index) {
(...skipping 21 matching lines...) Expand all
646 } 647 }
647 } 648 }
648 } 649 }
649 DCHECK(entry_info == end_entry_info); 650 DCHECK(entry_info == end_entry_info);
650 if (!stats_buffer.is_empty()) { 651 if (!stats_buffer.is_empty()) {
651 OutputStream::WriteResult result = stream->WriteHeapStatsChunk( 652 OutputStream::WriteResult result = stream->WriteHeapStatsChunk(
652 &stats_buffer.first(), stats_buffer.length()); 653 &stats_buffer.first(), stats_buffer.length());
653 if (result == OutputStream::kAbort) return last_assigned_id(); 654 if (result == OutputStream::kAbort) return last_assigned_id();
654 } 655 }
655 stream->EndOfStream(); 656 stream->EndOfStream();
657 if (timestamp_us) {
658 *timestamp_us = (time_intervals_.last().timestamp -
659 time_intervals_[0].timestamp).InMicroseconds();
660 }
656 return last_assigned_id(); 661 return last_assigned_id();
657 } 662 }
658 663
659 664
660 void HeapObjectsMap::RemoveDeadEntries() { 665 void HeapObjectsMap::RemoveDeadEntries() {
661 DCHECK(entries_.length() > 0 && 666 DCHECK(entries_.length() > 0 &&
662 entries_.at(0).id == 0 && 667 entries_.at(0).id == 0 &&
663 entries_.at(0).addr == NULL); 668 entries_.at(0).addr == NULL);
664 int first_free_entry = 1; 669 int first_free_entry = 1;
665 for (int i = 1; i < entries_.length(); ++i) { 670 for (int i = 1; i < entries_.length(); ++i) {
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 writer_->AddString("\"<dummy>\""); 3157 writer_->AddString("\"<dummy>\"");
3153 for (int i = 1; i < sorted_strings.length(); ++i) { 3158 for (int i = 1; i < sorted_strings.length(); ++i) {
3154 writer_->AddCharacter(','); 3159 writer_->AddCharacter(',');
3155 SerializeString(sorted_strings[i]); 3160 SerializeString(sorted_strings[i]);
3156 if (writer_->aborted()) return; 3161 if (writer_->aborted()) return;
3157 } 3162 }
3158 } 3163 }
3159 3164
3160 3165
3161 } } // namespace v8::internal 3166 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698