mgedmin / mgedmin/profilehooks
using profilehooks with classes derived from multiprocessing.Process
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 338
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Is there some way to use profilehooks to profile the body of a class derived from multiprocessing.Process? The following code doesn't seem to report any function calls:
```python
import multiprocessing as mp
from profilehooks import profile
import numpy as np
class MyProcess(mp.Process):
def __init__(self, x):
super(MyProcess, self).__init__()
self.x = x
@profile
def run(self):
return np.linalg.pinv(self.x)
if __name__ == '__main__':
p = MyProcess(np.random.rand(100, 100))
p.start()
```
(One can obviously profile the contents of the run() method using profile/cProfile directly, but I'm curious whether the the convenience of profilehooks can be exploited in the above situation.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided multiprocessing example and inspect profilehooks' profile decorator alongside how multiprocessing.Process invokes run(). Determine why the child process produces no profiling calls; done means the example reports calls from the Process subclass body, with coverage for the behavior if the repository has relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100