Chromium Code Reviews| 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 enum FakeClass { | |
|
Ivan Posva
2013/01/12 00:58:10
Comment about spacing the ids.
| |
| 78 kJavaLangClass = 1, | |
| 79 kJavaLangClassLoader = 9, | |
| 80 kJavaLangObject = 17, | |
| 81 kJavaLangString = 25, | |
| 82 kArrayObject = 33, | |
| 83 kArrayBoolean = 41, | |
| 84 kArrayChar = 49, | |
| 85 kArrayFloat = 57, | |
| 86 kArrayDouble = 65, | |
| 87 kArrayByte = 73, | |
| 88 kArrayShort = 81, | |
| 89 kArrayInt = 89, | |
| 90 kArrayLong = 98 | |
|
Ivan Posva
2013/01/12 00:58:10
97
| |
| 91 }; | |
| 92 | |
| 77 static const int kObjectIdSize = sizeof(uint64_t); // NOLINT | 93 static const int kObjectIdSize = sizeof(uint64_t); // NOLINT |
| 78 | 94 |
| 79 HeapProfiler(Dart_FileWriteCallback callback, void* stream); | 95 HeapProfiler(Dart_FileWriteCallback callback, void* stream); |
| 80 ~HeapProfiler(); | 96 ~HeapProfiler(); |
| 81 | 97 |
| 82 // Writes a root to the heap dump. | 98 // Writes a root to the heap dump. |
| 83 void WriteRoot(const RawObject* raw_obj); | 99 void WriteRoot(const RawObject* raw_obj); |
| 84 | 100 |
| 85 // Writes a object to the heap dump. | 101 // Writes a object to the heap dump. |
| 86 void WriteObject(const RawObject* raw_obj); | 102 void WriteObject(const RawObject* raw_obj); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 | 228 |
| 213 // Invokes the write callback. | 229 // Invokes the write callback. |
| 214 void Write(const void* data, intptr_t size); | 230 void Write(const void* data, intptr_t size); |
| 215 | 231 |
| 216 // Writes the binary hprof header to the output stream. | 232 // Writes the binary hprof header to the output stream. |
| 217 void WriteHeader(); | 233 void WriteHeader(); |
| 218 | 234 |
| 219 // Writes a record to the output stream. | 235 // Writes a record to the output stream. |
| 220 void WriteRecord(const Record& record); | 236 void WriteRecord(const Record& record); |
| 221 | 237 |
| 222 | |
| 223 // Writes a string in utf-8 record to the output stream. | 238 // Writes a string in utf-8 record to the output stream. |
| 224 void WriteStringInUtf8(const char* c_string); | 239 void WriteStringInUtf8(const char* c_string); |
| 225 void WriteStringInUtf8(const RawString* raw_string); | 240 void WriteStringInUtf8(const RawString* raw_string); |
| 226 | 241 |
| 227 | |
| 228 // Writes a load class record to the output stream. | 242 // Writes a load class record to the output stream. |
| 229 void WriteLoadClass(const RawClass* raw_class); | 243 void WriteLoadClass(const RawClass* raw_class); |
| 244 void WriteFakeLoadClass(FakeClass fake_class, const char* class_name); | |
| 230 | 245 |
| 231 // Writes an empty stack trace to the output stream. | 246 // Writes an empty stack trace to the output stream. |
| 232 void WriteStackTrace(); | 247 void WriteStackTrace(); |
| 233 | 248 |
| 234 // Writes a heap summary record to the output stream. | 249 // Writes a heap summary record to the output stream. |
| 235 void WriteHeapSummary(uint32_t total_live_bytes, | 250 void WriteHeapSummary(uint32_t total_live_bytes, |
| 236 uint32_t total_live_instances, | 251 uint32_t total_live_instances, |
| 237 uint64_t total_bytes_allocated, | 252 uint64_t total_bytes_allocated, |
| 238 uint64_t total_instances_allocated); | 253 uint64_t total_instances_allocated); |
| 239 | 254 |
| 240 // Writes a heap dump record to the output stream. | 255 // Writes a heap dump record to the output stream. |
| 241 void WriteHeapDump(); | 256 void WriteHeapDump(); |
| 242 | 257 |
| 243 // Writes a sub-record to the heap dump record. | 258 // Writes a sub-record to the heap dump record. |
| 244 void WriteClassDump(const RawClass* raw_class); | 259 void WriteClassDump(const RawClass* raw_class); |
| 260 void WriteFakeClassDump(FakeClass fake_class, FakeClass fake_super_class); | |
| 245 void WriteInstanceDump(const RawObject* raw_obj); | 261 void WriteInstanceDump(const RawObject* raw_obj); |
| 246 void WriteObjectArrayDump(const RawArray* raw_array); | 262 void WriteObjectArrayDump(const RawArray* raw_array); |
| 247 void WritePrimitiveArrayDump(const RawByteArray* raw_byte_array, | 263 void WritePrimitiveArrayDump(const RawByteArray* raw_byte_array, |
| 248 uint8_t tag, | 264 uint8_t tag, |
| 249 const void* data); | 265 const void* data); |
| 250 | 266 |
| 251 static const RawClass* GetClass(const RawObject* raw_obj); | 267 static const RawClass* GetClass(const RawObject* raw_obj); |
| 252 static const RawClass* GetSuperClass(const RawClass* raw_class); | 268 static const RawClass* GetSuperClass(const RawClass* raw_class); |
| 253 | 269 |
| 254 Dart_FileWriteCallback write_callback_; | 270 Dart_FileWriteCallback write_callback_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 virtual void VisitObject(RawObject* obj); | 322 virtual void VisitObject(RawObject* obj); |
| 307 | 323 |
| 308 private: | 324 private: |
| 309 HeapProfiler* profiler_; | 325 HeapProfiler* profiler_; |
| 310 DISALLOW_COPY_AND_ASSIGN(HeapProfilerObjectVisitor); | 326 DISALLOW_COPY_AND_ASSIGN(HeapProfilerObjectVisitor); |
| 311 }; | 327 }; |
| 312 | 328 |
| 313 } // namespace dart | 329 } // namespace dart |
| 314 | 330 |
| 315 #endif // VM_HEAP_PROFILER_H_ | 331 #endif // VM_HEAP_PROFILER_H_ |
| OLD | NEW |