summaryrefslogtreecommitdiffstatsabout
path: root/utility/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility/shell.c')
-rw-r--r--utility/shell.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/utility/shell.c b/utility/shell.c
index 5f011a6..6f98055 100644
--- a/utility/shell.c
+++ b/utility/shell.c
@@ -55,6 +55,30 @@ void show_help(const char *prog, const apr_getopt_option_t *opts, FILE *output)
55 } 55 }
56} 56}
57 57
58void print_summary(config_t *cfg) {
59 config_filestat_t *fstat;
60 int i,m;
61
62 fstat = (config_filestat_t *)cfg->input_files->elts;
63
64 printf("Execution Summary\n");
65 for (i=0, m=cfg->input_files->nelts; i<m; i++) {
66 printf(" File: %s\n"
67 " Lines Parsed %d out of %d (Skipped %d)\n"
68 " Status: %s\n"
69 " Duration: %02"APR_TIME_T_FMT":%02"APR_TIME_T_FMT".%"APR_TIME_T_FMT" (minutes, seconds, and miliseconds)\n"
70 "\n",
71 fstat[i].fname,
72 fstat[i].linesparsed - fstat[i].lineskipped,
73 fstat[i].linesparsed, fstat[i].lineskipped,
74 fstat[i].result,
75 apr_time_sec(fstat[i].stop - fstat[i].start)/60,
76 apr_time_sec(fstat[i].stop - fstat[i].start),
77 apr_time_msec(fstat[i].stop - fstat[i].start)
78 );
79 }
80}
81
58int main(int argc, const char *const argv[]) 82int main(int argc, const char *const argv[])
59{ 83{
60 apr_pool_t *pool, *ptemp; 84 apr_pool_t *pool, *ptemp;
@@ -166,11 +190,11 @@ int main(int argc, const char *const argv[])
166 } 190 }
167 } 191 }
168 if (!apr_is_empty_array(cfg->input_files)) { 192 if (!apr_is_empty_array(cfg->input_files)) {
169 char **filelist; 193 config_filestat_t *filelist;
170 int f, l; 194 int f, l;
171 filelist = (char **)cfg->input_files->elts; 195 filelist = (config_filestat_t *)cfg->input_files->elts;
172 for (f=0, l=cfg->input_files->nelts; f < l; f++) { 196 for (f=0, l=cfg->input_files->nelts; f < l; f++) {
173 rv = parse_logfile(cfg, filelist[f]); 197 rv = parser_parsefile(cfg, &filelist[f]);
174 if (rv) { 198 if (rv) {
175 logging_log(cfg, LOGLEVEL_NOISE, 199 logging_log(cfg, LOGLEVEL_NOISE,
176 "Error occured parsing log files. Aborting"); 200 "Error occured parsing log files. Aborting");
@@ -183,6 +207,9 @@ int main(int argc, const char *const argv[])
183 if (!cfg->dryrun) { 207 if (!cfg->dryrun) {
184 database_disconnect(cfg); 208 database_disconnect(cfg);
185 } 209 }
186 /** @todo summary goes here */ 210
211 if (cfg->summary) {
212 print_summary(cfg);
213 }
187 return 0; 214 return 0;
188} 215}