From 241cec80a79551730122fb9dbc92a3527392b1de Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Sun, 16 Jan 2011 19:29:23 -0800 Subject: [PATCH] Remove unused heap dumping code. Change-Id: Id8774848a870003c60be2ebcc505ce30795a4fcf --- vm/alloc/HeapDebug.c | 73 ---------------------------------------------------- 1 file changed, 73 deletions(-) diff --git a/vm/alloc/HeapDebug.c b/vm/alloc/HeapDebug.c index 9227db548..986f16b0b 100644 --- a/vm/alloc/HeapDebug.c +++ b/vm/alloc/HeapDebug.c @@ -323,76 +323,3 @@ void dvmLogMadviseStats(size_t madvisedSizes[], size_t arrayLen) (void) android_btWriteLog(EVENT_LOG_TAG_dvm_gc_madvise_info, EVENT_TYPE_LIST, eventBuf, sizeof(eventBuf)); } - -#if 0 -#include -#include - -typedef struct HeapDumpContext { - FILE *fp; - void *chunkStart; - size_t chunkLen; - bool chunkFree; -} HeapDumpContext; - -static void -dump_context(const HeapDumpContext *ctx) -{ - fprintf(ctx->fp, "0x%08x %12.12zd %s\n", (uintptr_t)ctx->chunkStart, - ctx->chunkLen, ctx->chunkFree ? "FREE" : "USED"); -} - -static void -heap_chunk_callback(const void *chunkptr, size_t chunklen, - const void *userptr, size_t userlen, void *arg) -{ - HeapDumpContext *ctx = (HeapDumpContext *)arg; - bool chunkFree = (userptr == NULL); - - if (chunkFree != ctx->chunkFree || - ((char *)ctx->chunkStart + ctx->chunkLen) != chunkptr) - { - /* The new chunk is of a different type or isn't - * contiguous with the current chunk. Dump the - * old one and start a new one. - */ - if (ctx->chunkStart != NULL) { - /* It's not the first chunk. */ - dump_context(ctx); - } - ctx->chunkStart = (void *)chunkptr; - ctx->chunkLen = chunklen; - ctx->chunkFree = chunkFree; - } else { - /* Extend the current chunk. - */ - ctx->chunkLen += chunklen; - } -} - -/* Dumps free and used ranges, as text, to the named file. - */ -void dvmDumpHeapToFile(const char *fileName) -{ - HeapDumpContext ctx; - FILE *fp; - - fp = fopen(fileName, "w+"); - if (fp == NULL) { - LOGE("Can't open %s for writing: %s\n", fileName, strerror(errno)); - return; - } - LOGW("Dumping heap to %s...\n", fileName); - - fprintf(fp, "==== Dalvik heap dump ====\n"); - memset(&ctx, 0, sizeof(ctx)); - ctx.fp = fp; - dvmHeapSourceWalk(heap_chunk_callback, (void *)&ctx); - dump_context(&ctx); - fprintf(fp, "==== end heap dump ====\n"); - - LOGW("Dumped heap to %s.\n", fileName); - - fclose(fp); -} -#endif -- 2.11.0