56
56
import org .opensolaris .opengrok .util .Executor ;
57
57
import org .opensolaris .opengrok .util .Getopt ;
58
58
import org .opensolaris .opengrok .util .Statistics ;
59
+ import org .opensolaris .opengrok .util .StringUtils ;
59
60
60
61
/**
61
62
* Creates and updates an inverted source index as well as generates Xref, file
@@ -548,6 +549,7 @@ public static void main(String argv[]) {
548
549
System .out .println ("History stored in DB and renamed file handling is on - possible performance degradation" );
549
550
}
550
551
552
+ long start = System .currentTimeMillis ();
551
553
getInstance ().prepareIndexer (env , searchRepositories , addProjects ,
552
554
defaultProject , configFilename , refreshHistory ,
553
555
listFiles , createDict , subFiles , repositories ,
@@ -560,6 +562,9 @@ public static void main(String argv[]) {
560
562
getInstance ().doIndexerExecution (update , noThreads , subFiles ,
561
563
progress );
562
564
}
565
+ long stop = System .currentTimeMillis ();
566
+ String time_str = StringUtils .getReadableTime (stop - start );
567
+ log .log (Level .INFO , "Total indexing time: {0})" , time_str );
563
568
getInstance ().sendToConfigHost (env , configHost );
564
569
} catch (IndexerException ex ) {
565
570
log .log (Level .SEVERE , "Exception running indexer" , ex );
@@ -577,8 +582,14 @@ public static void main(String argv[]) {
577
582
578
583
}
579
584
580
- // PMD wants us to use length() > 0 && charAt(0) instead of startsWith()
581
- // for performance. We prefer clarity over performance here, so silence it.
585
+ /*
586
+ * This is the first phase of the indexing where history cache is being
587
+ * generated for repositories (at least for those which support getting
588
+ * history per directory).
589
+ *
590
+ * PMD wants us to use length() > 0 && charAt(0) instead of startsWith()
591
+ * for performance. We prefer clarity over performance here, so silence it.
592
+ */
582
593
@ SuppressWarnings ("PMD.SimplifyStartsWith" )
583
594
public void prepareIndexer (RuntimeEnvironment env ,
584
595
boolean searchRepositories ,
@@ -743,9 +754,16 @@ public int compare(Project p1, Project p2) {
743
754
}
744
755
}
745
756
757
+ /*
758
+ * This is the second phase of the indexer which generates Lucene index
759
+ * by passing source code files through Exuberant ctags, generating xrefs
760
+ * and storing data from the source files in the index (along with history,
761
+ * if any).
762
+ */
746
763
public void doIndexerExecution (final boolean update , int noThreads , List <String > subFiles ,
747
764
IndexChangedListener progress )
748
765
throws IOException {
766
+ long start = System .currentTimeMillis ();
749
767
RuntimeEnvironment env = RuntimeEnvironment .getInstance ().register ();
750
768
log .info ("Starting indexing" );
751
769
@@ -826,7 +844,10 @@ public void run() {
826
844
log .log (Level .SEVERE ,
827
845
"destroying of renamed thread pool failed" , ex );
828
846
}
829
- log .info ("Done indexing" );
847
+ long stop = System .currentTimeMillis ();
848
+ String time_str = StringUtils .getReadableTime (stop - start );
849
+ log .log (Level .INFO , "Done indexing data of all repositories (took {0})" ,
850
+ time_str );
830
851
}
831
852
832
853
public void sendToConfigHost (RuntimeEnvironment env , String configHost ) {
0 commit comments