| Index: runtime/vm/metrics.cc
|
| diff --git a/runtime/vm/metrics.cc b/runtime/vm/metrics.cc
|
| index 3cf35f68fe32c767fa3a3983f0d7edc1b676035e..5489823047c4f7f9233ab74d5f095661df7c03d9 100644
|
| --- a/runtime/vm/metrics.cc
|
| +++ b/runtime/vm/metrics.cc
|
| @@ -6,10 +6,10 @@
|
|
|
| #include "vm/isolate.h"
|
| #include "vm/json_stream.h"
|
| +#include "vm/log.h"
|
| #include "vm/native_entry.h"
|
| -#include "vm/runtime_entry.h"
|
| #include "vm/object.h"
|
| -#include "vm/log.h"
|
| +#include "vm/runtime_entry.h"
|
|
|
| namespace dart {
|
|
|
| @@ -28,7 +28,6 @@ Metric::Metric()
|
| value_(0),
|
| next_(NULL) {}
|
|
|
| -
|
| void Metric::Init(Isolate* isolate,
|
| const char* name,
|
| const char* description,
|
| @@ -43,7 +42,6 @@ void Metric::Init(Isolate* isolate,
|
| RegisterWithIsolate();
|
| }
|
|
|
| -
|
| void Metric::Init(const char* name, const char* description, Unit unit) {
|
| // Only called once.
|
| ASSERT(next_ == NULL);
|
| @@ -54,7 +52,6 @@ void Metric::Init(const char* name, const char* description, Unit unit) {
|
| RegisterWithVM();
|
| }
|
|
|
| -
|
| Metric::~Metric() {
|
| // Only deregister metrics which had been registered. Metrics without a name
|
| // are from shallow copy isolates.
|
| @@ -67,7 +64,6 @@ Metric::~Metric() {
|
| }
|
| }
|
|
|
| -
|
| #ifndef PRODUCT
|
| static const char* UnitString(intptr_t unit) {
|
| switch (unit) {
|
| @@ -84,7 +80,6 @@ static const char* UnitString(intptr_t unit) {
|
| return NULL;
|
| }
|
|
|
| -
|
| void Metric::PrintJSON(JSONStream* stream) {
|
| if (!FLAG_support_service) {
|
| return;
|
| @@ -105,7 +100,6 @@ void Metric::PrintJSON(JSONStream* stream) {
|
| }
|
| #endif // !PRODUCT
|
|
|
| -
|
| char* Metric::ValueToString(int64_t value, Unit unit) {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
| @@ -149,7 +143,6 @@ char* Metric::ValueToString(int64_t value, Unit unit) {
|
| }
|
| }
|
|
|
| -
|
| char* Metric::ToString() {
|
| Thread* thread = Thread::Current();
|
| ASSERT(thread != NULL);
|
| @@ -158,7 +151,6 @@ char* Metric::ToString() {
|
| return zone->PrintToString("%s %s", name(), ValueToString(Value(), unit()));
|
| }
|
|
|
| -
|
| bool Metric::NameExists(Metric* head, const char* name) {
|
| ASSERT(name != NULL);
|
| while (head != NULL) {
|
| @@ -172,7 +164,6 @@ bool Metric::NameExists(Metric* head, const char* name) {
|
| return false;
|
| }
|
|
|
| -
|
| void Metric::RegisterWithIsolate() {
|
| ASSERT(isolate_ != NULL);
|
| ASSERT(next_ == NULL);
|
| @@ -185,7 +176,6 @@ void Metric::RegisterWithIsolate() {
|
| isolate_->set_metrics_list_head(this);
|
| }
|
|
|
| -
|
| void Metric::DeregisterWithIsolate() {
|
| Metric* head = isolate_->metrics_list_head();
|
| ASSERT(head != NULL);
|
| @@ -214,7 +204,6 @@ void Metric::DeregisterWithIsolate() {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| void Metric::RegisterWithVM() {
|
| ASSERT(isolate_ == NULL);
|
| ASSERT(next_ == NULL);
|
| @@ -227,7 +216,6 @@ void Metric::RegisterWithVM() {
|
| vm_list_head_ = this;
|
| }
|
|
|
| -
|
| void Metric::DeregisterWithVM() {
|
| ASSERT(isolate_ == NULL);
|
| Metric* head = vm_list_head_;
|
| @@ -259,43 +247,36 @@ void Metric::DeregisterWithVM() {
|
| UNREACHABLE();
|
| }
|
|
|
| -
|
| int64_t MetricHeapOldUsed::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->UsedInWords(Heap::kOld) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapOldCapacity::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->CapacityInWords(Heap::kOld) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapOldExternal::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->ExternalInWords(Heap::kOld) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapNewUsed::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapNewCapacity::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->CapacityInWords(Heap::kNew) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapNewExternal::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->ExternalInWords(Heap::kNew) * kWordSize;
|
| }
|
|
|
| -
|
| int64_t MetricHeapUsed::Value() const {
|
| ASSERT(isolate() == Isolate::Current());
|
| return isolate()->heap()->UsedInWords(Heap::kNew) * kWordSize +
|
| @@ -306,7 +287,6 @@ int64_t MetricIsolateCount::Value() const {
|
| return Isolate::IsolateListLength();
|
| }
|
|
|
| -
|
| int64_t MetricPeakRSS::Value() const {
|
| return OS::MaxRSS();
|
| }
|
| @@ -316,7 +296,6 @@ int64_t MetricPeakRSS::Value() const {
|
| VM_METRIC_LIST(VM_METRIC_VARIABLE);
|
| #undef VM_METRIC_VARIABLE
|
|
|
| -
|
| void Metric::InitOnce() {
|
| #define VM_METRIC_INIT(type, variable, name, unit) \
|
| vm_metric_##variable##_.Init(name, NULL, Metric::unit);
|
| @@ -338,24 +317,20 @@ void Metric::Cleanup() {
|
| }
|
| }
|
|
|
| -
|
| MaxMetric::MaxMetric() : Metric() {
|
| set_value(kMinInt64);
|
| }
|
|
|
| -
|
| void MaxMetric::SetValue(int64_t new_value) {
|
| if (new_value > value()) {
|
| set_value(new_value);
|
| }
|
| }
|
|
|
| -
|
| MinMetric::MinMetric() : Metric() {
|
| set_value(kMaxInt64);
|
| }
|
|
|
| -
|
| void MinMetric::SetValue(int64_t new_value) {
|
| if (new_value < value()) {
|
| set_value(new_value);
|
|
|