From f09611f2f33752afc28141e1bbaa897651c05d6f Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Fri, 13 Feb 2015 14:12:42 -0800 Subject: Add dumpsys info Print a list of looper-handler pairs and the number of messages they've processed, and optionally break those stats out by message type. Change-Id: I68ce4a7003152d5c9b5cb3f42e6f3949b471aa6e --- media/libmediaplayerservice/MediaPlayerService.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'media/libmediaplayerservice/MediaPlayerService.cpp') diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 1936218..694f1a4 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include @@ -247,6 +248,9 @@ void unmarshallAudioAttributes(const Parcel& parcel, audio_attributes_t *attribu namespace android { +extern ALooperRoster gLooperRoster; + + static bool checkPermission(const char* permissionString) { #ifndef HAVE_ANDROID_OS return true; @@ -428,6 +432,10 @@ status_t MediaPlayerService::Client::dump(int fd, const Vector& args) return NO_ERROR; } +/** + * The only arguments this understands right now are -c, -von and -voff, + * which are parsed by ALooperRoster::dump() + */ status_t MediaPlayerService::dump(int fd, const Vector& args) { const size_t SIZE = 256; @@ -461,7 +469,7 @@ status_t MediaPlayerService::dump(int fd, const Vector& args) } result.append(" Files opened and/or mapped:\n"); - snprintf(buffer, SIZE, "/proc/%d/maps", gettid()); + snprintf(buffer, SIZE, "/proc/%d/maps", getpid()); FILE *f = fopen(buffer, "r"); if (f) { while (!feof(f)) { @@ -481,13 +489,13 @@ status_t MediaPlayerService::dump(int fd, const Vector& args) result.append("\n"); } - snprintf(buffer, SIZE, "/proc/%d/fd", gettid()); + snprintf(buffer, SIZE, "/proc/%d/fd", getpid()); DIR *d = opendir(buffer); if (d) { struct dirent *ent; while((ent = readdir(d)) != NULL) { if (strcmp(ent->d_name,".") && strcmp(ent->d_name,"..")) { - snprintf(buffer, SIZE, "/proc/%d/fd/%s", gettid(), ent->d_name); + snprintf(buffer, SIZE, "/proc/%d/fd/%s", getpid(), ent->d_name); struct stat s; if (lstat(buffer, &s) == 0) { if ((s.st_mode & S_IFMT) == S_IFLNK) { @@ -528,6 +536,8 @@ status_t MediaPlayerService::dump(int fd, const Vector& args) result.append("\n"); } + gLooperRoster.dump(fd, args); + bool dumpMem = false; for (size_t i = 0; i < args.size(); i++) { if (args[i] == String16("-m")) { -- cgit v1.1