Include CPU time.
This commit is contained in:
parent
a3e02f14c9
commit
5266adefce
|
@ -8,7 +8,7 @@ TODO Parameterization (pytest?)
|
||||||
- Number of needed/happy/total shares.
|
- Number of needed/happy/total shares.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from time import time
|
from time import time, process_time
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
from twisted.trial.unittest import TestCase
|
from twisted.trial.unittest import TestCase
|
||||||
|
@ -22,10 +22,11 @@ from allmydata.immutable.upload import Data as UData
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def timeit(name):
|
def timeit(name):
|
||||||
start = time()
|
start = time()
|
||||||
|
start_cpu = process_time()
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
print(f"{name}: {time() - start:.3f}")
|
print(f"{name}: {time() - start:.3f} elapsed, {process_time() - start_cpu:.3f} CPU")
|
||||||
|
|
||||||
|
|
||||||
class ImmutableBenchmarks(SystemTestMixin, TestCase):
|
class ImmutableBenchmarks(SystemTestMixin, TestCase):
|
||||||
|
|
Loading…
Reference in New Issue