Changeset 212043 in webkit
- Timestamp:
- Feb 9, 2017 9:26:08 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r212042 r212043 1 2017-02-09 Simon Fraser <simon.fraser@apple.com> 2 3 Improve IOSurfacePool logging 4 https://bugs.webkit.org/show_bug.cgi?id=168098 5 6 Reviewed by Tim Horton. 7 8 Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the 9 logging. 10 11 * platform/graphics/cg/IOSurfacePool.cpp: 12 (WebCore::IOSurfacePool::takeSurface): 13 (WebCore::IOSurfacePool::addSurface): 14 (WebCore::IOSurfacePool::evict): 15 (WebCore::IOSurfacePool::collectionTimerFired): 16 (WebCore::IOSurfacePool::showPoolStatistics): 17 * platform/graphics/cg/IOSurfacePool.h: 18 1 19 2017-02-09 Alex Christensen <achristensen@webkit.org> 2 20 -
trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp
r202927 r212043 42 42 const size_t maximumInUseBytes = defaultMaximumBytesCached / 2; 43 43 44 #define ENABLE_IOSURFACE_POOL_STATISTICS false44 #define ENABLE_IOSURFACE_POOL_STATISTICS 0 45 45 #if ENABLE_IOSURFACE_POOL_STATISTICS 46 #define DUMP_POOL_STATISTICS( ) do { showPoolStatistics(); } while (0);46 #define DUMP_POOL_STATISTICS(reason) do { showPoolStatistics(reason); } while (0); 47 47 #else 48 #define DUMP_POOL_STATISTICS( ) ((void)0)48 #define DUMP_POOL_STATISTICS(reason) ((void)0) 49 49 #endif 50 50 … … 113 113 114 114 if (mapIter == m_cachedSurfaces.end()) { 115 DUMP_POOL_STATISTICS( );115 DUMP_POOL_STATISTICS("takeSurface - none with matching size"); 116 116 return nullptr; 117 117 } … … 135 135 surface->setIsVolatile(false); 136 136 137 DUMP_POOL_STATISTICS( );137 DUMP_POOL_STATISTICS("takeSurface - taking"); 138 138 return surface; 139 139 } … … 152 152 surface->setIsVolatile(false); 153 153 154 DUMP_POOL_STATISTICS( );154 DUMP_POOL_STATISTICS("takeSurface - taking in-use"); 155 155 return surface; 156 156 } 157 157 158 DUMP_POOL_STATISTICS( );158 DUMP_POOL_STATISTICS("takeSurface - failing"); 159 159 return nullptr; 160 160 } … … 185 185 m_inUseSurfaces.prepend(WTFMove(surface)); 186 186 scheduleCollectionTimer(); 187 DUMP_POOL_STATISTICS( );187 DUMP_POOL_STATISTICS("addSurface - in-use"); 188 188 return; 189 189 } 190 190 191 191 insertSurfaceIntoPool(WTFMove(surface)); 192 DUMP_POOL_STATISTICS( );192 DUMP_POOL_STATISTICS("addSurface"); 193 193 } 194 194 … … 241 241 void IOSurfacePool::evict(size_t additionalSize) 242 242 { 243 DUMP_POOL_STATISTICS("before evict"); 244 243 245 if (additionalSize >= m_maximumBytesCached) { 244 246 discardAllSurfaces(); 247 DUMP_POOL_STATISTICS("after evict all"); 245 248 return; 246 249 } … … 262 265 while (m_inUseBytesCached > maximumInUseBytes || m_bytesCached > targetSize) 263 266 tryEvictInUseSurface(); 267 268 DUMP_POOL_STATISTICS("after evict"); 264 269 } 265 270 … … 311 316 312 317 platformGarbageCollectNow(); 313 DUMP_POOL_STATISTICS( );318 DUMP_POOL_STATISTICS("collectionTimerFired"); 314 319 } 315 320 … … 332 337 } 333 338 334 void IOSurfacePool::showPoolStatistics( )339 void IOSurfacePool::showPoolStatistics(const char* reason) 335 340 { 336 341 #if ENABLE_IOSURFACE_POOL_STATISTICS 337 WTFLogAlways("IOSurfacePool Statistics \n");342 WTFLogAlways("IOSurfacePool Statistics: %s\n", reason); 338 343 unsigned totalSurfaces = 0; 339 344 size_t totalSize = 0; … … 357 362 totalPurgeableSize += queuePurgeableSize; 358 363 359 WTFLogAlways(" %d x %d: %zu surfaces for % zd KB (%zd KB purgeable)", keyAndSurfaces.key.width(), keyAndSurfaces.key.height(), keyAndSurfaces.value.size(), queueSize / 1024, queuePurgeableSize / 1024);364 WTFLogAlways(" %d x %d: %zu surfaces for %.2f MB (%.2f MB purgeable)", keyAndSurfaces.key.width(), keyAndSurfaces.key.height(), keyAndSurfaces.value.size(), queueSize / (1024.0 * 1024.0), queuePurgeableSize / (1024.0 * 1024.0)); 360 365 } 361 366 … … 367 372 368 373 totalSize += inUseSize; 369 WTFLogAlways(" IN USE: %zu surfaces for % zd KB", m_inUseSurfaces.size(), inUseSize / 1024);374 WTFLogAlways(" IN USE: %zu surfaces for %.2f MB", m_inUseSurfaces.size(), inUseSize / (1024.0 * 1024.0)); 370 375 371 376 // FIXME: Should move consistency checks elsewhere, and always perform them in debug builds. … … 373 378 ASSERT(m_bytesCached <= m_maximumBytesCached); 374 379 375 WTFLogAlways(" TOTAL: %d surfaces for %zd KB (%zd KB purgeable)\n", totalSurfaces, totalSize / 1024, totalPurgeableSize / 1024); 380 WTFLogAlways(" TOTAL: %d surfaces for %.2f MB (%.2f MB purgeable)\n", totalSurfaces, totalSize / (1024.0 * 1024.0), totalPurgeableSize / (1024.0 * 1024.0)); 381 #else 382 UNUSED_PARAM(reason); 376 383 #endif 377 384 } -
trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h
r204466 r212043 54 54 WEBCORE_EXPORT void setPoolSize(size_t); 55 55 56 void showPoolStatistics();57 58 56 private: 59 57 IOSurfacePool(); … … 93 91 void platformGarbageCollectNow(); 94 92 93 void showPoolStatistics(const char*); 94 95 95 Timer m_collectionTimer; 96 96 CachedSurfaceMap m_cachedSurfaces;
Note: See TracChangeset
for help on using the changeset viewer.