Changeset 208607 in webkit
- Timestamp:
- Nov 11, 2016, 1:50:11 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r208606 r208607 1 2016-11-11 Keith Rollin <krollin@apple.com> 2 3 Reduce number of platformMemoryUsage calls 4 https://bugs.webkit.org/show_bug.cgi?id=164375 5 6 Reviewed by Andreas Kling. 7 8 platformMemoryUsage was being called all the time while logging the 9 results of various memory-purging operations. This logging is 10 subordinate to the needs of performance and so can be removed. 11 Behavior is now as follows: 12 13 - If memory-pressure relief logging is enabled, logging includes 14 memory usage information. On Cocoa, this logging is disabled by 15 default but can be enabled by setting LogMemoryJetsamDetails in 16 `defaults`. 17 - Otherwise, if release-logging is enabled (as it is on Cocoa), 18 abbreviated memory pressure relief logging is performed: the logging 19 lines are printed but without any memory usage information. 20 - Otherwise, no logging is performed. 21 22 No new tests -- no tests for logging. 23 24 * platform/MemoryPressureHandler.cpp: 25 (WebCore::MemoryPressureHandler::ReliefLogger::logMemoryUsageChange): 26 * platform/MemoryPressureHandler.h: 27 (WebCore::MemoryPressureHandler::ReliefLogger::ReliefLogger): 28 (WebCore::MemoryPressureHandler::ReliefLogger::~ReliefLogger): 29 1 30 2016-11-11 Eric Carlson <eric.carlson@apple.com> 2 31 -
trunk/Source/WebCore/platform/MemoryPressureHandler.cpp
r208534 r208607 76 76 #endif 77 77 78 size_t currentMemory = platformMemoryUsage(); 79 if (currentMemory == static_cast<size_t>(-1) || m_initialMemory == static_cast<size_t>(-1)) { 80 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": (Unable to get dirty memory information for process)", m_logString); 81 return; 78 if (s_loggingEnabled) { 79 size_t currentMemory = platformMemoryUsage(); 80 if (currentMemory == static_cast<size_t>(-1) || m_initialMemory == static_cast<size_t>(-1)) { 81 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": (Unable to get dirty memory information for process)", m_logString); 82 return; 83 } 84 85 long memoryDiff = currentMemory - m_initialMemory; 86 if (memoryDiff < 0) 87 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": -dirty %ld bytes (from %zu to %zu)", m_logString, (memoryDiff * -1), m_initialMemory, currentMemory); 88 else if (memoryDiff > 0) 89 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": +dirty %ld bytes (from %zu to %zu)", m_logString, memoryDiff, m_initialMemory, currentMemory); 90 else 91 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": =dirty (at %zu bytes)", m_logString, currentMemory); 92 #if !RELEASE_LOG_DISABLED 93 } else { 94 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION, m_logString); 95 #endif 82 96 } 83 84 long memoryDiff = currentMemory - m_initialMemory;85 if (memoryDiff < 0)86 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": -dirty %ld bytes (from %zu to %zu)", m_logString, (memoryDiff * -1), m_initialMemory, currentMemory);87 else if (memoryDiff > 0)88 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": +dirty %ld bytes (from %zu to %zu)", m_logString, memoryDiff, m_initialMemory, currentMemory);89 else90 MEMORYPRESSURE_LOG("Memory pressure relief: " STRING_SPECIFICATION ": =dirty (at %zu bytes)", m_logString, currentMemory);91 97 } 92 98 -
trunk/Source/WebCore/platform/MemoryPressureHandler.h
r208534 r208607 92 92 explicit ReliefLogger(const char *log) 93 93 : m_logString(log) 94 #if !RELEASE_LOG_DISABLED95 , m_initialMemory(platformMemoryUsage())96 #else97 94 , m_initialMemory(s_loggingEnabled ? platformMemoryUsage() : 0) 98 #endif99 95 { 100 96 } … … 102 98 ~ReliefLogger() 103 99 { 104 #if !RELEASE_LOG_DISABLED105 100 logMemoryUsageChange(); 106 #else107 if (s_loggingEnabled)108 logMemoryUsageChange();109 #endif110 101 } 111 102
Note:
See TracChangeset
for help on using the changeset viewer.