zhiqiang-hhhh commented on code in PR #33690: URL: https://github.com/apache/doris/pull/33690#discussion_r1686700162
########## fe/fe-core/src/main/java/org/apache/doris/common/util/ProfileManager.java: ########## @@ -255,17 +247,26 @@ public List<List<String>> getAllQueries() { return getQueryWithType(null); } + // The init value of query finish time of profile is MIN_VALUE + // So more recent query will be on the top of heap + private PriorityQueue<ProfileElement> getQueryOrderByQueryFinishTime() { + PriorityQueue<ProfileElement> queryIdDeque = new PriorityQueue<>(Comparator.comparingLong( + (ProfileElement profileElement) -> profileElement.profile.getQueryFinishTimestamp())); + + queryIdToProfileMap.forEach((queryId, profileElement) -> { + queryIdDeque.add(profileElement); + }); + + return queryIdDeque; + } + public List<List<String>> getQueryWithType(ProfileType type) { Review Comment: fixd -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org