OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 EnumerationHistogram, commitedSizeHistogram, | 518 EnumerationHistogram, commitedSizeHistogram, |
519 new EnumerationHistogram("BlinkGC.CommittedSize", | 519 new EnumerationHistogram("BlinkGC.CommittedSize", |
520 supportedMaxSizeInMB)); | 520 supportedMaxSizeInMB)); |
521 commitedSizeHistogram.count(sizeInMB); | 521 commitedSizeHistogram.count(sizeInMB); |
522 observedMaxSizeInMB = sizeInMB; | 522 observedMaxSizeInMB = sizeInMB; |
523 } | 523 } |
524 } | 524 } |
525 | 525 |
526 void ThreadHeap::reportMemoryUsageForTracing() { | 526 void ThreadHeap::reportMemoryUsageForTracing() { |
527 #if PRINT_HEAP_STATS | 527 #if PRINT_HEAP_STATS |
528 // dataLogF("allocatedSpace=%ldMB, allocatedObjectSize=%ldMB, markedObjectSize=%
ldMB, partitionAllocSize=%ldMB, wrapperCount=%ld, collectedWrapperCount=%ld\n",
ThreadHeap::allocatedSpace() / 1024 / 1024, ThreadHeap::allocatedObjectSize() /
1024 / 1024, ThreadHeap::markedObjectSize() / 1024 / 1024, WTF::Partitions::tota
lSizeOfCommittedPages() / 1024 / 1024, ThreadHeap::wrapperCount(), ThreadHeap::c
ollectedWrapperCount()); | 528 // dataLogF("allocatedSpace=%ldMB, allocatedObjectSize=%ldMB, " |
| 529 // "markedObjectSize=%ldMB, partitionAllocSize=%ldMB, " |
| 530 // "wrapperCount=%ld, collectedWrapperCount=%ld\n", |
| 531 // ThreadHeap::allocatedSpace() / 1024 / 1024, |
| 532 // ThreadHeap::allocatedObjectSize() / 1024 / 1024, |
| 533 // ThreadHeap::markedObjectSize() / 1024 / 1024, |
| 534 // WTF::Partitions::totalSizeOfCommittedPages() / 1024 / 1024, |
| 535 // ThreadHeap::wrapperCount(), ThreadHeap::collectedWrapperCount()); |
529 #endif | 536 #endif |
530 | 537 |
531 bool gcTracingEnabled; | 538 bool gcTracingEnabled; |
532 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink_gc"), | 539 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink_gc"), |
533 &gcTracingEnabled); | 540 &gcTracingEnabled); |
534 if (!gcTracingEnabled) | 541 if (!gcTracingEnabled) |
535 return; | 542 return; |
536 | 543 |
537 ThreadHeap& heap = ThreadState::current()->heap(); | 544 ThreadHeap& heap = ThreadState::current()->heap(); |
538 // These values are divided by 1024 to avoid overflow in practical cases (TRAC
E_COUNTER values are 32-bit ints). | 545 // These values are divided by 1024 to avoid overflow in practical cases |
| 546 // (TRACE_COUNTER values are 32-bit ints). |
539 // They are capped to INT_MAX just in case. | 547 // They are capped to INT_MAX just in case. |
540 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), | 548 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), |
541 "ThreadHeap::allocatedObjectSizeKB", | 549 "ThreadHeap::allocatedObjectSizeKB", |
542 std::min(heap.heapStats().allocatedObjectSize() / 1024, | 550 std::min(heap.heapStats().allocatedObjectSize() / 1024, |
543 static_cast<size_t>(INT_MAX))); | 551 static_cast<size_t>(INT_MAX))); |
544 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), | 552 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("blink_gc"), |
545 "ThreadHeap::markedObjectSizeKB", | 553 "ThreadHeap::markedObjectSizeKB", |
546 std::min(heap.heapStats().markedObjectSize() / 1024, | 554 std::min(heap.heapStats().markedObjectSize() / 1024, |
547 static_cast<size_t>(INT_MAX))); | 555 static_cast<size_t>(INT_MAX))); |
548 TRACE_COUNTER1( | 556 TRACE_COUNTER1( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 649 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
642 | 650 |
643 m_stats.reset(); | 651 m_stats.reset(); |
644 for (ThreadState* state : m_threads) | 652 for (ThreadState* state : m_threads) |
645 state->resetHeapCounters(); | 653 state->resetHeapCounters(); |
646 } | 654 } |
647 | 655 |
648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 656 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
649 | 657 |
650 } // namespace blink | 658 } // namespace blink |
OLD | NEW |