Skip to content

Commit e04153a

Browse files
author
Vladimir Kotal
committed
add elapsed statistics for directory traversal and indexing
approaches #2292
1 parent 9debd33 commit e04153a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ private int getFileCount(File sourceRoot, String dir) throws IOException {
352352
IndexDownArgs args = new IndexDownArgs();
353353
args.count_only = true;
354354

355+
Statistics elapsed = new Statistics();
355356
LOGGER.log(Level.INFO, "Counting files in {0} ...", dir);
356357
indexDown(sourceRoot, dir, args);
357-
LOGGER.log(Level.INFO,
358-
"Need to process: {0} files for {1}",
359-
new Object[]{args.cur_count, dir});
358+
elapsed.report(LOGGER, String.format("Need to process: %d files for %s",
359+
args.cur_count, dir));
360360
}
361361

362362
return file_cnt;
@@ -495,10 +495,16 @@ public void update(IndexerParallelizer parallelizer)
495495
args.est_total = getFileCount(sourceRoot, dir);
496496

497497
args.cur_count = 0;
498+
Statistics elapsed = new Statistics();
499+
LOGGER.log(Level.INFO, "Starting traversal of directory {0}", dir);
498500
indexDown(sourceRoot, dir, args);
501+
elapsed.report(LOGGER, String.format("Done traversal of directory %s", dir));
499502

500503
args.cur_count = 0;
504+
elapsed = new Statistics();
505+
LOGGER.log(Level.INFO, "Starting indexing of directory {0}", dir);
501506
indexParallel(args);
507+
elapsed.report(LOGGER, String.format("Done indexing of directory %s", dir));
502508

503509
// Remove data for the trailing terms that indexDown()
504510
// did not traverse. These correspond to files that have been

0 commit comments

Comments
 (0)