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

Side by Side 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: Addressing ulan's comments. 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 unified diff | Download patch
« include/v8.h ('K') | « include/v8.h ('k') | src/heap/heap.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after
5341 heap_size_limit_(0) { } 5341 heap_size_limit_(0) { }
5342 5342
5343 5343
5344 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), 5344 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
5345 space_size_(0), 5345 space_size_(0),
5346 space_used_size_(0), 5346 space_used_size_(0),
5347 space_available_size_(0), 5347 space_available_size_(0),
5348 physical_space_size_(0) { } 5348 physical_space_size_(0) { }
5349 5349
5350 5350
5351 HeapObjectStatistics::HeapObjectStatistics(): object_type_(nullptr),
5352 object_count_(0),
5353 object_size_(0) { }
5354
5351 bool v8::V8::InitializeICU(const char* icu_data_file) { 5355 bool v8::V8::InitializeICU(const char* icu_data_file) {
5352 return i::InitializeICU(icu_data_file); 5356 return i::InitializeICU(icu_data_file);
5353 } 5357 }
5354 5358
5355 5359
5356 const char* v8::V8::GetVersion() { 5360 const char* v8::V8::GetVersion() {
5357 return i::Version::GetVersion(); 5361 return i::Version::GetVersion();
5358 } 5362 }
5359 5363
5360 5364
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
6914 6918
6915 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); 6919 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index));
6916 space_statistics->space_size_ = space->CommittedMemory(); 6920 space_statistics->space_size_ = space->CommittedMemory();
6917 space_statistics->space_used_size_ = space->SizeOfObjects(); 6921 space_statistics->space_used_size_ = space->SizeOfObjects();
6918 space_statistics->space_available_size_ = space->Available(); 6922 space_statistics->space_available_size_ = space->Available();
6919 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); 6923 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory();
6920 return true; 6924 return true;
6921 } 6925 }
6922 6926
6923 6927
6928 size_t Isolate::NumberOfTrackedGCObjectsTypes() {
6929 return i::Heap::OBJECT_STATS_COUNT;
6930 }
6931
6932
6933 bool Isolate::GetHeapObjectStatisticsAtLastGC(
6934 HeapObjectStatistics* object_statistics, size_t type_index) {
6935 if (!object_statistics) return false;
6936 if (type_index >= i::Heap::OBJECT_STATS_COUNT) return false;
6937 if (!i::FLAG_track_gc_object_stats) return false;
6938
6939 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6940 i::Heap* heap = isolate->heap();
6941 const char* object_type = heap->GetObjectTypeName(type_index);
6942 size_t object_count = heap->object_count_last_gc(type_index);
6943 size_t object_size = heap->object_size_last_gc(type_index);
6944 if (object_type == nullptr) {
6945 // There should be no objects counted when the type is unknown.
6946 DCHECK_EQ(object_count, 0);
6947 DCHECK_EQ(object_size, 0);
6948 return false;
6949 }
6950
6951 object_statistics->object_type_ = object_type;
6952 object_statistics->object_count_ = object_count;
6953 object_statistics->object_size_ = object_size;
6954 return true;
6955 }
6956
6957
6924 void Isolate::GetStackSample(const RegisterState& state, void** frames, 6958 void Isolate::GetStackSample(const RegisterState& state, void** frames,
6925 size_t frames_limit, SampleInfo* sample_info) { 6959 size_t frames_limit, SampleInfo* sample_info) {
6926 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6960 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6927 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, 6961 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame,
6928 frames, frames_limit, sample_info); 6962 frames, frames_limit, sample_info);
6929 } 6963 }
6930 6964
6931 6965
6932 void Isolate::SetEventLogger(LogEventCallback that) { 6966 void Isolate::SetEventLogger(LogEventCallback that) {
6933 // Do not overwrite the event logger if we want to log explicitly. 6967 // Do not overwrite the event logger if we want to log explicitly.
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
8031 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8065 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8032 Address callback_address = 8066 Address callback_address =
8033 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8067 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8034 VMState<EXTERNAL> state(isolate); 8068 VMState<EXTERNAL> state(isolate);
8035 ExternalCallbackScope call_scope(isolate, callback_address); 8069 ExternalCallbackScope call_scope(isolate, callback_address);
8036 callback(info); 8070 callback(info);
8037 } 8071 }
8038 8072
8039 8073
8040 } } // namespace v8::internal 8074 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698