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

Commit 5f1fa305 authored by Andy Hung's avatar Andy Hung
Browse files

AudioPolicyManager: Tally max effects memory usage

Bug: 27925014
Change-Id: I6d2596ed1b10ff193babeba7e6cbec36ee4fe074
parent 4d363d46
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -55,8 +55,9 @@ public:
private:
    status_t setEffectEnabled(const sp<EffectDescriptor> &effectDesc, bool enabled);

    uint32_t mTotalEffectsCpuLoad; // current CPU load used by effects
    uint32_t mTotalEffectsMemory;  // current memory used by effects
    uint32_t mTotalEffectsCpuLoad; // current CPU load used by effects (in MIPS)
    uint32_t mTotalEffectsMemory;  // current memory used by effects (in KB)
    uint32_t mTotalEffectsMemoryMaxUsed; // maximum memory used by effects (in KB)

    /**
     * Maximum CPU load allocated to audio effects in 0.1 MIPS (ARMv5TE, 0 WS memory) units
+8 −3
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ status_t EffectDescriptor::dump(int fd)

EffectDescriptorCollection::EffectDescriptorCollection() :
    mTotalEffectsCpuLoad(0),
    mTotalEffectsMemory(0)
    mTotalEffectsMemory(0),
    mTotalEffectsMemoryMaxUsed(0)
{

}
@@ -62,6 +63,9 @@ status_t EffectDescriptorCollection::registerEffect(const effect_descriptor_t *d
        return INVALID_OPERATION;
    }
    mTotalEffectsMemory += desc->memoryUsage;
    if (mTotalEffectsMemory > mTotalEffectsMemoryMaxUsed) {
        mTotalEffectsMemoryMaxUsed = mTotalEffectsMemory;
    }
    ALOGV("registerEffect() effect %s, io %d, strategy %d session %d id %d",
            desc->name, io, strategy, session, id);
    ALOGV("registerEffect() memory %d, total memory %d", desc->memoryUsage, mTotalEffectsMemory);
@@ -175,8 +179,9 @@ status_t EffectDescriptorCollection::dump(int fd)
    const size_t SIZE = 256;
    char buffer[SIZE];

    snprintf(buffer, SIZE, "\nTotal Effects CPU: %f MIPS, Total Effects memory: %d KB\n",
             (float)mTotalEffectsCpuLoad/10, mTotalEffectsMemory);
    snprintf(buffer, SIZE,
            "\nTotal Effects CPU: %f MIPS, Total Effects memory: %d KB, Max memory used: %d KB\n",
             (float)mTotalEffectsCpuLoad/10, mTotalEffectsMemory, mTotalEffectsMemoryMaxUsed);
    write(fd, buffer, strlen(buffer));

    snprintf(buffer, SIZE, "Registered effects:\n");