Esempio n. 1
0
 def __init__(self, adminAddr, transport):
     self._adminAddr   = adminAddr
     self.transport    = transport
     self._addrManager = ActorAddressManager(adminAddr, self.transport.myAddress)
     self.transport.setAddressManager(self._addrManager)
     self._pendingTransmits = PendingTransmits(self._addrManager)
     self._awaitingAddressUpdate = AddressWaitTransmits()
     self._receiveQueue = []  # array of ReceiveMessage to be processed
     self._children = []  # array of Addresses of children of this Actor/Admin
     self._governer = RateThrottle(RATE_THROTTLE)
     self._sCBStats = StatsManager()
Esempio n. 2
0
def send_at_rate(max_rate, actual_rate, total_count):  # return timedelta
    rt = RateThrottle(max_rate)
    deltaT = (1.0 / actual_rate) * 1000 * 1000  # microseconds
    startT = datetime.now()
    for each in range(int(total_count)):
        tick = datetime.now()
        rt.eventRatePause()
        tock = datetime.now()
        elapsed = timeDiffuSec(tick, tock)
        if elapsed < deltaT:
            sleep((deltaT - elapsed) / 1000.0 / 1000.0)
    finalT = datetime.now()
    return finalT - startT
Esempio n. 3
0
 def __init__(self, adminAddr, transport):
     self._adminAddr = adminAddr
     self.transport = transport
     self._addrManager = ActorAddressManager(adminAddr,
                                             self.transport.myAddress)
     self.transport.setAddressManager(self._addrManager)
     self._finalTransmitPending = {
     }  # key = target ActorAddress, value=None or the last pending Intent
     self._awaitingAddressUpdate = {
     }  # key = actorAddress waited on (usually local), value=array of transmit Intents
     self._receiveQueue = []  # array of ReceiveMessage to be processed
     self._children = [
     ]  # array of Addresses of children of this Actor/Admin
     self._governer = RateThrottle(RATE_THROTTLE)
     self._sCBStats = StatsManager()