Beispiel #1
0
    for channelCnt in range(1, nChannels + 1):
        channelName = 'X%s' % channelCnt
        #c = Channel(channelName, CA)
        c = Channel(channelName)
        #print('CONNECT TO %s:\n%s\n' % (channelName, c.get()))
        m = ScaleMonitor(channelName, outputMark)
        c.subscribe('m%s' % channelName, m.monitor)
        channelMap[channelName] = (c, m)

    # Monitor
    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:')
Beispiel #2
0
        dataRate = self.arraySize * self.nReceivedArrays / float(
            MEGA_BYTE) / deltaT
        averageMissed = self.nTotalMissedArrays / float(self.nReceivedArrays)
        self.missedArraysStats.add(nMissedArrays)
        if self.nReceivedArrays % 100 == 0:
            print 'NTNDARRAY ID %s; Arrays Missed: %s (Average Missed Per Cycle: %s, Max. Missed Per Cycle: %s, Total Missed: %s), Total Received: %s; Array Receiving Rate: %s [Hz], Data Receiving Rate: %s [MB/s]; Runtime: %s [s]' % (
                arrayId, nMissedArrays, averageMissed, self.maxMissedArrays,
                self.nTotalMissedArrays, self.nReceivedArrays, arrayRate,
                dataRate, deltaT)
            self.missedArraysStats.calculate()
            print self.missedArraysStats
            print


if __name__ == '__main__':
    maxQueueSize = 10
    c = Channel('srfb_ndarray')
    c.setMonitorMaxQueueLength(maxQueueSize)
    for i in range(0, 100):
        print "TEST: ", i
        srfbMonitor = SrfbMonitor(10 * (maxQueueSize + 1))
        c.subscribe('monitor', srfbMonitor.monitor)
        c.startMonitor('')
        time.sleep(10)
        print "Stopping monitor"
        c.stopMonitor()
        print "Unsubscribing monitor"
        c.unsubscribe('monitor')
        print "TEST: ", i, " DONE"
        time.sleep(3)