summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2013-08-26 15:08:28 +0000
committerRobin Watts <robin.watts@artifex.com>2013-08-28 13:35:40 +0100
commit0924e802017d5a669041a86beb0f1348d5fda8da (patch)
tree38dd37716e5632665218fe7e15a3977067817e6b /source/tools
parent346295fb26f35e7b2fd15d94248cf42deecfd4a7 (diff)
downloadmupdf-0924e802017d5a669041a86beb0f1348d5fda8da.tar.xz
Dump glyph cache size as part of mudraw -M
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 78b3cfba..7a6ad478 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -157,7 +157,7 @@ static int out_cs = CS_UNSET;
static int memtrace_current = 0;
static int memtrace_peak = 0;
static int memtrace_total = 0;
-
+static int showmemory = 0;
static fz_text_sheet *sheet = NULL;
static fz_colorspace *colorspace;
static char *filename;
@@ -771,6 +771,11 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
if (showmd5 || showtime)
printf("\n");
+ if (showmemory)
+ {
+ fz_dump_glyph_cache_stats(ctx);
+ }
+
fz_flush_warnings(ctx);
if (mujstest_file && needshot)
@@ -921,7 +926,6 @@ int main(int argc, char **argv)
int c;
fz_context *ctx;
fz_alloc_context alloc_ctx = { NULL, trace_malloc, trace_realloc, trace_free };
- int tracememory = 0;
fz_var(doc);
@@ -937,7 +941,7 @@ int main(int argc, char **argv)
case 'b': alphabits = atoi(fz_optarg); break;
case 'l': showoutline++; break;
case 'm': showtime++; break;
- case 'M': tracememory++; break;
+ case 'M': showmemory++; break;
case 't': showtext++; break;
case 'x': showxml++; break;
case '5': showmd5++; break;
@@ -972,7 +976,7 @@ int main(int argc, char **argv)
mujstest_file = fopen(mujstest_filename, "wb");
}
- ctx = fz_new_context((tracememory == 0 ? NULL : &alloc_ctx), NULL, FZ_STORE_DEFAULT);
+ ctx = fz_new_context((showmemory == 0 ? NULL : &alloc_ctx), NULL, FZ_STORE_DEFAULT);
if (!ctx)
{
fprintf(stderr, "cannot initialise context\n");
@@ -1213,7 +1217,7 @@ int main(int argc, char **argv)
fz_free_context(ctx);
- if (tracememory)
+ if (showmemory)
{
printf("Total memory use = %d bytes\n", memtrace_total);
printf("Peak memory use = %d bytes\n", memtrace_peak);