Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66e06d4f authored by John Reck's avatar John Reck
Browse files

Macrobenchmark tweaks & gpu memory dumping

Add support for glob matching
Ensure glob matches are alphabetically sorted
Add feature to dump GPU memory usage after a test pass
Adjust gpu memory dump to be a bit more compact (skip empty outputs)

Test: this
Bug: 187718492
Change-Id: I6dc80b2d3379d8d10001116e1240727d9914bc10
parent 3a8ea872
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -126,6 +126,12 @@ void SkiaMemoryTracer::dumpNumericValue(const char* dumpName, const char* valueN
    mCurrentValues.insert({valueName, {units, value}});
}

bool SkiaMemoryTracer::hasOutput() {
    // process any remaining elements
    processElement();
    return mResults.size() > 0;
}

void SkiaMemoryTracer::logOutput(String8& log) {
    // process any remaining elements
    processElement();
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public:
    SkiaMemoryTracer(const char* categoryKey, bool itemizeType);
    ~SkiaMemoryTracer() override {}

    bool hasOutput();
    void logOutput(String8& log);
    void logTotals(String8& log);

+10 −11
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ void CacheManager::dumpMemoryUsage(String8& log, const RenderState* renderState)
    log.appendFormat("  Size: %.2f kB \n", SkGraphics::GetFontCacheUsed() / 1024.0f);
    log.appendFormat("  Glyph Count: %d \n", SkGraphics::GetFontCacheCountUsed());

    log.appendFormat("CPU Caches:\n");
    std::vector<skiapipeline::ResourcePair> cpuResourceMap = {
            {"skia/sk_resource_cache/bitmap_", "Bitmaps"},
            {"skia/sk_resource_cache/rrect-blur_", "Masks"},
@@ -149,20 +148,20 @@ void CacheManager::dumpMemoryUsage(String8& log, const RenderState* renderState)
    };
    skiapipeline::SkiaMemoryTracer cpuTracer(cpuResourceMap, false);
    SkGraphics::DumpMemoryStatistics(&cpuTracer);
    if (cpuTracer.hasOutput()) {
        log.appendFormat("CPU Caches:\n");
        cpuTracer.logOutput(log);
    }

    log.appendFormat("GPU Caches:\n");
    skiapipeline::SkiaMemoryTracer gpuTracer("category", true);
    mGrContext->dumpMemoryStatistics(&gpuTracer);
    if (gpuTracer.hasOutput()) {
        log.appendFormat("GPU Caches:\n");
        gpuTracer.logOutput(log);
    }

    log.appendFormat("Other Caches:\n");
    log.appendFormat("                         Current / Maximum\n");

    if (renderState) {
        if (renderState->mActiveLayers.size() > 0) {
    if (renderState && renderState->mActiveLayers.size() > 0) {
        log.appendFormat("Layer Info:\n");
        }

        const char* layerType = Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL
                                        ? "GlLayer"
+2 −2
Original line number Diff line number Diff line
@@ -249,10 +249,10 @@ uint32_t RenderProxy::frameTimePercentile(int percentile) {
    });
}

void RenderProxy::dumpGraphicsMemory(int fd) {
void RenderProxy::dumpGraphicsMemory(int fd, bool includeProfileData) {
    if (RenderThread::hasInstance()) {
        auto& thread = RenderThread::getInstance();
        thread.queue().runSync([&]() { thread.dumpGraphicsMemory(fd); });
        thread.queue().runSync([&]() { thread.dumpGraphicsMemory(fd, includeProfileData); });
    }
}

+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public:
    // Not exported, only used for testing
    void resetProfileInfo();
    uint32_t frameTimePercentile(int p);
    static void dumpGraphicsMemory(int fd);
    static void dumpGraphicsMemory(int fd, bool includeProfileData = true);

    static void rotateProcessStatsBuffer();
    static void setProcessStatsBuffer(int fd);
Loading