104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten/*
204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * Copyright (C) 2014 The Android Open Source Project
304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten *
404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * Licensed under the Apache License, Version 2.0 (the "License");
504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * you may not use this file except in compliance with the License.
604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * You may obtain a copy of the License at
704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten *
804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten *      http://www.apache.org/licenses/LICENSE-2.0
904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten *
1004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * Unless required by applicable law or agreed to in writing, software
1104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * distributed under the License is distributed on an "AS IS" BASIS,
1204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * See the License for the specific language governing permissions and
1404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten * limitations under the License.
1504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten */
1604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
1704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#define LOG_TAG "FastMixerDumpState"
1804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten//#define LOG_NDEBUG 0
1904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
2004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include "Configuration.h"
21214b406c813e5baca3e4b5cdc1d986de35f09bbbGlenn Kasten#ifdef FAST_THREAD_STATISTICS
2204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include <cpustats/CentralTendencyStatistics.h>
2304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#ifdef CPU_FREQUENCY_STATISTICS
2404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include <cpustats/ThreadCpuUsage.h>
2504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
2604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
2704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include <utils/Debug.h>
2804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include <utils/Log.h>
2904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#include "FastMixerDumpState.h"
3004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
3104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kastennamespace android {
3204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
33fbdb2aceab7317aa44bc8f301a93eb49e17b2bceGlenn KastenFastMixerDumpState::FastMixerDumpState() : FastThreadDumpState(),
3404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    mWriteSequence(0), mFramesWritten(0),
3504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    mNumTracks(0), mWriteErrors(0),
3604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    mSampleRate(0), mFrameCount(0),
3704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    mTrackMask(0)
3804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten{
3904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten}
4004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
4104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn KastenFastMixerDumpState::~FastMixerDumpState()
4204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten{
4304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten}
4404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
4504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten// helper function called by qsort()
4604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kastenstatic int compare_uint32_t(const void *pa, const void *pb)
4704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten{
4804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t a = *(const uint32_t *)pa;
4904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t b = *(const uint32_t *)pb;
5004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    if (a < b) {
5104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        return -1;
5204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    } else if (a > b) {
5304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        return 1;
5404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    } else {
5504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        return 0;
5604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
5704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten}
5804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
5904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kastenvoid FastMixerDumpState::dump(int fd) const
6004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten{
6104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    if (mCommand == FastMixerState::INITIAL) {
6204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "  FastMixer not initialized\n");
6304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        return;
6404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
6504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    double measuredWarmupMs = (mMeasuredWarmupTs.tv_sec * 1000.0) +
6604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            (mMeasuredWarmupTs.tv_nsec / 1000000.0);
6717c9c998afed5ed9df7495eeed5822f3ed53ebecGlenn Kasten    double mixPeriodSec = (double) mFrameCount / mSampleRate;
6804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    dprintf(fd, "  FastMixer command=%s writeSequence=%u framesWritten=%u\n"
6904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                "            numTracks=%u writeErrors=%u underruns=%u overruns=%u\n"
7004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                "            sampleRate=%u frameCount=%zu measuredWarmup=%.3g ms, warmupCycles=%u\n"
7104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                "            mixPeriod=%.2f ms\n",
72bcb1486d052e329ae4790d93055d1c51017286c3Glenn Kasten                FastMixerState::commandToString(mCommand), mWriteSequence, mFramesWritten,
73bcb1486d052e329ae4790d93055d1c51017286c3Glenn Kasten                mNumTracks, mWriteErrors, mUnderruns, mOverruns,
74bcb1486d052e329ae4790d93055d1c51017286c3Glenn Kasten                mSampleRate, mFrameCount, measuredWarmupMs, mWarmupCycles,
75bcb1486d052e329ae4790d93055d1c51017286c3Glenn Kasten                mixPeriodSec * 1e3);
76214b406c813e5baca3e4b5cdc1d986de35f09bbbGlenn Kasten#ifdef FAST_THREAD_STATISTICS
7704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // find the interval of valid samples
7804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t bounds = mBounds;
7904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t newestOpen = bounds & 0xFFFF;
8004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t oldestClosed = bounds >> 16;
8104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t n = (newestOpen - oldestClosed) & 0xFFFF;
8204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    if (n > mSamplingN) {
8304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        ALOGE("too many samples %u", n);
8404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        n = mSamplingN;
8504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
8604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // statistics for monotonic (wall clock) time, thread raw CPU load in time, CPU clock frequency,
8704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // and adjusted CPU load in MHz normalized for CPU clock frequency
8804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    CentralTendencyStatistics wall, loadNs;
8904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#ifdef CPU_FREQUENCY_STATISTICS
9004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    CentralTendencyStatistics kHz, loadMHz;
9104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t previousCpukHz = 0;
9204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
9304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // Assuming a normal distribution for cycle times, three standard deviations on either side of
9404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // the mean account for 99.73% of the population.  So if we take each tail to be 1/1000 of the
9504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // sample set, we get 99.8% combined, or close to three standard deviations.
9604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    static const uint32_t kTailDenominator = 1000;
9704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t *tail = n >= kTailDenominator ? new uint32_t[n] : NULL;
9804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // loop over all the samples
9904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    for (uint32_t j = 0; j < n; ++j) {
10004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        size_t i = oldestClosed++ & (mSamplingN - 1);
10104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        uint32_t wallNs = mMonotonicNs[i];
10204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        if (tail != NULL) {
10304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            tail[j] = wallNs;
10404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        }
10504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        wall.sample(wallNs);
10604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        uint32_t sampleLoadNs = mLoadNs[i];
10704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        loadNs.sample(sampleLoadNs);
10804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#ifdef CPU_FREQUENCY_STATISTICS
10904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        uint32_t sampleCpukHz = mCpukHz[i];
11004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        // skip bad kHz samples
11104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        if ((sampleCpukHz & ~0xF) != 0) {
11204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            kHz.sample(sampleCpukHz >> 4);
11304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            if (sampleCpukHz == previousCpukHz) {
11404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                double megacycles = (double) sampleLoadNs * (double) (sampleCpukHz >> 4) * 1e-12;
11504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                double adjMHz = megacycles / mixPeriodSec;  // _not_ wallNs * 1e9
11604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                loadMHz.sample(adjMHz);
11704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            }
11804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        }
11904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        previousCpukHz = sampleCpukHz;
12004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
12104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
12204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    if (n) {
12304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "  Simple moving statistics over last %.1f seconds:\n",
12404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    wall.n() * mixPeriodSec);
12504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "    wall clock time in ms per mix cycle:\n"
12604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    "      mean=%.2f min=%.2f max=%.2f stddev=%.2f\n",
12704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    wall.mean()*1e-6, wall.minimum()*1e-6, wall.maximum()*1e-6,
12804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    wall.stddev()*1e-6);
12904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "    raw CPU load in us per mix cycle:\n"
13004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    "      mean=%.0f min=%.0f max=%.0f stddev=%.0f\n",
13104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    loadNs.mean()*1e-3, loadNs.minimum()*1e-3, loadNs.maximum()*1e-3,
13204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    loadNs.stddev()*1e-3);
13304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    } else {
13404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "  No FastMixer statistics available currently\n");
13504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
13604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#ifdef CPU_FREQUENCY_STATISTICS
13704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    dprintf(fd, "  CPU clock frequency in MHz:\n"
13804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                "    mean=%.0f min=%.0f max=%.0f stddev=%.0f\n",
13904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                kHz.mean()*1e-3, kHz.minimum()*1e-3, kHz.maximum()*1e-3, kHz.stddev()*1e-3);
14004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    dprintf(fd, "  adjusted CPU load in MHz (i.e. normalized for CPU clock frequency):\n"
14104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                "    mean=%.1f min=%.1f max=%.1f stddev=%.1f\n",
14204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                loadMHz.mean(), loadMHz.minimum(), loadMHz.maximum(), loadMHz.stddev());
14304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
14404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    if (tail != NULL) {
14504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        qsort(tail, n, sizeof(uint32_t), compare_uint32_t);
14604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        // assume same number of tail samples on each side, left and right
14704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        uint32_t count = n / kTailDenominator;
14804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        CentralTendencyStatistics left, right;
14904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        for (uint32_t i = 0; i < count; ++i) {
15004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            left.sample(tail[i]);
15104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            right.sample(tail[n - (i + 1)]);
15204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        }
15304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "  Distribution of mix cycle times in ms for the tails "
15404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    "(> ~3 stddev outliers):\n"
15504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    "    left tail: mean=%.2f min=%.2f max=%.2f stddev=%.2f\n"
15604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    "    right tail: mean=%.2f min=%.2f max=%.2f stddev=%.2f\n",
15704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    left.mean()*1e-6, left.minimum()*1e-6, left.maximum()*1e-6, left.stddev()*1e-6,
15804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    right.mean()*1e-6, right.minimum()*1e-6, right.maximum()*1e-6,
15904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                    right.stddev()*1e-6);
16004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        delete[] tail;
16104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
16204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten#endif
16304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // The active track mask and track states are updated non-atomically.
16404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // So if we relied on isActive to decide whether to display,
16504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // then we might display an obsolete track or omit an active track.
16604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // Instead we always display all tracks, with an indication
16704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    // of whether we think the track is active.
16804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    uint32_t trackMask = mTrackMask;
169dc2c50bad491d2c0c8a2efc0e24491076701c63cGlenn Kasten    dprintf(fd, "  Fast tracks: sMaxFastTracks=%u activeMask=%#x\n",
170dc2c50bad491d2c0c8a2efc0e24491076701c63cGlenn Kasten            FastMixerState::sMaxFastTracks, trackMask);
17104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    dprintf(fd, "  Index Active Full Partial Empty  Recent Ready\n");
172dc2c50bad491d2c0c8a2efc0e24491076701c63cGlenn Kasten    for (uint32_t i = 0; i < FastMixerState::sMaxFastTracks; ++i, trackMask >>= 1) {
17304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        bool isActive = trackMask & 1;
17404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        const FastTrackDump *ftDump = &mTracks[i];
17504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        const FastTrackUnderruns& underruns = ftDump->mUnderruns;
17604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        const char *mostRecent;
17704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        switch (underruns.mBitFields.mMostRecent) {
17804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        case UNDERRUN_FULL:
17904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            mostRecent = "full";
18004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            break;
18104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        case UNDERRUN_PARTIAL:
18204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            mostRecent = "partial";
18304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            break;
18404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        case UNDERRUN_EMPTY:
18504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            mostRecent = "empty";
18604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            break;
18704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        default:
18804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            mostRecent = "?";
18904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten            break;
19004333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        }
19104333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten        dprintf(fd, "  %5u %6s %4u %7u %5u %7s %5zu\n", i, isActive ? "yes" : "no",
19204333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                (underruns.mBitFields.mFull) & UNDERRUN_MASK,
19304333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                (underruns.mBitFields.mPartial) & UNDERRUN_MASK,
19404333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                (underruns.mBitFields.mEmpty) & UNDERRUN_MASK,
19504333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten                mostRecent, ftDump->mFramesReady);
19604333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten    }
19704333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten}
19804333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten
19904333cdc8d6a3c8e4a11835371e8ad13adf3f7f0Glenn Kasten}   // android
200