summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp50
1 files changed, 48 insertions, 2 deletions
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
{