public static LinkedHashMap<String, Long> getProcessRate(List<ProcessTime> models) {
Collections.sort(models, new Comparator(){
@Override
public int compare(Object o1, Object o2) {
ProcessTime p1=(ProcessTime)o1;
ProcessTime p2=(ProcessTime)o2;
return (int) (p1.getStartTime().getTime()-p2.getStartTime().getTime());
}
});
LinkedHashMap<String,Long> data=new LinkedHashMap<>();
if(models.size()<1){
return data;
}
ProcessTime first=models.get(0);
ProcessTime latest=models.get(models.size()-1);
LOG.debug("首次请求时间:"+DateTypeConverter.toDefaultDateTime(first.getStartTime()));
LOG.debug("最后请求时间:"+DateTypeConverter.toDefaultDateTime(latest.getEndTime()));
long totalTime=latest.getEndTime().getTime()-first.getStartTime().getTime();
LOG.debug("系统总时间:"+latest.getEndTime().getTime()+"-"+first.getStartTime().getTime()+"="+totalTime);
long processTime=0;
for(ProcessTime item : models){
LOG.debug(" 增加请求处理时间:"+item.getProcessTime());
processTime+=item.getProcessTime();
}