Example #1
0
def grind(func, n, threshold=10):
    mperc, m0 = get_mem_usage()

    g = Graph()
    for i in xrange(n):
        func()
        
    mperc, m1 = get_mem_usage()
    
    print m0, m1
    assert m1 <= m0+threshold
Example #2
0
def grind(func, n, threshold=10):
    mperc, m0 = get_mem_usage()

    g = Graph()
    for i in xrange(n):
        func()
        
    mperc, m1 = get_mem_usage()
    
    print m0, m1
    #assert m1 - m0 < n/1024 #the difference between the two memories is less than 1 byte*number of iterations
    assert m1 <= m0+threshold
Example #3
0
def grind(func, n, threshold=10):
    mperc, m0 = get_mem_usage()

    g = Graph()
    for i in xrange(n):
        func()
        
    mperc, m1 = get_mem_usage()
    
    print m0, m1
    #assert m1 - m0 < n/1024 #the difference between the two memories is less than 1 byte*number of iterations
    assert m1 <= m0+threshold