summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastThreadState.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-04-07 12:04:41 -0700
committerGlenn Kasten <gkasten@google.com>2014-04-28 12:26:11 -0700
commit2234002b0710c8db73f82d397cb945cd541c6bbb (patch)
treebe662712131225845bb0afd7d32e7c37a7f295ad /services/audioflinger/FastThreadState.h
parent67ee990d324229ab0565ce632bd5a04297e16a01 (diff)
downloadframeworks_av-2234002b0710c8db73f82d397cb945cd541c6bbb.zip
frameworks_av-2234002b0710c8db73f82d397cb945cd541c6bbb.tar.gz
frameworks_av-2234002b0710c8db73f82d397cb945cd541c6bbb.tar.bz2
Start pulling bits of FastMixer up to FastThread
Change-Id: I4c6f7b8f88fcf107bb29ee6432feecd4ab6554d2
Diffstat (limited to 'services/audioflinger/FastThreadState.h')
-rw-r--r--services/audioflinger/FastThreadState.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/services/audioflinger/FastThreadState.h b/services/audioflinger/FastThreadState.h
index 148fb7b..1ab8a0a 100644
--- a/services/audioflinger/FastThreadState.h
+++ b/services/audioflinger/FastThreadState.h
@@ -17,11 +17,14 @@
#ifndef ANDROID_AUDIO_FAST_THREAD_STATE_H
#define ANDROID_AUDIO_FAST_THREAD_STATE_H
+#include "Configuration.h"
#include <stdint.h>
#include <media/nbaio/NBLog.h>
namespace android {
+struct FastThreadDumpState;
+
// Represents a single state of a FastThread
struct FastThreadState {
FastThreadState();
@@ -35,14 +38,51 @@ struct FastThreadState {
IDLE = 3, // either HOT_IDLE or COLD_IDLE
EXIT = 4; // exit from thread
// additional values defined per subclass
- Command mCommand;
-
+ Command mCommand; // current command
int32_t* mColdFutexAddr; // for COLD_IDLE only, pointer to the associated futex
unsigned mColdGen; // increment when COLD_IDLE is requested so it's only performed once
+ // This might be a one-time configuration rather than per-state
+ FastThreadDumpState* mDumpState; // if non-NULL, then update dump state periodically
NBLog::Writer* mNBLogWriter; // non-blocking logger
+
}; // struct FastThreadState
+
+// FIXME extract common part of comment at FastMixerDumpState
+struct FastThreadDumpState {
+ FastThreadDumpState();
+ /*virtual*/ ~FastThreadDumpState();
+
+ FastThreadState::Command mCommand; // current command
+ uint32_t mUnderruns; // total number of underruns
+ uint32_t mOverruns; // total number of overruns
+ struct timespec mMeasuredWarmupTs; // measured warmup time
+ uint32_t mWarmupCycles; // number of loop cycles required to warmup
+
+#ifdef FAST_MIXER_STATISTICS
+ // Recently collected samples of per-cycle monotonic time, thread CPU time, and CPU frequency.
+ // kSamplingN is max size of sampling frame (statistics), and must be a power of 2 <= 0x8000.
+ // The sample arrays are virtually allocated based on this compile-time constant,
+ // but are only initialized and used based on the runtime parameter mSamplingN.
+ static const uint32_t kSamplingN = 0x8000;
+ // Corresponding runtime maximum size of sample arrays, must be a power of 2 <= kSamplingN.
+ uint32_t mSamplingN;
+ // 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
+#ifdef CPU_FREQUENCY_STATISTICS
+ uint32_t mCpukHz[kSamplingN]; // absolute CPU clock frequency in kHz, bits 0-3 are CPU#
+#endif
+#endif
+
+}; // struct FastThreadDumpState
+
} // android
#endif // ANDROID_AUDIO_FAST_THREAD_STATE_H