Ejemplo n.º 1
0
def prepareScale( npArrScale, options ):

    result = [''] * options.resolution
    tmpscale = []

    for i, date in enumerate(npArrScale):
        tmpscale.append(date[0])
    
    # print tmpscale

    options.scaleEvery = min(options.scaleEvery, options.resolution )

    #########################################################################################
    # Methode 2
    padding = len(npArrScale)/options.scaleEvery
    dayChanged = False
    for i, date in enumerate(tmpscale):
        # print "i: %d - %s " % (i, date)

        
        if i==0:
            result[i] = date.strftime("%m-%d %H:%M")
        else:

            if date.date() != tmpscale[i-1].date():
                # print "change date at index: %d = %s" % (i,date.strftime("%m-%d %H:%M"))
                dayChanged = True

            if i%padding == 0:
                rounded = roundTime(date,options.scaleRound)

                if dayChanged:
                    result[i] = rounded.strftime('%m-%d %H:%M')
                else:
                    result[i] = rounded.strftime('%H:%M')

                dayChanged = False

    result[-1] = tmpscale[-1].strftime("%m-%d %H:%M")

    return result
Ejemplo n.º 2
0
    count_IncomingDelete = 0
    count_AddGraphs = 0
    count_AddRns = 0
    count_UpdateCommands = 0

    with open( sourceFile , 'r') as f:
        statsReader = csv.reader(f,delimiter=';')
        
        for i,row in enumerate(statsReader):
            timestamp = float(row[0])

            if startDate < timestamp and timestamp <= endDate :

                date = datetime.datetime.fromtimestamp( timestamp )
                previousEventDate = eventDate
                eventDate = roundTime(date, options.resolution)

                # print " %r - %r = %r" % (eventDate, previousEventDate, (eventDate-previousEventDate)

                # Get average values of timers for the selected timer resolution
                avg_update_tree = ( avg_update_tree + float(row[1])*1000 ) / 2
                avg_update_rn = ( avg_update_rn + float(row[2])*1000 ) / 2
                avg_update_dependencies = ( avg_update_dependencies + float(row[3])*1000 ) / 2
                avg_update_db = ( avg_update_db + float(row[4])*1000 ) / 2
                avg_compute_assignment = ( avg_compute_assignment + float(row[5])*1000 ) / 2
                avg_send_assignment = ( avg_send_assignment + float(row[6])*1000 ) / 2
                avg_release_finishing = ( avg_release_finishing + float(row[7])*1000 ) / 2
                avg_time_elapsed = ( avg_time_elapsed + float(row[8])*1000 ) / 2

                # Sum number of event for the selected time resolution
                count_IncomingRequest += int(row[9])
Ejemplo n.º 3
0
    count_IncomingDelete = 0
    count_AddGraphs = 0
    count_AddRns = 0
    count_UpdateCommands = 0

    with open(sourceFile, 'r') as f:
        statsReader = csv.reader(f, delimiter=';')

        for i, row in enumerate(statsReader):
            timestamp = float(row[0])

            if startDate < timestamp and timestamp <= endDate:

                date = datetime.datetime.fromtimestamp(timestamp)
                previousEventDate = eventDate
                eventDate = roundTime(date, options.resolution)

                # print " %r - %r = %r" % (eventDate, previousEventDate, (eventDate-previousEventDate)

                # Get average values of timers for the selected timer resolution
                avg_update_tree = (avg_update_tree + float(row[1]) * 1000) / 2
                avg_update_rn = (avg_update_rn + float(row[2]) * 1000) / 2
                avg_update_dependencies = (avg_update_dependencies +
                                           float(row[3]) * 1000) / 2
                avg_update_db = (avg_update_db + float(row[4]) * 1000) / 2
                avg_compute_assignment = (avg_compute_assignment +
                                          float(row[5]) * 1000) / 2
                avg_send_assignment = (avg_send_assignment +
                                       float(row[6]) * 1000) / 2
                avg_release_finishing = (avg_release_finishing +
                                         float(row[7]) * 1000) / 2