* Added a new AS_DUMP_BITMAPS command.

* Extended app_server_debug command to be able to send it, too.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39599 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-11-23 21:50:12 +00:00
parent ee72532a7a
commit e3feb1f8af
4 changed files with 53 additions and 4 deletions

View File

@ -338,6 +338,7 @@ enum {
// debugging helper
AS_DUMP_ALLOCATOR,
AS_DUMP_BITMAPS,
AS_LAST_CODE
};

View File

@ -2387,6 +2387,7 @@ Desktop::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
case AS_APP_CRASHED:
case AS_DUMP_ALLOCATOR:
case AS_DUMP_BITMAPS:
{
BAutolock locker(fApplicationsLock);

View File

@ -548,6 +548,23 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
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:

View File

@ -37,18 +37,48 @@ send_debug_message(team_id team, int32 code)
}
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;