mgedmin / mgedmin/profilehooks
It don't work in async.
- Dominant language
- Python
- Stars
- 338
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
If use the example:
```PYTHON
async def say_after(delay, what):
await asyncio.sleep(delay)
print(what)
async def main():
task1 = asyncio.create_task(
say_after(1, 'hello'))
task2 = asyncio.create_task(
say_after(2, 'world'))
print(f"started at {time.strftime('%X')}")
await task2
await task1
print(f"finished at {time.strftime('%X')}")
asyncio.run(main())
```
No matter whether I use say_after or main, it always outputs:
```
C:\ProgramData\anaconda3\envs\python311\python.exe C:\Users\Administrator\Personal_scripts\pythonProject\temp.py
started at 03:10:59
hello
world
finished at 03:11:01
*** PROFILER RESULTS ***
say_after (C:\Users\Administrator\Personal_scripts\pythonProject\temp.py:39)
function called 2 times
2 function calls in 0.000 seconds
Ordered by: cumulative time, internal time, call count
ncalls tottime percall cumtime percall filename:lineno(function)
2 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
0 0.000 0.000 profile:0(profiler)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the reported behavior using the async say_after and main example in the issue and inspect the profiler output shown for say_after. Determine what profiling result is expected for these async entry points, then verify that the completed behavior records the coroutine activity rather than only the two function calls displayed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100