@@ -83,10 +83,10 @@ final class ReconMutil {
8383 // Progress counters:
8484 int readEvents ;
8585 int writeEvents ;
86- AtomicInteger taggedEvents ;
8786 int failEvents ;
8887 int fileEvents ;
8988 int maxFileEvents ;
89+ AtomicInteger taggedEvents = new AtomicInteger ();
9090 ProgressPrintout progress = new ProgressPrintout ();
9191
9292 ReconMutil (OptionParser parser ) {
@@ -102,6 +102,8 @@ final class ReconMutil {
102102 void launch (int [] threads , String output , String ... input ) {
103103
104104 reset ();
105+
106+ System .out .println (String .format ("recon-mutil:: Spawning %d+++ Threads..." ,threads [0 ]));
105107
106108 // spawn all the threads:
107109 readerThread = CompletableFuture .runAsync (() -> { read (threads [0 ], input ); });
@@ -114,7 +116,12 @@ void launch(int[] threads, String output, String... input) {
114116
115117 // wait for the writer to be done:
116118 while (!writerThread .isDone ()) {
117- sleep (100 );
119+ sleep (1000 );
120+
121+ //System.out.println(String.format("recon-mutil:: read(%b)/[deco(%d)]/proc(%d)/tag/write(%b)",
122+ // readerThread.isDone(), decoThreads.size(), procThreads.size(), writerThread.isDone()));
123+ //System.out.println(String.format("recon-util:: %d-%d/%d/%d/%d", readEvents,
124+ // readQueue.size(), procQueue.size(), taggedEvents.get(), writeQueue.size()));
118125
119126 // cleanup completed parallel threads:
120127 for (CompletableFuture f : decoThreads )
@@ -129,11 +136,6 @@ void launch(int[] threads, String output, String... input) {
129136 reset ();
130137 }
131138 }
132-
133- //if (!parser.getOption("-P").isDefault()) {
134- // PostProcessor pp = new PostProcessor(parser.getInputList(), false, false);
135- // pp.processFile(output, output);
136- //}
137139 }
138140
139141 /**
@@ -155,7 +157,7 @@ void read(int threads, String... input) {
155157 if (reader != null ) {
156158
157159 // sleep instead of overfilling the read queue:
158- if (readQueue .size () > CHUNKS_PER_QUEUE *threads ) sleep (1000 );
160+ if (false ) sleep ( 100 ); // readQueue.size() > CHUNKS_PER_QUEUE*threads) sleep(1000);
159161
160162 // read next event into chunk, and fill queue if chunk full:
161163 else output = read (output );
@@ -215,6 +217,10 @@ void decode(int thread) {
215217 */
216218 void process (int thread ) {
217219 while (true ) {
220+ if (serial .getScalers ().size () < 10 || taggedEvents .get () < 100 ) {
221+ sleep (100 );
222+ continue ;
223+ }
218224 List <HipoDataEvent > input = procQueue .poll ();
219225 if (input == null ) {
220226 if (decoThreads .isEmpty () && procQueue .isEmpty () &&
@@ -232,9 +238,6 @@ void process(int thread) {
232238 Benchmark .getInstance ().pause (engine .getValue ().getName ());
233239 }
234240 Event e = input .get (i ).getHipoEvent ();
235- Benchmark .getInstance ().resume (thread ,"post" );
236- serial .process (e );
237- Benchmark .getInstance ().pause (thread ,"post" );
238241 output .add (e );
239242 }
240243 writeQueue .offer (output );
@@ -259,6 +262,9 @@ void write(String output) {
259262 }
260263 else {
261264 for (int i =0 ; i <e .size (); i ++) {
265+ Benchmark .getInstance ().resume ("post" );
266+ serial .process (e .get (i ));
267+ Benchmark .getInstance ().pause ("post" );
262268 Benchmark .getInstance ().resume ("write" );
263269 if (writer != null ) {
264270 if (e .get (i ).getEventTag () > 0 || schemaBankList .isEmpty ())
0 commit comments