Statistiques
| Révision :

root / pobysoPythonSage / src / ppsTestFunctions.sage @ 160

Historique | Voir | Annoter | Télécharger (733 octet)

1
"""
2
@file ppsTestFunctions.sage
3

    
4
Module for functions used in all sorts of tests.
5

    
6
AUTHORS:
7
- S.T. (2015-05-03): initial version
8

    
9
TODO:
10
- almost everything!
11

    
12
"""
13
print "ppsTestFunctions loading..."
14
import inspect
15
import resource
16
import timeit
17

    
18

    
19
def pps_memory_usage():
20
    rusage_denom = RR("1024")
21
    if sys.platform == 'darwin':
22
        # ... it seems that in OSX the output is different units ...
23
        rusage_denom = rusage_denom * rusage_denom
24
    mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / rusage_denom
25
    return mem
26
# End memory_usage_resource()
27

    
28
def pps_test_wrapper(func, *args, **kwargs):
29
    def wrapped():
30
        return func(*args, **kwargs)
31
    return wrapped
32

    
33
print "\t...ppsTestFunctions loaded"
34