summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-05-02 10:34:47 -0700
committerGlenn Kasten <gkasten@google.com>2012-05-10 13:39:16 -0700
commit42d45cfd0c3d62357a6549c62f535e4d4fe08d91 (patch)
tree40667398d6db38a70fa2729e6d574a01b1ebefd1 /services/audioflinger/FastMixer.h
parentc150ca7dda844891fa684f6898da7f7e0c40329d (diff)
downloadframeworks_av-42d45cfd0c3d62357a6549c62f535e4d4fe08d91.zip
frameworks_av-42d45cfd0c3d62357a6549c62f535e4d4fe08d91.tar.gz
frameworks_av-42d45cfd0c3d62357a6549c62f535e4d4fe08d91.tar.bz2
Update fast mixer statistics
Compute statistics on fast mixer elapsed time and CPU load per cycle using a simple moving average rather than by fixed blocks. This has a couple advantages: - remove burstiness of CPU usage due to former floating-point calculations in fast mixer - gives us flexibility in how to report (e.g. could report over just the last 1 second) Disadvantage is increased RAM, and since the samples are not updated atomically, it is possible to have an error in the statistics. This should not be much of an issue due to the relatively large number of samples. Also add CPU raw ns and adjusted MHz statistics. Change-Id: Iaa2cd13f18250c3162aff40409b3694b769d9505
Diffstat (limited to 'services/audioflinger/FastMixer.h')
-rw-r--r--services/audioflinger/FastMixer.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/services/audioflinger/FastMixer.h b/services/audioflinger/FastMixer.h
index a6dd310..e2ed553 100644
--- a/services/audioflinger/FastMixer.h
+++ b/services/audioflinger/FastMixer.h
@@ -64,7 +64,7 @@ struct FastMixerDumpState {
FastMixerDumpState();
/*virtual*/ ~FastMixerDumpState();
- void dump(int fd);
+ void dump(int fd); // should only be called on a stable copy, not the original
FastMixerState::Command mCommand; // current command
uint32_t mWriteSequence; // incremented before and after each write()
@@ -78,12 +78,20 @@ struct FastMixerDumpState {
struct timespec mMeasuredWarmupTs; // measured warmup time
uint32_t mWarmupCycles; // number of loop cycles required to warmup
FastTrackDump mTracks[FastMixerState::kMaxFastTracks];
+
#ifdef FAST_MIXER_STATISTICS
- // cycle times in seconds
- float mMean;
- float mMinimum;
- float mMaximum;
- float mStddev;
+ // Recently collected samples of per-cycle monotonic time, thread CPU time, and CPU frequency.
+ // kSamplingN is the size of the sampling frame, and must be a power of 2 <= 0x8000.
+ static const uint32_t kSamplingN = 0x1000;
+ // The bounds define the interval of valid samples, and are represented as follows:
+ // newest open (excluded) endpoint = lower 16 bits of bounds, modulo N
+ // oldest closed (included) endpoint = upper 16 bits of bounds, modulo N
+ // Number of valid samples is newest - oldest.
+ uint32_t mBounds; // bounds for mMonotonicNs, mThreadCpuNs, and mCpukHz
+ // The elements in the *Ns arrays are in units of nanoseconds <= 3999999999.
+ uint32_t mMonotonicNs[kSamplingN]; // delta monotonic (wall clock) time
+ uint32_t mLoadNs[kSamplingN]; // delta CPU load in time
+ uint32_t mCpukHz[kSamplingN]; // absolute CPU clock frequency in kHz, bits 0-3 are CPU#
#endif
};