Show More
@@ -23,6 +23,11 b' import time' | |||
|
23 | 23 | # If possible (Unix), use the resource module instead of time.clock() |
|
24 | 24 | try: |
|
25 | 25 | import resource |
|
26 | except ImportError: | |
|
27 | resource = None | |
|
28 | ||
|
29 | # Some implementations (like jyputerlite) don't have getrusage | |
|
30 | if resource is not None and hasattr(resource, "getrusage"): | |
|
26 | 31 | def clocku(): |
|
27 | 32 | """clocku() -> floating point number |
|
28 | 33 | |
@@ -56,7 +61,9 b' try:' | |||
|
56 | 61 | |
|
57 | 62 | Similar to clock(), but return a tuple of user/system times.""" |
|
58 | 63 | return resource.getrusage(resource.RUSAGE_SELF)[:2] |
|
59 | except ImportError: | |
|
64 | ||
|
65 | ||
|
66 | else: | |
|
60 | 67 | # There is no distinction of user/system time under windows, so we just use |
|
61 | 68 | # time.perff_counter() for everything... |
|
62 | 69 | clocku = clocks = clock = time.perf_counter |
General Comments 0
You need to be logged in to leave comments.
Login now