| 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 #if PRINT_HEAP_STATS | 453 #if PRINT_HEAP_STATS |
| 454 dataLogF("Heap::collectGarbage (gcReason=%s, lazySweeping=%d, time=%.1lfms)\
n", gcReasonString(reason), gcType == BlinkGC::GCWithoutSweep, markingTimeInMill
iseconds); | 454 dataLogF("Heap::collectGarbage (gcReason=%s, lazySweeping=%d, time=%.1lfms)\
n", gcReasonString(reason), gcType == BlinkGC::GCWithoutSweep, markingTimeInMill
iseconds); |
| 455 #endif | 455 #endif |
| 456 | 456 |
| 457 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, markingTimeHistogram,
new CustomCountHistogram("BlinkGC.CollectGarbage", 0, 10 * 1000, 50)); | 457 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, markingTimeHistogram,
new CustomCountHistogram("BlinkGC.CollectGarbage", 0, 10 * 1000, 50)); |
| 458 markingTimeHistogram.count(markingTimeInMilliseconds); | 458 markingTimeHistogram.count(markingTimeInMilliseconds); |
| 459 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalObjectSpaceHistog
ram, new CustomCountHistogram("BlinkGC.TotalObjectSpace", 0, 4 * 1024 * 1024, 50
)); | 459 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalObjectSpaceHistog
ram, new CustomCountHistogram("BlinkGC.TotalObjectSpace", 0, 4 * 1024 * 1024, 50
)); |
| 460 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024); | 460 totalObjectSpaceHistogram.count(Heap::allocatedObjectSize() / 1024); |
| 461 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis
togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10
24, 50)); | 461 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, totalAllocatedSpaceHis
togram, new CustomCountHistogram("BlinkGC.TotalAllocatedSpace", 0, 4 * 1024 * 10
24, 50)); |
| 462 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024); | 462 totalAllocatedSpaceHistogram.count(Heap::allocatedSpace() / 1024); |
| 463 Platform::current()->histogramEnumeration("BlinkGC.GCReason", reason, BlinkG
C::NumberOfGCReason); | 463 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, gcReasonHistogram, new
EnumerationHistogram("BlinkGC.GCReason", BlinkGC::NumberOfGCReason)); |
| 464 gcReasonHistogram.count(reason); |
| 465 |
| 464 Heap::reportMemoryUsageHistogram(); | 466 Heap::reportMemoryUsageHistogram(); |
| 465 WTF::Partitions::reportMemoryUsageHistogram(); | 467 WTF::Partitions::reportMemoryUsageHistogram(); |
| 466 | 468 |
| 467 postGC(gcType); | 469 postGC(gcType); |
| 468 | 470 |
| 469 #if ENABLE(ASSERT) | 471 #if ENABLE(ASSERT) |
| 470 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio
n. | 472 // 0 is used to figure non-assigned area, so avoid to use 0 in s_gcGeneratio
n. |
| 471 if (++s_gcGeneration == 0) { | 473 if (++s_gcGeneration == 0) { |
| 472 s_gcGeneration = 1; | 474 s_gcGeneration = 1; |
| 473 } | 475 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // We only report the memory in the main thread. | 606 // We only report the memory in the main thread. |
| 605 if (!isMainThread()) | 607 if (!isMainThread()) |
| 606 return; | 608 return; |
| 607 // +1 is for rounding up the sizeInMB. | 609 // +1 is for rounding up the sizeInMB. |
| 608 size_t sizeInMB = Heap::allocatedSpace() / 1024 / 1024 + 1; | 610 size_t sizeInMB = Heap::allocatedSpace() / 1024 / 1024 + 1; |
| 609 if (sizeInMB >= supportedMaxSizeInMB) | 611 if (sizeInMB >= supportedMaxSizeInMB) |
| 610 sizeInMB = supportedMaxSizeInMB - 1; | 612 sizeInMB = supportedMaxSizeInMB - 1; |
| 611 if (sizeInMB > observedMaxSizeInMB) { | 613 if (sizeInMB > observedMaxSizeInMB) { |
| 612 // Send a UseCounter only when we see the highest memory usage | 614 // Send a UseCounter only when we see the highest memory usage |
| 613 // we've ever seen. | 615 // we've ever seen. |
| 614 Platform::current()->histogramEnumeration("BlinkGC.CommittedSize", sizeI
nMB, supportedMaxSizeInMB); | 616 DEFINE_THREAD_SAFE_STATIC_LOCAL(EnumerationHistogram, commitedSizeHistog
ram, new EnumerationHistogram("BlinkGC.CommittedSize", supportedMaxSizeInMB)); |
| 617 commitedSizeHistogram.count(sizeInMB); |
| 615 observedMaxSizeInMB = sizeInMB; | 618 observedMaxSizeInMB = sizeInMB; |
| 616 } | 619 } |
| 617 } | 620 } |
| 618 | 621 |
| 619 void Heap::reportMemoryUsageForTracing() | 622 void Heap::reportMemoryUsageForTracing() |
| 620 { | 623 { |
| 621 #if PRINT_HEAP_STATS | 624 #if PRINT_HEAP_STATS |
| 622 // dataLogF("allocatedSpace=%ldMB, allocatedObjectSize=%ldMB, markedObjectSi
ze=%ldMB, partitionAllocSize=%ldMB, wrapperCount=%ld, collectedWrapperCount=%ld\
n", Heap::allocatedSpace() / 1024 / 1024, Heap::allocatedObjectSize() / 1024 / 1
024, Heap::markedObjectSize() / 1024 / 1024, WTF::Partitions::totalSizeOfCommitt
edPages() / 1024 / 1024, Heap::wrapperCount(), Heap::collectedWrapperCount()); | 625 // dataLogF("allocatedSpace=%ldMB, allocatedObjectSize=%ldMB, markedObjectSi
ze=%ldMB, partitionAllocSize=%ldMB, wrapperCount=%ld, collectedWrapperCount=%ld\
n", Heap::allocatedSpace() / 1024 / 1024, Heap::allocatedObjectSize() / 1024 / 1
024, Heap::markedObjectSize() / 1024 / 1024, WTF::Partitions::totalSizeOfCommitt
edPages() / 1024 / 1024, Heap::wrapperCount(), Heap::collectedWrapperCount()); |
| 623 #endif | 626 #endif |
| 624 | 627 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 size_t Heap::s_wrapperCount = 0; | 723 size_t Heap::s_wrapperCount = 0; |
| 721 size_t Heap::s_wrapperCountAtLastGC = 0; | 724 size_t Heap::s_wrapperCountAtLastGC = 0; |
| 722 size_t Heap::s_collectedWrapperCount = 0; | 725 size_t Heap::s_collectedWrapperCount = 0; |
| 723 size_t Heap::s_partitionAllocSizeAtLastGC = 0; | 726 size_t Heap::s_partitionAllocSizeAtLastGC = 0; |
| 724 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 727 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 725 #if ENABLE(ASSERT) | 728 #if ENABLE(ASSERT) |
| 726 uint16_t Heap::s_gcGeneration = 0; | 729 uint16_t Heap::s_gcGeneration = 0; |
| 727 #endif | 730 #endif |
| 728 | 731 |
| 729 } // namespace blink | 732 } // namespace blink |
| OLD | NEW |