feat: 事件能耗估计时间排序

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-28 20:18:44 +08:00
parent a0cb9c2ca7
commit 2e9419a376
2 changed files with 2 additions and 2 deletions

View File

@ -151,7 +151,7 @@ public class MonitorCommand implements CommandExecutor {
}
}
sender.sendMessage(mieprefix);
for (final String event : eventTotalTime.keySet()) {
for (final String event : MonitorManager.sortMapByValue(eventTotalTime).keySet()) {
final double avgTime = eventTotalTime.get(event) / um / eventCount.get(event);
sender.sendMessage(String.format(avgTime < 10 ? milist : miwlist, event, eventTotalTime.get(event) / um, eventCount.get(event), avgTime));
}

View File

@ -134,7 +134,7 @@ public class MonitorManager {
*/
public static Map<String, Long> sortMapByValue(final Map<String, Long> oriMap) {
if (oriMap == null || oriMap.isEmpty()) {
return null;
return oriMap;
}
final Map<String, Long> sortedMap = new LinkedHashMap<String, Long>();
final List<Map.Entry<String, Long>> entryList = new ArrayList<Map.Entry<String, Long>>(oriMap.entrySet());