summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DispSync.cpp
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2014-05-08 14:53:26 -0700
committerAndy McFadden <fadden@android.com>2014-05-08 16:14:41 -0700
commitc751e92c56de5f335a36e68607c7a6c627dcd0dc (patch)
tree76672a2425c62220542be9e33e5f3a0b2b72363f /services/surfaceflinger/DispSync.cpp
parent150ecd8c1bd5543bf0a65ac838a7409131106716 (diff)
downloadframeworks_native-c751e92c56de5f335a36e68607c7a6c627dcd0dc.zip
frameworks_native-c751e92c56de5f335a36e68607c7a6c627dcd0dc.tar.gz
frameworks_native-c751e92c56de5f335a36e68607c7a6c627dcd0dc.tar.bz2
Add "dumpsys SurfaceFlinger --dispsync"
Dumps the current DispSync state. Bug 14651879 Change-Id: Ide4e6dbd58b117bc1a6b97b57d10cd92ec86dc84
Diffstat (limited to 'services/surfaceflinger/DispSync.cpp')
-rw-r--r--services/surfaceflinger/DispSync.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/services/surfaceflinger/DispSync.cpp b/services/surfaceflinger/DispSync.cpp
index 2ee7570..d771e2c 100644
--- a/services/surfaceflinger/DispSync.cpp
+++ b/services/surfaceflinger/DispSync.cpp
@@ -514,4 +514,49 @@ nsecs_t DispSync::computeNextRefresh(int periodOffset) const {
return (((now - mPhase) / mPeriod) + periodOffset + 1) * mPeriod + mPhase;
}
+void DispSync::dump(String8& result) const {
+ Mutex::Autolock lock(mMutex);
+ result.appendFormat("mPeriod: %"PRId64" ns\n", mPeriod);
+ result.appendFormat("mPhase: %"PRId64" ns\n", mPhase);
+ result.appendFormat("mError: %"PRId64" ns (sqrt: %.1f)\n",
+ mError, sqrt(mError));
+ result.appendFormat("mNumResyncSamplesSincePresent: %d (max %d)\n",
+ mNumResyncSamplesSincePresent, MAX_RESYNC_SAMPLES_WITHOUT_PRESENT);
+ result.appendFormat("mNumResyncSamples: %d (max %d)\n",
+ mNumResyncSamples, MAX_RESYNC_SAMPLES);
+
+ result.appendFormat("mResyncSamples:\n");
+ nsecs_t previous = -1;
+ for (size_t i = 0; i < mNumResyncSamples; i++) {
+ size_t idx = (mFirstResyncSample + i) % MAX_RESYNC_SAMPLES;
+ nsecs_t sampleTime = mResyncSamples[idx];
+ if (i == 0) {
+ result.appendFormat(" %"PRId64"\n", sampleTime);
+ } else {
+ result.appendFormat(" %"PRId64" (+%"PRId64")\n",
+ sampleTime, sampleTime - previous);
+ }
+ previous = sampleTime;
+ }
+
+ result.appendFormat("mPresentFences / mPresentTimes [%d]:\n",
+ NUM_PRESENT_SAMPLES);
+ previous = 0;
+ for (size_t i = 0; i < NUM_PRESENT_SAMPLES; i++) {
+ size_t idx = (i + mPresentSampleOffset) % NUM_PRESENT_SAMPLES;
+ bool signaled = mPresentFences[idx] == NULL;
+ nsecs_t presentTime = mPresentTimes[idx];
+ if (!signaled) {
+ result.appendFormat(" [unsignaled fence]\n");
+ } else if (previous == 0) {
+ result.appendFormat(" %"PRId64"\n", presentTime);
+ } else {
+ result.appendFormat(" %"PRId64" (+%"PRId64" / %.3f)\n",
+ presentTime, presentTime - previous,
+ (presentTime - previous) / (double) mPeriod);
+ }
+ previous = presentTime;
+ }
+}
+
} // namespace android