OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 #endif | 440 #endif |
441 | 441 |
442 isolate_->counters()->alive_after_last_gc()->Set( | 442 isolate_->counters()->alive_after_last_gc()->Set( |
443 static_cast<int>(SizeOfObjects())); | 443 static_cast<int>(SizeOfObjects())); |
444 | 444 |
445 isolate_->counters()->symbol_table_capacity()->Set( | 445 isolate_->counters()->symbol_table_capacity()->Set( |
446 symbol_table()->Capacity()); | 446 symbol_table()->Capacity()); |
447 isolate_->counters()->number_of_symbols()->Set( | 447 isolate_->counters()->number_of_symbols()->Set( |
448 symbol_table()->NumberOfElements()); | 448 symbol_table()->NumberOfElements()); |
449 | 449 |
| 450 if (isolate()->memory_allocator()->Size() > 0) { |
| 451 isolate_->counters()->external_fragmentation_total()->AddSample( |
| 452 static_cast<int>(100 - |
| 453 (SizeOfObjects() * 100) / isolate()->memory_allocator()->Size())); |
| 454 } |
| 455 |
450 #define UPDATE_COUNTERS_FOR_SPACE(space) \ | 456 #define UPDATE_COUNTERS_FOR_SPACE(space) \ |
451 isolate_->counters()->space##_bytes_available()->Set( \ | 457 isolate_->counters()->space##_bytes_available()->Set( \ |
452 static_cast<int>(space()->Available())); \ | 458 static_cast<int>(space()->Available())); \ |
453 isolate_->counters()->space##_bytes_committed()->Set( \ | 459 isolate_->counters()->space##_bytes_committed()->Set( \ |
454 static_cast<int>(space()->CommittedMemory())); \ | 460 static_cast<int>(space()->CommittedMemory())); \ |
455 isolate_->counters()->space##_bytes_used()->Set( \ | 461 isolate_->counters()->space##_bytes_used()->Set( \ |
456 static_cast<int>(space()->SizeOfObjects())); \ | 462 static_cast<int>(space()->SizeOfObjects())); |
| 463 #define UPDATE_FRAGMENTATION_FOR_SPACE(space) \ |
457 if (space()->CommittedMemory() > 0) { \ | 464 if (space()->CommittedMemory() > 0) { \ |
458 isolate_->counters()->external_fragmentation_##space()->AddSample( \ | 465 isolate_->counters()->external_fragmentation_##space()->AddSample( \ |
459 static_cast<int>( \ | 466 static_cast<int>(100 - \ |
460 (space()->SizeOfObjects() * 100) / space()->CommittedMemory())); \ | 467 (space()->SizeOfObjects() * 100) / space()->CommittedMemory())); \ |
461 } | 468 } |
| 469 #define UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(space) \ |
| 470 UPDATE_COUNTERS_FOR_SPACE(space) \ |
| 471 UPDATE_FRAGMENTATION_FOR_SPACE(space) |
| 472 |
462 UPDATE_COUNTERS_FOR_SPACE(new_space) | 473 UPDATE_COUNTERS_FOR_SPACE(new_space) |
463 UPDATE_COUNTERS_FOR_SPACE(old_pointer_space) | 474 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_pointer_space) |
464 UPDATE_COUNTERS_FOR_SPACE(old_data_space) | 475 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(old_data_space) |
465 UPDATE_COUNTERS_FOR_SPACE(code_space) | 476 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(code_space) |
466 UPDATE_COUNTERS_FOR_SPACE(map_space) | 477 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(map_space) |
467 UPDATE_COUNTERS_FOR_SPACE(cell_space) | 478 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(cell_space) |
468 UPDATE_COUNTERS_FOR_SPACE(lo_space) | 479 UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE(lo_space) |
469 #undef UPDATE_COUNTERS_FOR_SPACE | 480 #undef UPDATE_COUNTERS_FOR_SPACE |
| 481 #undef UPDATE_FRAGMENTATION_FOR_SPACE |
| 482 #undef UPDATE_COUNTERS_AND_FRAGMENTATION_FOR_SPACE |
470 | 483 |
471 #if defined(DEBUG) | 484 #if defined(DEBUG) |
472 ReportStatisticsAfterGC(); | 485 ReportStatisticsAfterGC(); |
473 #endif // DEBUG | 486 #endif // DEBUG |
474 #ifdef ENABLE_DEBUGGER_SUPPORT | 487 #ifdef ENABLE_DEBUGGER_SUPPORT |
475 isolate_->debug()->AfterGarbageCollection(); | 488 isolate_->debug()->AfterGarbageCollection(); |
476 #endif // ENABLE_DEBUGGER_SUPPORT | 489 #endif // ENABLE_DEBUGGER_SUPPORT |
477 } | 490 } |
478 | 491 |
479 | 492 |
(...skipping 6744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7224 INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7237 INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7225 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7238 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7226 memcpy(object_counts_last_time_, object_counts_, | 7239 memcpy(object_counts_last_time_, object_counts_, |
7227 sizeof(object_counts_)); | 7240 sizeof(object_counts_)); |
7228 memcpy(object_sizes_last_time_, object_sizes_, | 7241 memcpy(object_sizes_last_time_, object_sizes_, |
7229 sizeof(object_sizes_)); | 7242 sizeof(object_sizes_)); |
7230 ClearObjectStats(); | 7243 ClearObjectStats(); |
7231 } | 7244 } |
7232 | 7245 |
7233 } } // namespace v8::internal | 7246 } } // namespace v8::internal |
OLD | NEW |