Changeset 212043 in webkit


Ignore:
Timestamp:
Feb 9, 2017 9:26:08 PM (7 years ago)
Author:
Simon Fraser
Message:

Improve IOSurfacePool logging
https://bugs.webkit.org/show_bug.cgi?id=168098

Reviewed by Tim Horton.

Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
logging.

  • platform/graphics/cg/IOSurfacePool.cpp:

(WebCore::IOSurfacePool::takeSurface):
(WebCore::IOSurfacePool::addSurface):
(WebCore::IOSurfacePool::evict):
(WebCore::IOSurfacePool::collectionTimerFired):
(WebCore::IOSurfacePool::showPoolStatistics):

  • platform/graphics/cg/IOSurfacePool.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r212042 r212043  
     12017-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
    1192017-02-09  Alex Christensen  <achristensen@webkit.org>
    220
  • trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp

    r202927 r212043  
    4242const size_t maximumInUseBytes = defaultMaximumBytesCached / 2;
    4343
    44 #define ENABLE_IOSURFACE_POOL_STATISTICS false
     44#define ENABLE_IOSURFACE_POOL_STATISTICS 0
    4545#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);
    4747#else
    48 #define DUMP_POOL_STATISTICS() ((void)0)
     48#define DUMP_POOL_STATISTICS(reason) ((void)0)
    4949#endif
    5050
     
    113113
    114114    if (mapIter == m_cachedSurfaces.end()) {
    115         DUMP_POOL_STATISTICS();
     115        DUMP_POOL_STATISTICS("takeSurface - none with matching size");
    116116        return nullptr;
    117117    }
     
    135135        surface->setIsVolatile(false);
    136136
    137         DUMP_POOL_STATISTICS();
     137        DUMP_POOL_STATISTICS("takeSurface - taking");
    138138        return surface;
    139139    }
     
    152152        surface->setIsVolatile(false);
    153153
    154         DUMP_POOL_STATISTICS();
     154        DUMP_POOL_STATISTICS("takeSurface - taking in-use");
    155155        return surface;
    156156    }
    157157
    158     DUMP_POOL_STATISTICS();
     158    DUMP_POOL_STATISTICS("takeSurface - failing");
    159159    return nullptr;
    160160}
     
    185185        m_inUseSurfaces.prepend(WTFMove(surface));
    186186        scheduleCollectionTimer();
    187         DUMP_POOL_STATISTICS();
     187        DUMP_POOL_STATISTICS("addSurface - in-use");
    188188        return;
    189189    }
    190190
    191191    insertSurfaceIntoPool(WTFMove(surface));
    192     DUMP_POOL_STATISTICS();
     192    DUMP_POOL_STATISTICS("addSurface");
    193193}
    194194
     
    241241void IOSurfacePool::evict(size_t additionalSize)
    242242{
     243    DUMP_POOL_STATISTICS("before evict");
     244
    243245    if (additionalSize >= m_maximumBytesCached) {
    244246        discardAllSurfaces();
     247        DUMP_POOL_STATISTICS("after evict all");
    245248        return;
    246249    }
     
    262265    while (m_inUseBytesCached > maximumInUseBytes || m_bytesCached > targetSize)
    263266        tryEvictInUseSurface();
     267
     268    DUMP_POOL_STATISTICS("after evict");
    264269}
    265270
     
    311316
    312317    platformGarbageCollectNow();
    313     DUMP_POOL_STATISTICS();
     318    DUMP_POOL_STATISTICS("collectionTimerFired");
    314319}
    315320
     
    332337}
    333338
    334 void IOSurfacePool::showPoolStatistics()
     339void IOSurfacePool::showPoolStatistics(const char* reason)
    335340{
    336341#if ENABLE_IOSURFACE_POOL_STATISTICS
    337     WTFLogAlways("IOSurfacePool Statistics\n");
     342    WTFLogAlways("IOSurfacePool Statistics: %s\n", reason);
    338343    unsigned totalSurfaces = 0;
    339344    size_t totalSize = 0;
     
    357362        totalPurgeableSize += queuePurgeableSize;
    358363
    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));
    360365    }
    361366
     
    367372
    368373    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));
    370375
    371376    // FIXME: Should move consistency checks elsewhere, and always perform them in debug builds.
     
    373378    ASSERT(m_bytesCached <= m_maximumBytesCached);
    374379
    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);
    376383#endif
    377384}
  • trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.h

    r204466 r212043  
    5454    WEBCORE_EXPORT void setPoolSize(size_t);
    5555
    56     void showPoolStatistics();
    57 
    5856private:
    5957    IOSurfacePool();
     
    9391    void platformGarbageCollectNow();
    9492
     93    void showPoolStatistics(const char*);
     94
    9595    Timer m_collectionTimer;
    9696    CachedSurfaceMap m_cachedSurfaces;
Note: See TracChangeset for help on using the changeset viewer.