diff options
author | Mathias Agopian <mathias@google.com> | 2012-01-28 22:31:55 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-01-28 22:31:55 -0800 |
commit | 25e66fc324bbc004fa8902b2d4699e41bb601104 (patch) | |
tree | 803229d4893c657201f019c2739af56b189370d2 | |
parent | 751ecf24fd8e40f62d0b683779006a556f012503 (diff) | |
download | frameworks_native-25e66fc324bbc004fa8902b2d4699e41bb601104.zip frameworks_native-25e66fc324bbc004fa8902b2d4699e41bb601104.tar.gz frameworks_native-25e66fc324bbc004fa8902b2d4699e41bb601104.tar.bz2 |
added a few more commands to SF's dumpsys
--latency-clear [name]
clears the latency data for the specified layer or for
all layers if none is specified
--list
prints the list of all layers regardless of their visibility
Change-Id: I7c07ae020f838c173b98ee50f3fb3e93da78acbb
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 8 | ||||
-rw-r--r-- | services/surfaceflinger/Layer.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.cpp | 9 | ||||
-rw-r--r-- | services/surfaceflinger/LayerBase.h | 1 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 50 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 4 |
6 files changed, 65 insertions, 8 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index a294281..8e87b88 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -553,8 +553,6 @@ void Layer::dump(String8& result, char* buffer, size_t SIZE) const result.append(buffer); - LayerBase::dumpStats(result, buffer, SIZE); - if (mSurfaceTexture != 0) { mSurfaceTexture->dump(result, " ", buffer, SIZE); } @@ -580,6 +578,12 @@ void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const result.append("\n"); } +void Layer::clearStats() +{ + LayerBaseClient::clearStats(); + memset(mFrameStats, 0, sizeof(mFrameStats)); +} + uint32_t Layer::getEffectiveUsage(uint32_t usage) const { // TODO: should we do something special if mSecure is set? diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index b3fa5e7..2dd4da1 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -88,6 +88,7 @@ protected: virtual void onFirstRef(); virtual void dump(String8& result, char* scratch, size_t size) const; virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const; + virtual void clearStats(); private: friend class SurfaceTextureLayer; diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp index 1e2c4cb..d32fcdd 100644 --- a/services/surfaceflinger/LayerBase.cpp +++ b/services/surfaceflinger/LayerBase.cpp @@ -489,13 +489,14 @@ void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const result.append(buffer); } -void LayerBase::shortDump(String8& result, char* scratch, size_t size) const -{ +void LayerBase::shortDump(String8& result, char* scratch, size_t size) const { LayerBase::dump(result, scratch, size); } -void LayerBase::dumpStats(String8& result, char* scratch, size_t SIZE) const -{ +void LayerBase::dumpStats(String8& result, char* scratch, size_t SIZE) const { +} + +void LayerBase::clearStats() { } // --------------------------------------------------------------------------- diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h index 03d2cc6..6b62c9d 100644 --- a/services/surfaceflinger/LayerBase.h +++ b/services/surfaceflinger/LayerBase.h @@ -212,6 +212,7 @@ public: virtual void dump(String8& result, char* scratch, size_t size) const; virtual void shortDump(String8& result, char* scratch, size_t size) const; virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const; + virtual void clearStats(); enum { // flags for doTransaction() diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 883b642..0563999 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1486,12 +1486,27 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) bool dumpAll = true; size_t index = 0; - if (args.size()) { + size_t numArgs = args.size(); + if (numArgs) { dumpAll = false; - if (args[index] == String16("--latency")) { + + if ((index < numArgs) && + (args[index] == String16("--list"))) { + index++; + listLayersLocked(args, index, result, buffer, SIZE); + } + + if ((index < numArgs) && + (args[index] == String16("--latency"))) { index++; dumpStatsLocked(args, index, result, buffer, SIZE); } + + if ((index < numArgs) && + (args[index] == String16("--latency-clear"))) { + index++; + clearStatsLocked(args, index, result, buffer, SIZE); + } } if (dumpAll) { @@ -1506,6 +1521,18 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) return NO_ERROR; } +void SurfaceFlinger::listLayersLocked(const Vector<String16>& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const +{ + const LayerVector& currentLayers = mCurrentState.layersSortedByZ; + const size_t count = currentLayers.size(); + for (size_t i=0 ; i<count ; i++) { + const sp<LayerBase>& layer(currentLayers[i]); + snprintf(buffer, SIZE, "%s\n", layer->getName().string()); + result.append(buffer); + } +} + void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index, String8& result, char* buffer, size_t SIZE) const { @@ -1529,6 +1556,25 @@ void SurfaceFlinger::dumpStatsLocked(const Vector<String16>& args, size_t& index } } +void SurfaceFlinger::clearStatsLocked(const Vector<String16>& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const +{ + String8 name; + if (index < args.size()) { + name = String8(args[index]); + index++; + } + + const LayerVector& currentLayers = mCurrentState.layersSortedByZ; + const size_t count = currentLayers.size(); + for (size_t i=0 ; i<count ; i++) { + const sp<LayerBase>& layer(currentLayers[i]); + if (name.isEmpty() || (name == layer->getName())) { + layer->clearStats(); + } + } +} + void SurfaceFlinger::dumpAllLocked( String8& result, char* buffer, size_t SIZE) const { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index c976e5a..b1b6116 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -337,8 +337,12 @@ private: void debugFlashRegions(); void drawWormhole() const; + void listLayersLocked(const Vector<String16>& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const; void dumpStatsLocked(const Vector<String16>& args, size_t& index, String8& result, char* buffer, size_t SIZE) const; + void clearStatsLocked(const Vector<String16>& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const; void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const; mutable MessageQueue mEventQueue; |