diff options
Diffstat (limited to 't')
| -rw-r--r-- | t/test_yappi_adaptations.py | 1 | ||||
| -rw-r--r-- | t/utils.py | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/t/test_yappi_adaptations.py b/t/test_yappi_adaptations.py index 7f034ef..a8b4212 100644 --- a/t/test_yappi_adaptations.py +++ b/t/test_yappi_adaptations.py @@ -15,6 +15,7 @@ class YappiTests(utils.AergiaUnitTestCase): if n <= 0: return await asyncio.sleep(delay) + utils.burn_cpu(0.1) await a(n - 1) await a(n - 2) @@ -1,5 +1,6 @@ from aergia.aergia import Aergia import yappi +import time import unittest @@ -63,3 +64,16 @@ class AergiaUnitTestCase(unittest.TestCase): for s in stats: if s.name == func_name: return s.ttot + + +def burn_cpu(sec): + t0 = Aergia._gettime() + elapsed = 0 + while (elapsed < sec): + for _ in range(1000): + pass + elapsed = Aergia._gettime() - t0 + + +def burn_io(sec): + time.sleep(sec) |
