OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_METRICS_H_ | 5 #ifndef VM_METRICS_H_ |
6 #define VM_METRICS_H_ | 6 #define VM_METRICS_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 enum Unit { | 29 enum Unit { |
30 kCounter, | 30 kCounter, |
31 kByte, | 31 kByte, |
32 }; | 32 }; |
33 | 33 |
34 Metric(); | 34 Metric(); |
35 | 35 |
36 static void InitOnce(); | 36 static void InitOnce(); |
37 | 37 |
| 38 static void Cleanup(); |
| 39 |
38 // Initialize and register a metric for an isolate. | 40 // Initialize and register a metric for an isolate. |
39 void Init(Isolate* isolate, | 41 void Init(Isolate* isolate, |
40 const char* name, | 42 const char* name, |
41 const char* description, | 43 const char* description, |
42 Unit unit); | 44 Unit unit); |
43 | 45 |
44 // Initialize and register a metric for the VM. | 46 // Initialize and register a metric for the VM. |
45 void Init(const char* name, | 47 void Init(const char* name, |
46 const char* description, | 48 const char* description, |
47 Unit unit); | 49 Unit unit); |
48 | 50 |
49 virtual ~Metric(); | 51 virtual ~Metric(); |
50 | 52 |
51 void PrintJSON(JSONStream* stream); | 53 void PrintJSON(JSONStream* stream); |
52 | 54 |
| 55 // Returns a zone allocated string. |
| 56 static char* ValueToString(int64_t value, Unit unit); |
| 57 |
| 58 // Returns a zone allocated string. |
| 59 char* ToString(); |
| 60 |
53 int64_t value() const { return value_; } | 61 int64_t value() const { return value_; } |
54 void set_value(int64_t value) { value_ = value; } | 62 void set_value(int64_t value) { value_ = value; } |
55 | 63 |
56 void increment() { value_++; } | 64 void increment() { value_++; } |
57 | 65 |
58 Metric* next() const { return next_; } | 66 Metric* next() const { return next_; } |
59 void set_next(Metric* next) { | 67 void set_next(Metric* next) { |
60 next_ = next; | 68 next_ = next; |
61 } | 69 } |
62 | 70 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 140 |
133 class MetricIsolateCount : public Metric { | 141 class MetricIsolateCount : public Metric { |
134 protected: | 142 protected: |
135 virtual int64_t Value() const; | 143 virtual int64_t Value() const; |
136 }; | 144 }; |
137 | 145 |
138 | 146 |
139 } // namespace dart | 147 } // namespace dart |
140 | 148 |
141 #endif // VM_METRICS_H_ | 149 #endif // VM_METRICS_H_ |
OLD | NEW |