summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2014-05-09 17:54:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-09 17:54:29 +0000
commitb66019615da8750588f1233a77b9c686b0a248c3 (patch)
tree237e59baaf2033ba66c34f5cadb7d31a9a02c14f
parent0b42423c59a12674d954079a9eb1f58a55fc55a6 (diff)
parent232f5bc675f92015190e39d46586e6f87cb6fbeb (diff)
downloadframeworks_native-b66019615da8750588f1233a77b9c686b0a248c3.zip
frameworks_native-b66019615da8750588f1233a77b9c686b0a248c3.tar.gz
frameworks_native-b66019615da8750588f1233a77b9c686b0a248c3.tar.bz2
Merge "DO NOT MERGE Add "dumpsys SurfaceFlinger --dispsync"" into klp-modular-dev
-rw-r--r--services/surfaceflinger/DispSync.cpp46
-rw-r--r--services/surfaceflinger/DispSync.h3
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp7
-rw-r--r--services/surfaceflinger/main_surfaceflinger.cpp2
4 files changed, 57 insertions, 1 deletions
diff --git a/services/surfaceflinger/DispSync.cpp b/services/surfaceflinger/DispSync.cpp
index ce07ab5..c51d207 100644
--- a/services/surfaceflinger/DispSync.cpp
+++ b/services/surfaceflinger/DispSync.cpp
@@ -20,6 +20,7 @@
#define __STDC_LIMIT_MACROS
#include <math.h>
+#include <inttypes.h>
#include <cutils/log.h>
@@ -487,4 +488,49 @@ void DispSync::resetErrorLocked() {
}
}
+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
diff --git a/services/surfaceflinger/DispSync.h b/services/surfaceflinger/DispSync.h
index c4280aa..19eb3e5 100644
--- a/services/surfaceflinger/DispSync.h
+++ b/services/surfaceflinger/DispSync.h
@@ -99,6 +99,9 @@ public:
// DispSync object.
status_t removeEventListener(const sp<Callback>& callback);
+ // dump appends human-readable debug info to the result string.
+ void dump(String8& result) const;
+
private:
void updateModelLocked();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1a9a694..b1db870 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2201,6 +2201,13 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args)
clearStatsLocked(args, index, result);
dumpAll = false;
}
+
+ if ((index < numArgs) &&
+ (args[index] == String16("--dispsync"))) {
+ index++;
+ mPrimaryDispSync.dump(result);
+ dumpAll = false;
+ }
}
if (dumpAll) {
diff --git a/services/surfaceflinger/main_surfaceflinger.cpp b/services/surfaceflinger/main_surfaceflinger.cpp
index b161480..90e3f7d 100644
--- a/services/surfaceflinger/main_surfaceflinger.cpp
+++ b/services/surfaceflinger/main_surfaceflinger.cpp
@@ -27,7 +27,7 @@
using namespace android;
-int main(int argc, char** argv) {
+int main(int, char**) {
// When SF is launched in its own process, limit the number of
// binder threads to 4.
ProcessState::self()->setThreadPoolMaxThreadCount(4);