public Map<Long, ThroughputInfo> listTimelineThroughput(TimelineThroughputCondition condition) {
        Assert.assertNotNull(condition);
        Map<Long, ThroughputInfo> throughputInfos = new LinkedHashMap<Long, ThroughputInfo>();
        List<ThroughputStatDO> throughputStatDOs = throughputDao.listTimelineThroughputStat(condition);
        int size = throughputStatDOs.size();
        int k = size - 1;
        for (Long i = condition.getStart().getTime(); i <= condition.getEnd().getTime(); i += 60 * 1000) {
            ThroughputInfo throughputInfo = new ThroughputInfo();
            List<ThroughputStat> throughputStat = new ArrayList<ThroughputStat>();
            // 取出每个时间点i以内的数据，k是一个游标，每次遍历时前面已经取过了的数据就不用再遍历了
            for (int j = k; j >= 0; --j) {
                if ((i - throughputStatDOs.get(j).getEndTime().getTime() <= 60 * 1000)
                    && (i - throughputStatDOs.get(j).getEndTime().getTime() >= 0)) {
                    throughputStat.add(throughputStatDOToModel(throughputStatDOs.get(j)));
                    k = j - 1;
                }// 如果不满足if条件，则后面的数据也不用再遍历
                else {
                    break;
                }
            }
            if (throughputStat.size() > 0) {
                throughputInfo.setItems(throughputStat);
                throughputInfo.setSeconds(1 * 60L);
                throughputInfos.put(i, throughputInfo);
            }

        }
        return throughputInfos;
    }
public Map < Long , ThroughputInfo > listTimelineThroughput ( TimelineThroughputCondition condition ) { Assert . assertNotNull ( condition ) ; Map < Long , ThroughputInfo > throughputInfos = new LinkedHashMap < Long , ThroughputInfo > ( ) ; List < ThroughputStatDO > throughputStatDOs = throughputDao . listTimelineThroughputStat ( condition ) ; int size = throughputStatDOs . size ( ) ; int k = size - 1 ; for ( Long i = condition . getStart ( ) . getTime ( ) ; i <= condition . getEnd ( ) . getTime ( ) ; i += 60 * 1000 ) { ThroughputInfo throughputInfo = new ThroughputInfo ( ) ; List < ThroughputStat > throughputStat = new ArrayList < ThroughputStat > ( ) ; for ( int j = k ; j >= 0 ; -- j ) { if ( ( i - throughputStatDOs . get ( j ) . getEndTime ( ) . getTime ( ) <= 60 * 1000 ) && ( i - throughputStatDOs . get ( j ) . getEndTime ( ) . getTime ( ) >= 0 ) ) { throughputStat . add ( throughputStatDOToModel ( throughputStatDOs . get ( j ) ) ) ; k = j - 1 ; } else { break ; } } if ( throughputStat . size ( ) > 0 ) { throughputInfo . setItems ( throughputStat ) ; throughputInfo . setSeconds ( 1 * 60L ) ; throughputInfos . put ( i , throughputInfo ) ; } } return throughputInfos ; }
<pre>
列出pipeLineId下，start-end时间段下的throughputStat
首先从数据库中取出这一段时间所以数据，该数据都是根据end_time倒排序的, 每隔1分钟将这些数据分组
</pre>