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)
if __name__ == '__main__': RUNTIME = 60 channelName = 'X1' c = Channel(channelName) print('CONNECT TO %s:\n%s\n' % (channelName, c.get())) m = ScaleMonitor(channelName) c.subscribe('m', m.monitor) # Monitor print('STARTING MONITOR for X1\n') c.startMonitor() time.sleep(10) print('SUBSCRIBE M2 for X1\n') c.subscribe('m2', m.monitor2) time.sleep(10) c.unsubscribe('m2') print('UNSUBSCRIBE M2 for X1\n') time.sleep(10) print('SUBSCRIBE M2 for X1\n') c.subscribe('m2', m.monitor2) time.sleep(10) c.unsubscribe('m2') print('UNSUBSCRIBE M2 for X1\n') time.sleep(RUNTIME) c.stopMonitor() print('STOP MONITOR for X1\n') print('FINAL STATS:') print(m.toString())