[haiku-commits] r39599 - in haiku/trunk: headers/private/app src/servers/app src/tests/servers/app

Author: axeld
Date: 2010-11-23 22:50:12 +0100 (Tue, 23 Nov 2010)
New Revision: 39599
Changeset: http://dev.haiku-os.org/changeset/39599

Modified:
   haiku/trunk/headers/private/app/ServerProtocol.h
   haiku/trunk/src/servers/app/Desktop.cpp
   haiku/trunk/src/servers/app/ServerApp.cpp
   haiku/trunk/src/tests/servers/app/app_server_debug.cpp
Log:
* Added a new AS_DUMP_BITMAPS command.
* Extended app_server_debug command to be able to send it, too.


Modified: haiku/trunk/headers/private/app/ServerProtocol.h
===================================================================
--- haiku/trunk/headers/private/app/ServerProtocol.h    2010-11-23 21:48:32 UTC 
(rev 39598)
+++ haiku/trunk/headers/private/app/ServerProtocol.h    2010-11-23 21:50:12 UTC 
(rev 39599)
@@ -338,6 +338,7 @@
 
        // debugging helper
        AS_DUMP_ALLOCATOR,
+       AS_DUMP_BITMAPS,
 
        AS_LAST_CODE
 };

Modified: haiku/trunk/src/servers/app/Desktop.cpp
===================================================================
--- haiku/trunk/src/servers/app/Desktop.cpp     2010-11-23 21:48:32 UTC (rev 
39598)
+++ haiku/trunk/src/servers/app/Desktop.cpp     2010-11-23 21:50:12 UTC (rev 
39599)
@@ -2387,6 +2387,7 @@
 
                case AS_APP_CRASHED:
                case AS_DUMP_ALLOCATOR:
+               case AS_DUMP_BITMAPS:
                {
                        BAutolock locker(fApplicationsLock);
 

Modified: haiku/trunk/src/servers/app/ServerApp.cpp
===================================================================
--- haiku/trunk/src/servers/app/ServerApp.cpp   2010-11-23 21:48:32 UTC (rev 
39598)
+++ haiku/trunk/src/servers/app/ServerApp.cpp   2010-11-23 21:50:12 UTC (rev 
39599)
@@ -548,7 +548,24 @@
                case AS_DUMP_ALLOCATOR:
                        fMemoryAllocator.Dump();
                        break;
+               case AS_DUMP_BITMAPS:
+               {
+                       fMapLocker.Lock();
 
+                       debug_printf("Application %ld, %s: %d bitmaps:\n", 
ClientTeam(),
+                               Signature(), (int)fBitmapMap.size());
+
+                       BitmapMap::const_iterator iterator = fBitmapMap.begin();
+                       for (; iterator != fBitmapMap.end(); iterator++) {
+                               ServerBitmap* bitmap = iterator->second;
+                               debug_printf("  [%ld] %ldx%ld, area %ld, size 
%ld\n",
+                                       bitmap->Token(), bitmap->Width(), 
bitmap->Height(),
+                                       bitmap->Area(), bitmap->BitsLength());
+                       }
+                       fMapLocker.Unlock();
+                       break;
+               }
+
                case AS_CREATE_WINDOW:
                case AS_CREATE_OFFSCREEN_WINDOW:
                {

Modified: haiku/trunk/src/tests/servers/app/app_server_debug.cpp
===================================================================
--- haiku/trunk/src/tests/servers/app/app_server_debug.cpp      2010-11-23 
21:48:32 UTC (rev 39598)
+++ haiku/trunk/src/tests/servers/app/app_server_debug.cpp      2010-11-23 
21:50:12 UTC (rev 39599)
@@ -37,18 +37,48 @@
 }
 
 
+void
+usage()
+{
+       fprintf(stderr, "usage: %s -[ab] <team-id> [...]\n", __progname);
+       exit(1);
+}
+
+
 int
 main(int argc, char** argv)
 {
-       if (argc == 1) {
-               fprintf(stderr, "usage: %s <team-id> [...]\n", __progname);
-               return 1;
+       if (argc == 1)
+               usage();
+
+       bool dumpAllocator = false;
+       bool dumpBitmaps = false;
+
+       int32 i = 1;
+       while (argv[i][0] == '-') {
+               const char* arg = &argv[i][1];
+               while (arg[0]) {
+                       if (arg[0] == 'a')
+                               dumpAllocator = true;
+                       else if (arg[0] == 'b')
+                               dumpBitmaps = true;
+                       else
+                               usage();
+
+                       arg++;
+               }
+               i++;
        }
 
        for (int32 i = 1; i < argc; i++) {
                team_id team = atoi(argv[i]);
-               if (team > 0)
+               if (team <= 0)
+                       continue;
+
+               if (dumpAllocator)
                        send_debug_message(team, AS_DUMP_ALLOCATOR);
+               if (dumpBitmaps)
+                       send_debug_message(team, AS_DUMP_BITMAPS);
        }
 
        return 0;


Other related posts:

  • » [haiku-commits] r39599 - in haiku/trunk: headers/private/app src/servers/app src/tests/servers/app - axeld