コード例 #1
0
ファイル: ServerStats.py プロジェクト: wallydz/BitBlinder
def _update_statistics(cur, startTime, intervalLen, statTypes):
    """Update all statistics with the most recent events from the database"""
    currentTime = DBUtil.get_current_gmtime()
    intervalStartTime = startTime - (startTime % intervalLen)
    #for each type of stat:
    for statType in statTypes:
        #for each interval:
        for period in range(intervalStartTime, currentTime, intervalLen):
            #calculate the statistic
            stat = statType(period, period + intervalLen)
            stat.calculate(cur)
            #update it in the database
            stat.update(cur)
コード例 #2
0
ファイル: ServerStats.py プロジェクト: clawplach/BitBlinder
def _update_statistics(cur, startTime, intervalLen, statTypes):
  """Update all statistics with the most recent events from the database"""
  currentTime = DBUtil.get_current_gmtime()
  intervalStartTime = startTime - (startTime % intervalLen)
  #for each type of stat:
  for statType in statTypes:
    #for each interval:
    for period in range(intervalStartTime, currentTime, intervalLen):
      #calculate the statistic
      stat = statType(period, period+intervalLen)
      stat.calculate(cur)
      #update it in the database
      stat.update(cur)