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

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: Fixing api name and rebase 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 5331 matching lines...) Expand 10 before | Expand all | Expand 10 after
5342 heap_size_limit_(0) { } 5342 heap_size_limit_(0) { }
5343 5343
5344 5344
5345 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), 5345 HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0),
5346 space_size_(0), 5346 space_size_(0),
5347 space_used_size_(0), 5347 space_used_size_(0),
5348 space_available_size_(0), 5348 space_available_size_(0),
5349 physical_space_size_(0) { } 5349 physical_space_size_(0) { }
5350 5350
5351 5351
5352 HeapObjectStatistics::HeapObjectStatistics(): object_type_(nullptr),
5353 object_count_(0),
5354 object_size_(0) { }
5355
5352 bool v8::V8::InitializeICU(const char* icu_data_file) { 5356 bool v8::V8::InitializeICU(const char* icu_data_file) {
5353 return i::InitializeICU(icu_data_file); 5357 return i::InitializeICU(icu_data_file);
5354 } 5358 }
5355 5359
5356 5360
5357 const char* v8::V8::GetVersion() { 5361 const char* v8::V8::GetVersion() {
5358 return i::Version::GetVersion(); 5362 return i::Version::GetVersion();
5359 } 5363 }
5360 5364
5361 5365
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
6915 6919
6916 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index)); 6920 space_statistics->space_name_ = heap->GetSpaceName(static_cast<int>(index));
6917 space_statistics->space_size_ = space->CommittedMemory(); 6921 space_statistics->space_size_ = space->CommittedMemory();
6918 space_statistics->space_used_size_ = space->SizeOfObjects(); 6922 space_statistics->space_used_size_ = space->SizeOfObjects();
6919 space_statistics->space_available_size_ = space->Available(); 6923 space_statistics->space_available_size_ = space->Available();
6920 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); 6924 space_statistics->physical_space_size_ = space->CommittedPhysicalMemory();
6921 return true; 6925 return true;
6922 } 6926 }
6923 6927
6924 6928
6929 size_t Isolate::NumberOfTrackedHeapObjectTypes() {
6930 return i::Heap::OBJECT_STATS_COUNT;
6931 }
6932
6933
6934 bool Isolate::GetHeapObjectStatisticsAtLastGC(
6935 HeapObjectStatistics* object_statistics, size_t type_index) {
6936 if (!object_statistics) return false;
6937 if (type_index >= i::Heap::OBJECT_STATS_COUNT) return false;
6938 if (!i::FLAG_track_gc_object_stats) return false;
6939
6940 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6941 i::Heap* heap = isolate->heap();
6942 const char* object_type = heap->GetObjectTypeName(type_index);
6943 size_t object_count = heap->object_count_last_gc(type_index);
6944 size_t object_size = heap->object_size_last_gc(type_index);
6945 if (object_type == nullptr) {
6946 // There should be no objects counted when the type is unknown.
6947 DCHECK_EQ(object_count, 0);
6948 DCHECK_EQ(object_size, 0);
6949 return false;
6950 }
6951
6952 object_statistics->object_type_ = object_type;
6953 object_statistics->object_count_ = object_count;
6954 object_statistics->object_size_ = object_size;
6955 return true;
6956 }
6957
6958
6925 void Isolate::GetStackSample(const RegisterState& state, void** frames, 6959 void Isolate::GetStackSample(const RegisterState& state, void** frames,
6926 size_t frames_limit, SampleInfo* sample_info) { 6960 size_t frames_limit, SampleInfo* sample_info) {
6927 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); 6961 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6928 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame, 6962 i::TickSample::GetStackSample(isolate, state, i::TickSample::kSkipCEntryFrame,
6929 frames, frames_limit, sample_info); 6963 frames, frames_limit, sample_info);
6930 } 6964 }
6931 6965
6932 6966
6933 void Isolate::SetEventLogger(LogEventCallback that) { 6967 void Isolate::SetEventLogger(LogEventCallback that) {
6934 // Do not overwrite the event logger if we want to log explicitly. 6968 // Do not overwrite the event logger if we want to log explicitly.
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
8032 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8066 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8033 Address callback_address = 8067 Address callback_address =
8034 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8068 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8035 VMState<EXTERNAL> state(isolate); 8069 VMState<EXTERNAL> state(isolate);
8036 ExternalCallbackScope call_scope(isolate, callback_address); 8070 ExternalCallbackScope call_scope(isolate, callback_address);
8037 callback(info); 8071 callback(info);
8038 } 8072 }
8039 8073
8040 8074
8041 } } // namespace v8::internal 8075 } } // 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