From 9c2c964727e4a484acf7f97267a3cf1c8fbacd89 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 11 Apr 2009 15:43:15 +0200 Subject: Print statistics in verbose mode --- src/cgg.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/cgg.c') diff --git a/src/cgg.c b/src/cgg.c index 92debc8..f5776b4 100644 --- a/src/cgg.c +++ b/src/cgg.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,7 @@ #include "setup.h" #include "job-manager.h" +#include "stats.h" @@ -106,6 +108,8 @@ main(int argc, char* argv[]) gboolean verbose; int jobs; TGallerySetup *setup; + time_t time_start = time (NULL); + time_t time_stop; /* * this initialize the library and check potential ABI mismatches @@ -151,10 +155,28 @@ main(int argc, char* argv[]) } + stats_errors = 0; + stats_dirs = 0; + stats_images = 0; + + /* Print banner */ + if (verbose) + printf ("cgg v%s [%s]\n\n", VERSION, APP_BUILD_DATE); + /* Start building the gallery tree */ setup->verbose = verbose; build_tree (setup, source_dir, dst_dir, NULL, -1, jobs); + if (verbose) { + time_stop = time (NULL); + printf ("\nProcessed %d images in %d albums, elapsed time = %dm %ds\n", stats_images, stats_dirs, (int) ((time_stop - time_start) / 60), (int) ((time_stop - time_start) % 60)); + if (stats_errors == 1) + printf ("%d error occured.\n", stats_errors); + if (stats_errors > 1) + printf ("%d errors occured.\n", stats_errors); + } + + MagickWandTerminus(); -- cgit v1.2.3