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)
runtime = 60 nChannels = 1 if len(sys.argv) > 1: nChannels = int(sys.argv[1]) if len(sys.argv) > 2: runtime = float(sys.argv[2]) outputMark = int(runtime / 5) channelMap = OrderedDict() 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)
deltaT = currentTime - self.startTime self.receiveRateHz = self.nReceived / deltaT self.percentageMissed = self.nMissed / (self.nReceived + self.nMissed) * 100.0 if self.nReceived % 10 == 0: print(self.toString()) 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)