Skip to content

Commit 1a2c2a9

Browse files
committed
timer
1 parent c563b43 commit 1a2c2a9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

server/src/main/java/org/opensearch/search/aggregations/bucket/terms/InternalTerms.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ For backward compatibility, we disable the merge sort and use ({@link InternalTe
458458
}
459459
final B[] list;
460460
if (reduceContext.isFinalReduce() || reduceContext.isSliceLevel()) {
461+
long startTime = System.nanoTime();
461462
final int size = Math.min(localBucketCountThresholds.getRequiredSize(), reducedBuckets.size());
462463

463464
Comparator<MultiBucketsAggregation.Bucket> cmp = order.comparator();
@@ -504,6 +505,9 @@ For backward compatibility, we disable the merge sort and use ({@link InternalTe
504505
list = createBucketsArray(selectSize);
505506
if (selectSize >= 0) System.arraycopy(reducedBucketsFinal, 0, list, 0, selectSize);
506507
Arrays.sort(list, cmp);
508+
long endTime = System.nanoTime();
509+
long duration = endTime - startTime;
510+
System.out.println("Method took: " + duration / 1_000_000 + " milliseconds");
507511
} else {
508512
// we can prune the list on partial reduce if the aggregation is ordered by key
509513
// and not filtered (minDocCount == 0)

0 commit comments

Comments
 (0)