diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2012-05-27 14:18:04 +0200 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2012-05-27 14:24:27 +0200 |
commit | 97716e53a6fa6947a183ed88df54702f96ba97b5 (patch) | |
tree | 3b0100c90802760b761a9495c82fc0eb64f49541 /apps/mudraw.c | |
parent | 6811f986ece4df7f28ae4be61bac257e788bff55 (diff) | |
download | mupdf-97716e53a6fa6947a183ed88df54702f96ba97b5.tar.xz |
Print filenames for fastes/slowest page in mudraw
Diffstat (limited to 'apps/mudraw.c')
-rw-r--r-- | apps/mudraw.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/apps/mudraw.c b/apps/mudraw.c index 147e9181..6a90398f 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -34,11 +34,14 @@ static int fit = 0; static fz_text_sheet *sheet = NULL; static fz_colorspace *colorspace; static char *filename; +static int files = 0; static struct { int count, total; int min, max; int minpage, maxpage; + char *minfilename; + char *maxfilename; } timing; static void usage(void) @@ -348,11 +351,12 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) { timing.min = diff; timing.minpage = pagenum; + timing.minfilename = filename; } if (diff > timing.max) { timing.max = diff; - timing.maxpage = pagenum; + timing.maxfilename = filename; } timing.total += diff; timing.count ++; @@ -488,6 +492,8 @@ int main(int argc, char **argv) timing.max = 0; timing.minpage = 0; timing.maxpage = 0; + timing.minfilename = ""; + timing.maxfilename = ""; if (showxml || showtext == TEXT_XML) printf("<?xml version=\"1.0\"?>\n"); @@ -511,6 +517,7 @@ int main(int argc, char **argv) while (fz_optind < argc) { filename = argv[fz_optind++]; + files++; fz_try(ctx) { @@ -565,10 +572,20 @@ int main(int argc, char **argv) if (showtime && timing.count > 0) { - printf("total %dms / %d pages for an average of %dms\n", - timing.total, timing.count, timing.total / timing.count); - printf("fastest page %d: %dms\n", timing.minpage, timing.min); - printf("slowest page %d: %dms\n", timing.maxpage, timing.max); + if (files == 1) + { + printf("total %dms / %d pages for an average of %dms\n", + timing.total, timing.count, timing.total / timing.count); + printf("fastest page %d: %dms\n", timing.minpage, timing.min); + printf("slowest page %d: %dms\n", timing.maxpage, timing.max); + } + else + { + printf("total %dms / %d pages for an average of %dms in %d files\n", + timing.total, timing.count, timing.total / timing.count, files); + printf("fastest page %d: %dms (%s)\n", timing.minpage, timing.min, timing.minfilename); + printf("slowest page %d: %dms (%s)\n", timing.maxpage, timing.max, timing.maxfilename); + } } fz_free_context(ctx); |