| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 #ifndef V8_HEAP_OBJECT_STATS_H_ | 5 #ifndef V8_HEAP_OBJECT_STATS_H_ |
| 6 #define V8_HEAP_OBJECT_STATS_H_ | 6 #define V8_HEAP_OBJECT_STATS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, | 28 FIRST_CODE_KIND_SUB_TYPE + Code::NUMBER_OF_KINDS, |
| 29 FIRST_CODE_AGE_SUB_TYPE = | 29 FIRST_CODE_AGE_SUB_TYPE = |
| 30 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, | 30 FIRST_FIXED_ARRAY_SUB_TYPE + LAST_FIXED_ARRAY_SUB_TYPE + 1, |
| 31 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 | 31 OBJECT_STATS_COUNT = FIRST_CODE_AGE_SUB_TYPE + Code::kCodeAgeCount + 1 |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 void ClearObjectStats(bool clear_last_time_stats = false); | 34 void ClearObjectStats(bool clear_last_time_stats = false); |
| 35 | 35 |
| 36 void CheckpointObjectStats(); | 36 void CheckpointObjectStats(); |
| 37 void PrintJSON(const char* key); | 37 void PrintJSON(const char* key); |
| 38 void Dump(std::stringstream& stream); |
| 38 | 39 |
| 39 void RecordObjectStats(InstanceType type, size_t size) { | 40 void RecordObjectStats(InstanceType type, size_t size) { |
| 40 DCHECK(type <= LAST_TYPE); | 41 DCHECK(type <= LAST_TYPE); |
| 41 object_counts_[type]++; | 42 object_counts_[type]++; |
| 42 object_sizes_[type] += size; | 43 object_sizes_[type] += size; |
| 43 size_histogram_[type][HistogramIndexFromSize(size)]++; | 44 size_histogram_[type][HistogramIndexFromSize(size)]++; |
| 44 } | 45 } |
| 45 | 46 |
| 46 void RecordCodeSubTypeStats(int code_sub_type, int code_age, size_t size) { | 47 void RecordCodeSubTypeStats(int code_sub_type, int code_age, size_t size) { |
| 47 int code_sub_type_index = FIRST_CODE_KIND_SUB_TYPE + code_sub_type; | 48 int code_sub_type_index = FIRST_CODE_KIND_SUB_TYPE + code_sub_type; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 Heap* heap_; | 151 Heap* heap_; |
| 151 ObjectStats* stats_; | 152 ObjectStats* stats_; |
| 152 | 153 |
| 153 friend class ObjectStatsCollector::CompilationCacheTableVisitor; | 154 friend class ObjectStatsCollector::CompilationCacheTableVisitor; |
| 154 }; | 155 }; |
| 155 | 156 |
| 156 } // namespace internal | 157 } // namespace internal |
| 157 } // namespace v8 | 158 } // namespace v8 |
| 158 | 159 |
| 159 #endif // V8_HEAP_OBJECT_STATS_H_ | 160 #endif // V8_HEAP_OBJECT_STATS_H_ |
| OLD | NEW |