コード例 #1
0
    print('STARTING MONITORS\n')
    t0 = time.time()
    channelCount = 0
    for cName, (c, m) in channelMap.items():
        print('STARTING MONITOR for %s\n' % (cName))
        c.startMonitor()
        channelCount += 1
        if channelCount % 1000 == 0:
            time.sleep(1)
        #if channelCount > 90000 and channelCount % 100 == 0:
        #    time.sleep(60)
    print('START MONITORS at %s\n' % t0)
    time.sleep(runtime)

    for cName, (c, m) in channelMap.items():
        c.stopMonitor()
    t1 = time.time()
    deltaT = t1 - t0
    print('STOP MONITORS at %s\n' % t1)

    print('FINAL STATS:')
    totalReceived = 0
    totalMissed = 0
    for cName, (c, m) in channelMap.items():
        print(m.toString())
        totalReceived += m.nReceived
        totalMissed += m.nMissed
    receiveRateHz = totalReceived / deltaT
    percentageMissed = 0.0
    if totalReceived + totalMissed > 0:
        percentageMissed = totalMissed / (totalReceived + totalMissed) * 100.0