Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 14d3a823ebf637a75322e464704085812ab6dcb5..08f6c98c44162e9f5bff14b8b5d6f9d8b4831f1f 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -32,6 +32,7 @@ |
| #include "src/global-handles.h" |
| #include "src/heap-profiler.h" |
| #include "src/heap-snapshot-generator-inl.h" |
| +#include "src/heap/spaces.h" |
| #include "src/icu_util.h" |
| #include "src/json-parser.h" |
| #include "src/messages.h" |
| @@ -5463,6 +5464,13 @@ HeapStatistics::HeapStatistics(): total_heap_size_(0), |
| heap_size_limit_(0) { } |
| +HeapSpaceStatistics::HeapSpaceStatistics(): space_name_(0), |
| + space_size_(0), |
| + space_used_size_(0), |
| + space_available_size_(0), |
| + physical_space_size_(0) { } |
| + |
| + |
| bool v8::V8::InitializeICU(const char* icu_data_file) { |
| return i::InitializeICU(icu_data_file); |
| } |
| @@ -7000,6 +7008,30 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
| } |
| +int Isolate::NumberOfHeapSpaces() { |
| + return i::LAST_SPACE - i::FIRST_SPACE + 1; |
| +} |
| + |
| + |
| +bool Isolate::GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics, |
| + int index) { |
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| + i::Heap* heap = isolate->heap(); |
| + if (!space_statistics) |
| + return false; |
| + if (index > i::LAST_SPACE || index < i::FIRST_SPACE) |
| + return false; |
| + |
| + space_statistics->space_name_ = heap->GetSpaceName(index); |
| + i::Space* space = heap->space(index); |
|
rmcilroy
2015/04/16 16:53:36
super nit - move up on line (just to keep all fill
|
| + space_statistics->space_size_ = space->CommittedMemory(); |
| + space_statistics->space_used_size_ = space->Size(); |
| + space_statistics->space_available_size_ = space->Available(); |
| + space_statistics->physical_space_size_ = space->CommittedPhysicalMemory(); |
| + 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); |