示例#1
0
文件: ethdrv.py 项目: ikozhukhov/oTTo
def list_stats(l):
    stats = '\tsamples:%s' % len(l)
    stats += '\taverage:%s' % timefmt(average(l))
    stats += '\tstddev:%s' % timefmt(standard_dev(l))
    stats += '\tmax:%s' % max(l)
    stats += '\tmin:%s' % min(l)
    return stats
示例#2
0
文件: ethdrv.py 项目: mennis/oTTo
def list_stats(l):
    stats = '\tsamples:%s' % len(l)
    stats += '\taverage:%s' % timefmt(average(l))
    stats += '\tstddev:%s' % timefmt(standard_dev(l))
    stats += '\tmax:%s' % max(l)
    stats += '\tmin:%s' % min(l)
    return stats
示例#3
0
    def reconnect(self, after=10, timeout=None, nolog=False):
        """
        reconnect to the host::

            after how long to wait for the first attempt
            timeout how long to wait for each attempt

        """
        # default to this instance's current value
        if timeout is None:
            timeout = self.timeout

        self.close()
        start = now()
        while 1:
            sleep(after)
            try:
                if self.connect(timeout=timeout, nolog=nolog):
                    break
            except (TIMEOUT, EOF) as e:
                self.close()
                if not nolog:
                    logger.debug(str(e))
        logger.debug("reconnected after %s" % timefmt(since(start)))
        return True
示例#4
0
    def reconnect(self, after=10, timeout=None, nolog=False):
        """
        reconnect to the host::

            after how long to wait for the first attempt
            timeout how long to wait for each attempt

        """
        # default to this instance's current value
        if timeout is None:
            timeout = self.timeout

        self.close()
        start = now()
        while 1:
            sleep(after)
            try:
                if self.connect(timeout=timeout, nolog=nolog):
                    break
            except (TIMEOUT, EOF) as e:
                self.close()
                if not nolog:
                    logger.debug(str(e))
        logger.debug("reconnected after %s" % timefmt(since(start)))
        return True