From 61b9858e52c71f9b04452d09a350e5f3a0d26d28 Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 27 Jul 2025 16:00:13 -0600 Subject: Partial solution to tracing all lines (coroutines calling methods) --- t/test_yappi_adaptations.py | 1 + t/utils.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 't') 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) diff --git a/t/utils.py b/t/utils.py index 4dde466..ee9478d 100644 --- a/t/utils.py +++ b/t/utils.py @@ -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) -- cgit v1.2.3