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

Unified Diff: src/api.cc

Issue 1113233002: Adding api to get last gc object statistics for chrome://tracing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixing the comment with NumberOfTrackedHeapObjectTypes. Created 5 years, 7 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 | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 4f16120df33ddbb4d096c4a3a33820b911986833..6c600392e33fc32e1cebe1edda0c6cc55cfa46b5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -5349,6 +5349,12 @@ HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
physical_space_size_(0) { }
+HeapObjectStatistics::HeapObjectStatistics()
+ : object_type_(nullptr),
+ object_sub_type_(nullptr),
+ object_count_(0),
+ object_size_(0) {}
+
bool v8::V8::InitializeICU(const char* icu_data_file) {
return i::InitializeICU(icu_data_file);
}
@@ -6922,6 +6928,38 @@ bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
}
+size_t Isolate::NumberOfTrackedHeapObjectTypes() {
+ return i::Heap::OBJECT_STATS_COUNT;
+}
+
+
+bool Isolate::GetHeapObjectStatisticsAtLastGC(
+ HeapObjectStatistics* object_statistics, size_t type_index) {
+ if (!object_statistics) return false;
+ if (type_index >= i::Heap::OBJECT_STATS_COUNT) return false;
+ if (!i::FLAG_track_gc_object_stats) return false;
+
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+ i::Heap* heap = isolate->heap();
+ const char* object_type;
+ const char* object_sub_type;
+ size_t object_count = heap->object_count_last_gc(type_index);
+ size_t object_size = heap->object_size_last_gc(type_index);
+ if (!heap->GetObjectTypeName(type_index, &object_type, &object_sub_type)) {
+ // There should be no objects counted when the type is unknown.
+ DCHECK_EQ(object_count, 0);
+ DCHECK_EQ(object_size, 0);
+ return false;
+ }
+
+ object_statistics->object_type_ = object_type;
+ object_statistics->object_sub_type_ = object_sub_type;
+ object_statistics->object_count_ = object_count;
+ object_statistics->object_size_ = object_size;
+ return true;
+}
+
+
void Isolate::GetStackSample(const RegisterState& state, void** frames,
size_t frames_limit, SampleInfo* sample_info) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
« no previous file with comments | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698