| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_HEAP_PROFILER_H_ | 5 #ifndef VM_HEAP_PROFILER_H_ |
| 6 #define VM_HEAP_PROFILER_H_ | 6 #define VM_HEAP_PROFILER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "include/dart_api.h" | 10 #include "include/dart_api.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 kBoolean = 4, | 67 kBoolean = 4, |
| 68 kChar = 5, | 68 kChar = 5, |
| 69 kFloat = 6, | 69 kFloat = 6, |
| 70 kDouble = 7, | 70 kDouble = 7, |
| 71 kByte = 8, | 71 kByte = 8, |
| 72 kShort = 9, | 72 kShort = 9, |
| 73 kInt = 10, | 73 kInt = 10, |
| 74 kLong = 11 | 74 kLong = 11 |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 static const int kObjectIdSize = sizeof(uint64_t); // NOLINT |
| 78 |
| 77 HeapProfiler(Dart_FileWriteCallback callback, void* stream); | 79 HeapProfiler(Dart_FileWriteCallback callback, void* stream); |
| 78 ~HeapProfiler(); | 80 ~HeapProfiler(); |
| 79 | 81 |
| 80 // Writes a root to the heap dump. | 82 // Writes a root to the heap dump. |
| 81 void WriteRoot(const RawObject* raw_obj); | 83 void WriteRoot(const RawObject* raw_obj); |
| 82 | 84 |
| 83 // Writes a object to the heap dump. | 85 // Writes a object to the heap dump. |
| 84 void WriteObject(const RawObject* raw_obj); | 86 void WriteObject(const RawObject* raw_obj); |
| 85 | 87 |
| 86 private: | 88 private: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void Write(const uint8_t* value, intptr_t size); | 156 void Write(const uint8_t* value, intptr_t size); |
| 155 | 157 |
| 156 // Appends an 8-, 16-, 32- or 64-bit value to the body in | 158 // Appends an 8-, 16-, 32- or 64-bit value to the body in |
| 157 // big-endian format. | 159 // big-endian format. |
| 158 void Write8(uint8_t value); | 160 void Write8(uint8_t value); |
| 159 void Write16(uint16_t value); | 161 void Write16(uint16_t value); |
| 160 void Write32(uint32_t value); | 162 void Write32(uint32_t value); |
| 161 void Write64(uint64_t value); | 163 void Write64(uint64_t value); |
| 162 | 164 |
| 163 // Appends an ID to the body. | 165 // Appends an ID to the body. |
| 164 void WritePointer(const void* value); | 166 void WriteObjectId(const void* value); |
| 165 | 167 |
| 166 private: | 168 private: |
| 167 // A tag value that describes the record format. | 169 // A tag value that describes the record format. |
| 168 uint8_t tag_; | 170 uint8_t tag_; |
| 169 | 171 |
| 170 // The payload of the record as described by the tag. | 172 // The payload of the record as described by the tag. |
| 171 Buffer body_; | 173 Buffer body_; |
| 172 | 174 |
| 173 // Parent object. | 175 // Parent object. |
| 174 HeapProfiler* profiler_; | 176 HeapProfiler* profiler_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 188 void Write(const uint8_t* value, intptr_t size); | 190 void Write(const uint8_t* value, intptr_t size); |
| 189 | 191 |
| 190 // Appends an 8-, 16-, 32- or 64-bit value to the heap dump | 192 // Appends an 8-, 16-, 32- or 64-bit value to the heap dump |
| 191 // record. | 193 // record. |
| 192 void Write8(uint8_t value); | 194 void Write8(uint8_t value); |
| 193 void Write16(uint16_t value); | 195 void Write16(uint16_t value); |
| 194 void Write32(uint32_t value); | 196 void Write32(uint32_t value); |
| 195 void Write64(uint64_t value); | 197 void Write64(uint64_t value); |
| 196 | 198 |
| 197 // Appends an ID to the current heap dump record. | 199 // Appends an ID to the current heap dump record. |
| 198 void WritePointer(const void* value); | 200 void WriteObjectId(const void* value); |
| 199 | 201 |
| 200 private: | 202 private: |
| 201 // The record instance that receives forwarded write calls. | 203 // The record instance that receives forwarded write calls. |
| 202 Record* record_; | 204 Record* record_; |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 // Id canonizers. | 207 // Id canonizers. |
| 206 const RawClass* ClassId(const RawClass* raw_class); | 208 const RawClass* ClassId(const RawClass* raw_class); |
| 207 const RawObject* ObjectId(const RawObject* raw_obj); | 209 const RawObject* ObjectId(const RawObject* raw_obj); |
| 208 const char* StringId(const char* c_string); | 210 const char* StringId(const char* c_string); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 virtual void VisitObject(RawObject* obj); | 306 virtual void VisitObject(RawObject* obj); |
| 305 | 307 |
| 306 private: | 308 private: |
| 307 HeapProfiler* profiler_; | 309 HeapProfiler* profiler_; |
| 308 DISALLOW_COPY_AND_ASSIGN(HeapProfilerObjectVisitor); | 310 DISALLOW_COPY_AND_ASSIGN(HeapProfilerObjectVisitor); |
| 309 }; | 311 }; |
| 310 | 312 |
| 311 } // namespace dart | 313 } // namespace dart |
| 312 | 314 |
| 313 #endif // VM_HEAP_PROFILER_H_ | 315 #endif // VM_HEAP_PROFILER_H_ |
| OLD | NEW |