| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 CHECK(heap_stats_addr); | 157 CHECK(heap_stats_addr); |
| 158 | 158 |
| 159 // Read heap stats. | 159 // Read heap stats. |
| 160 | 160 |
| 161 #define READ_FIELD(offset) \ | 161 #define READ_FIELD(offset) \ |
| 162 ReadPointedValue(memory_region, heap_stats_addr, offset) | 162 ReadPointedValue(memory_region, heap_stats_addr, offset) |
| 163 | 163 |
| 164 CHECK(READ_FIELD(0) == v8::internal::HeapStats::kStartMarker); | 164 CHECK(READ_FIELD(0) == v8::internal::HeapStats::kStartMarker); |
| 165 CHECK(READ_FIELD(23) == v8::internal::HeapStats::kEndMarker); | 165 CHECK(READ_FIELD(24) == v8::internal::HeapStats::kEndMarker); |
| 166 | 166 |
| 167 const int new_space_size = READ_FIELD(1); | 167 const int new_space_size = READ_FIELD(1); |
| 168 const int new_space_capacity = READ_FIELD(2); | 168 const int new_space_capacity = READ_FIELD(2); |
| 169 const int old_pointer_space_size = READ_FIELD(3); | 169 const int old_pointer_space_size = READ_FIELD(3); |
| 170 const int old_pointer_space_capacity = READ_FIELD(4); | 170 const int old_pointer_space_capacity = READ_FIELD(4); |
| 171 const int old_data_space_size = READ_FIELD(5); | 171 const int old_data_space_size = READ_FIELD(5); |
| 172 const int old_data_space_capacity = READ_FIELD(6); | 172 const int old_data_space_capacity = READ_FIELD(6); |
| 173 const int code_space_size = READ_FIELD(7); | 173 const int code_space_size = READ_FIELD(7); |
| 174 const int code_space_capacity = READ_FIELD(8); | 174 const int code_space_capacity = READ_FIELD(8); |
| 175 const int map_space_size = READ_FIELD(9); | 175 const int map_space_size = READ_FIELD(9); |
| 176 const int map_space_capacity = READ_FIELD(10); | 176 const int map_space_capacity = READ_FIELD(10); |
| 177 const int cell_space_size = READ_FIELD(11); | 177 const int cell_space_size = READ_FIELD(11); |
| 178 const int cell_space_capacity = READ_FIELD(12); | 178 const int cell_space_capacity = READ_FIELD(12); |
| 179 const int lo_space_size = READ_FIELD(13); | 179 const int lo_space_size = READ_FIELD(13); |
| 180 const int global_handle_count = READ_FIELD(14); | 180 const int global_handle_count = READ_FIELD(14); |
| 181 const int weak_global_handle_count = READ_FIELD(15); | 181 const int weak_global_handle_count = READ_FIELD(15); |
| 182 const int pending_global_handle_count = READ_FIELD(16); | 182 const int pending_global_handle_count = READ_FIELD(16); |
| 183 const int near_death_global_handle_count = READ_FIELD(17); | 183 const int near_death_global_handle_count = READ_FIELD(17); |
| 184 const int destroyed_global_handle_count = READ_FIELD(18); | 184 const int destroyed_global_handle_count = READ_FIELD(18); |
| 185 const int memory_allocator_size = READ_FIELD(19); | 185 const int memory_allocator_size = READ_FIELD(19); |
| 186 const int memory_allocator_capacity = READ_FIELD(20); | 186 const int memory_allocator_capacity = READ_FIELD(20); |
| 187 const int os_error = READ_FIELD(23); |
| 187 #undef READ_FIELD | 188 #undef READ_FIELD |
| 188 | 189 |
| 189 int objects_per_type[v8::internal::LAST_TYPE + 1] = {0}; | 190 int objects_per_type[v8::internal::LAST_TYPE + 1] = {0}; |
| 190 ReadArrayFrom(memory_region, heap_stats_addr, 21, | 191 ReadArrayFrom(memory_region, heap_stats_addr, 21, |
| 191 v8::internal::LAST_TYPE + 1, objects_per_type); | 192 v8::internal::LAST_TYPE + 1, objects_per_type); |
| 192 | 193 |
| 193 int size_per_type[v8::internal::LAST_TYPE + 1] = {0}; | 194 int size_per_type[v8::internal::LAST_TYPE + 1] = {0}; |
| 194 ReadArrayFrom(memory_region, heap_stats_addr, 22, v8::internal::LAST_TYPE + 1, | 195 ReadArrayFrom(memory_region, heap_stats_addr, 22, v8::internal::LAST_TYPE + 1, |
| 195 size_per_type); | 196 size_per_type); |
| 196 | 197 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 PRINT_MB_STAT(cell_space_size); | 237 PRINT_MB_STAT(cell_space_size); |
| 237 PRINT_MB_STAT(cell_space_capacity); | 238 PRINT_MB_STAT(cell_space_capacity); |
| 238 PRINT_MB_STAT(lo_space_size); | 239 PRINT_MB_STAT(lo_space_size); |
| 239 PRINT_INT_STAT(global_handle_count); | 240 PRINT_INT_STAT(global_handle_count); |
| 240 PRINT_INT_STAT(weak_global_handle_count); | 241 PRINT_INT_STAT(weak_global_handle_count); |
| 241 PRINT_INT_STAT(pending_global_handle_count); | 242 PRINT_INT_STAT(pending_global_handle_count); |
| 242 PRINT_INT_STAT(near_death_global_handle_count); | 243 PRINT_INT_STAT(near_death_global_handle_count); |
| 243 PRINT_INT_STAT(destroyed_global_handle_count); | 244 PRINT_INT_STAT(destroyed_global_handle_count); |
| 244 PRINT_MB_STAT(memory_allocator_size); | 245 PRINT_MB_STAT(memory_allocator_size); |
| 245 PRINT_MB_STAT(memory_allocator_capacity); | 246 PRINT_MB_STAT(memory_allocator_capacity); |
| 247 PRINT_INT_STAT(os_error); |
| 246 #undef PRINT_STAT | 248 #undef PRINT_STAT |
| 247 | 249 |
| 248 printf("\n"); | 250 printf("\n"); |
| 249 | 251 |
| 250 printf( | 252 printf( |
| 251 "\tJS_GLOBAL_OBJECT_TYPE/JS_BUILTINS_OBJECT_TYPE/JS_GLOBAL_PROXY_TYPE: " | 253 "\tJS_GLOBAL_OBJECT_TYPE/JS_BUILTINS_OBJECT_TYPE/JS_GLOBAL_PROXY_TYPE: " |
| 252 "%d/%d/%d\n\n", | 254 "%d/%d/%d\n\n", |
| 253 js_global_objects, js_builtins_objects, js_global_proxies); | 255 js_global_objects, js_builtins_objects, js_global_proxies); |
| 254 | 256 |
| 255 int running_size = 0; | 257 int running_size = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 277 int main(int argc, char **argv) { | 279 int main(int argc, char **argv) { |
| 278 if (argc != 2) { | 280 if (argc != 2) { |
| 279 fprintf(stderr, "usage: %s <minidump>\n", argv[0]); | 281 fprintf(stderr, "usage: %s <minidump>\n", argv[0]); |
| 280 return 1; | 282 return 1; |
| 281 } | 283 } |
| 282 | 284 |
| 283 DumpHeapStats(argv[1]); | 285 DumpHeapStats(argv[1]); |
| 284 | 286 |
| 285 return 0; | 287 return 0; |
| 286 } | 288 } |
| OLD | NEW |