• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(12)  |  Call(12)  |  Derive(0)  |  Import(0)
No Document.

src/p/y/pyutil-1.7.12/pyutil/benchutil.py   pyutil(Download)
def rep_bench(func, n, initfunc=None, MAXREPS=10, MAXTIME=60.0, profile=False, profresults="pyutil-benchutil.prof", UNITS_PER_SECOND=1):
    """
    Will run the func up to MAXREPS times, but won't start a new run if MAXTIME
    (wall-clock time) has already elapsed (unless MAXTIME is None).
    """
    assert isinstance(n, int), (n, type(n))
    starttime = time.realtime()
    tls = [] # elapsed time in nanoseconds
    while ((len(tls) < MAXREPS) or (MAXREPS is None)) and ((MAXTIME is None) or ((time.realtime() - starttime) < MAXTIME)):
def bench_it(func, n, profile=False, profresults="pyutil-benchutil.prof"):
    if profile:
        st = time.realtime()
        cProfile.run('func(n)', profresults)
        sto = time.realtime()
    else:
        st = time.realtime()
        func(n)
        sto = time.realtime()
    timeelapsed = sto - st
    if timeelapsed <= 0:
        raise BadMeasure(timeelapsed)
    global worstemptymeasure
    emsta = time.realtime()
    global worstemptymeasure
    emsta = time.realtime()
    do_nothing(2**32)
    emstop = time.realtime()
    empty = emstop - emsta
    if empty > worstemptymeasure:
        worstemptymeasure = empty

src/a/l/allmydata-tahoe-1.8.0/src/allmydata/util/repeatable_random.py   allmydata-tahoe(Download)
 
        if SEED is None:
            # Generate a seed which is integral and fairly short (to ease cut-and-paste, writing it down, etc.).
            t = time.realtime()
            subsec = t % 1
            t += (subsec * 1000000)
            t %= 1000000

src/p/y/pyutil-1.7.12/pyutil/repeatable_random.py   pyutil(Download)
 
        if SEED is None:
            # Generate a seed which is integral and fairly short (to ease cut-and-paste, writing it down, etc.).
            t = time.realtime()
            subsec = t % 1
            t += (subsec * 1000000)
            t %= 1000000

src/p/y/pyutil-1.7.12/pyutil/testutil.py   pyutil(Download)
            import repeatable_random
            repeatable_random.force_repeatability()
        if hasattr(time, 'realtime'):
            self.teststarttime = time.realtime()
        else:
            self.teststarttime = time.time()
 

src/a/l/allmydata-tahoe-1.8.0/src/allmydata/test/common_util.py   allmydata-tahoe(Download)
            import repeatable_random
            repeatable_random.force_repeatability()
        if hasattr(time, 'realtime'):
            self.teststarttime = time.realtime()
        else:
            self.teststarttime = time.time()