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