Commit ee63c939 authored by tammam.alsoleman's avatar tammam.alsoleman

edit to show the execution time

parent eb5ae0d6
...@@ -50,7 +50,7 @@ public class SearchClient { ...@@ -50,7 +50,7 @@ public class SearchClient {
if (stubs.isEmpty()) { if (stubs.isEmpty()) {
return Collections.emptyList(); return Collections.emptyList();
} }
long startTime = System.currentTimeMillis();
// Phase 1: Aggregate Global Counts // Phase 1: Aggregate Global Counts
Map<String, Integer> globalTermCounts = new HashMap<>(); Map<String, Integer> globalTermCounts = new HashMap<>();
int filesPerWorker = (int) Math.ceil((double) allFiles.size() / stubs.size()); int filesPerWorker = (int) Math.ceil((double) allFiles.size() / stubs.size());
...@@ -101,7 +101,8 @@ public class SearchClient { ...@@ -101,7 +101,8 @@ public class SearchClient {
} catch (Exception e) { System.err.println("Worker " + address + " Phase 2 error"); } } catch (Exception e) { System.err.println("Worker " + address + " Phase 2 error"); }
currentFileIndex += count; currentFileIndex += count;
} }
long endTime = System.currentTimeMillis();
System.out.println(">>> Distributed Search took: " + (endTime - startTime) + " ms");
// --- return the sorted list --- // --- return the sorted list ---
finalResults.sort((a, b) -> Double.compare(b.getScore(), a.getScore())); finalResults.sort((a, b) -> Double.compare(b.getScore(), a.getScore()));
return finalResults; return finalResults;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment