summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastThreadDumpState.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2015-03-02 14:47:19 -0800
committerGlenn Kasten <gkasten@google.com>2015-03-03 08:50:40 -0800
commitfbdb2aceab7317aa44bc8f301a93eb49e17b2bce (patch)
tree97defd36379d3d4770dbd02dbacf046084889761 /services/audioflinger/FastThreadDumpState.cpp
parent63238efb0d674758902918e3cdaac322126484b7 (diff)
downloadframeworks_av-fbdb2aceab7317aa44bc8f301a93eb49e17b2bce.zip
frameworks_av-fbdb2aceab7317aa44bc8f301a93eb49e17b2bce.tar.gz
frameworks_av-fbdb2aceab7317aa44bc8f301a93eb49e17b2bce.tar.bz2
Pull up increaseSamplingN and kSamplingNforLowRamDevice
from FastMixerDumpState to FastThreadDumpState, and remove unused parameter from FastMixerDumpState constructor. Change-Id: Ib8937b106622a8da28a6ef6043de4528ae82cb05
Diffstat (limited to 'services/audioflinger/FastThreadDumpState.cpp')
-rw-r--r--services/audioflinger/FastThreadDumpState.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/services/audioflinger/FastThreadDumpState.cpp b/services/audioflinger/FastThreadDumpState.cpp
index 9d575a6..9df5c4c 100644
--- a/services/audioflinger/FastThreadDumpState.cpp
+++ b/services/audioflinger/FastThreadDumpState.cpp
@@ -23,15 +23,36 @@ FastThreadDumpState::FastThreadDumpState() :
/* mMeasuredWarmupTs({0, 0}), */
mWarmupCycles(0)
#ifdef FAST_THREAD_STATISTICS
- , mSamplingN(1), mBounds(0)
+ , mSamplingN(0), mBounds(0)
#endif
{
mMeasuredWarmupTs.tv_sec = 0;
mMeasuredWarmupTs.tv_nsec = 0;
+#ifdef FAST_THREAD_STATISTICS
+ increaseSamplingN(1);
+#endif
}
FastThreadDumpState::~FastThreadDumpState()
{
}
+#ifdef FAST_THREAD_STATISTICS
+void FastThreadDumpState::increaseSamplingN(uint32_t samplingN)
+{
+ if (samplingN <= mSamplingN || samplingN > kSamplingN || roundup(samplingN) != samplingN) {
+ return;
+ }
+ uint32_t additional = samplingN - mSamplingN;
+ // sample arrays aren't accessed atomically with respect to the bounds,
+ // so clearing reduces chance for dumpsys to read random uninitialized samples
+ memset(&mMonotonicNs[mSamplingN], 0, sizeof(mMonotonicNs[0]) * additional);
+ memset(&mLoadNs[mSamplingN], 0, sizeof(mLoadNs[0]) * additional);
+#ifdef CPU_FREQUENCY_STATISTICS
+ memset(&mCpukHz[mSamplingN], 0, sizeof(mCpukHz[0]) * additional);
+#endif
+ mSamplingN = samplingN;
+}
+#endif
+
} // android