| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // --- | 5 // --- |
| 6 // Author: Sainbayar Sukhbaatar | 6 // Author: Sainbayar Sukhbaatar |
| 7 // Dai Mikurube | 7 // Dai Mikurube |
| 8 // | 8 // |
| 9 // This file contains a class DeepHeapProfile and its public function | 9 // This file contains a class DeepHeapProfile and its public function |
| 10 // DeepHeapProfile::FillOrderedProfile() which works as an alternative of | 10 // DeepHeapProfile::FillOrderedProfile() which works as an alternative of |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 DeepHeapProfile(HeapProfileTable* heap_profile, const char* prefix); | 76 DeepHeapProfile(HeapProfileTable* heap_profile, const char* prefix); |
| 77 ~DeepHeapProfile(); | 77 ~DeepHeapProfile(); |
| 78 | 78 |
| 79 // Fills deep profile dump into |raw_buffer| of |buffer_size|, and return the | 79 // Fills deep profile dump into |raw_buffer| of |buffer_size|, and return the |
| 80 // actual size occupied by the dump in |raw_buffer|. It works as an | 80 // actual size occupied by the dump in |raw_buffer|. It works as an |
| 81 // alternative of HeapProfileTable::FillOrderedProfile. |raw_buffer| is not | 81 // alternative of HeapProfileTable::FillOrderedProfile. |raw_buffer| is not |
| 82 // terminated by zero. | 82 // terminated by zero. |
| 83 // | 83 // |
| 84 // In addition, a list of buckets is dumped into a ".buckets" file in | 84 // In addition, a list of buckets is dumped into a ".buckets" file in |
| 85 // descending order of allocated bytes. | 85 // descending order of allocated bytes. |
| 86 int FillOrderedProfile(char raw_buffer[], int buffer_size); | 86 int FillOrderedProfile(const char* reason, |
| 87 char raw_buffer[], |
| 88 int buffer_size); |
| 87 | 89 |
| 88 private: | 90 private: |
| 89 #ifdef USE_DEEP_HEAP_PROFILE | 91 #ifdef USE_DEEP_HEAP_PROFILE |
| 90 typedef HeapProfileTable::Stats Stats; | 92 typedef HeapProfileTable::Stats Stats; |
| 91 typedef HeapProfileTable::Bucket Bucket; | 93 typedef HeapProfileTable::Bucket Bucket; |
| 92 typedef HeapProfileTable::AllocValue AllocValue; | 94 typedef HeapProfileTable::AllocValue AllocValue; |
| 93 typedef HeapProfileTable::AllocationMap AllocationMap; | 95 typedef HeapProfileTable::AllocationMap AllocationMap; |
| 94 | 96 |
| 95 enum MapsRegionType { | 97 enum MapsRegionType { |
| 96 // Bytes of memory which were not recognized with /proc/<pid>/maps. | 98 // Bytes of memory which were not recognized with /proc/<pid>/maps. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 127 : buffer_(raw_buffer), | 129 : buffer_(raw_buffer), |
| 128 size_(size), | 130 size_(size), |
| 129 cursor_(0) { | 131 cursor_(0) { |
| 130 } | 132 } |
| 131 | 133 |
| 132 int Size(); | 134 int Size(); |
| 133 int FilledBytes(); | 135 int FilledBytes(); |
| 134 void Clear(); | 136 void Clear(); |
| 135 void Write(RawFD fd); | 137 void Write(RawFD fd); |
| 136 | 138 |
| 137 bool AppendChar(char v); | 139 bool AppendChar(char value); |
| 138 bool AppendString(const char* v, int d); | 140 bool AppendString(const char* value, int width); |
| 139 bool AppendInt(int v, int d, bool leading_zero); | 141 bool AppendInt(int value, int width, bool leading_zero); |
| 140 bool AppendLong(long v, int d); | 142 bool AppendLong(long value, int width); |
| 141 bool AppendUnsignedLong(unsigned long v, int d); | 143 bool AppendUnsignedLong(unsigned long value, int width); |
| 142 bool AppendInt64(int64 v, int d); | 144 bool AppendInt64(int64 value, int width); |
| 143 bool AppendPtr(uint64 v, int d); | 145 bool AppendPtr(uint64 value, int width); |
| 144 | 146 |
| 145 private: | 147 private: |
| 146 bool ForwardCursor(int appended); | 148 bool ForwardCursor(int appended); |
| 147 | 149 |
| 148 char *buffer_; | 150 char *buffer_; |
| 149 int size_; | 151 int size_; |
| 150 int cursor_; | 152 int cursor_; |
| 151 DISALLOW_COPY_AND_ASSIGN(TextBuffer); | 153 DISALLOW_COPY_AND_ASSIGN(TextBuffer); |
| 152 }; | 154 }; |
| 153 | 155 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 311 |
| 310 DeepBucketTable deep_table_; | 312 DeepBucketTable deep_table_; |
| 311 #endif // USE_DEEP_HEAP_PROFILE | 313 #endif // USE_DEEP_HEAP_PROFILE |
| 312 | 314 |
| 313 HeapProfileTable* heap_profile_; | 315 HeapProfileTable* heap_profile_; |
| 314 | 316 |
| 315 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); | 317 DISALLOW_COPY_AND_ASSIGN(DeepHeapProfile); |
| 316 }; | 318 }; |
| 317 | 319 |
| 318 #endif // BASE_DEEP_HEAP_PROFILE_H_ | 320 #endif // BASE_DEEP_HEAP_PROFILE_H_ |
| OLD | NEW |