diff options
| author | bd <bdunahu@operationnull.com> | 2025-06-09 19:16:37 -0400 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2025-06-09 19:16:37 -0400 |
| commit | 5d7f40a890a1a1dd6dc7dc2982308932ba86cc42 (patch) | |
| tree | 3ff61edbe6d7b4677312b22ef6984ad9cbc2eafb /tests/simult.py | |
| parent | 37e0520970e601a8342b2fa247e2ea710926a454 (diff) | |
Add naive async profiling functionality and proof of concept program
Diffstat (limited to 'tests/simult.py')
| -rw-r--r-- | tests/simult.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/simult.py b/tests/simult.py index 6228596..61a3792 100644 --- a/tests/simult.py +++ b/tests/simult.py @@ -1,14 +1,20 @@ import asyncio +import time -async def count(): - print("before") - await asyncio.sleep(1) - print("after") +async def count(x): + i = 0 + await asyncio.sleep(2) + while i < 100000: + z = x * x + z = z * z + z = z * z + i += 1 + return z async def main(): - await asyncio.gather(count(), count(), count()) + await asyncio.gather(count(1), count(2), count(3)) print("done") asyncio.run(main()) |
