ENH: Profiler follow up#53
Conversation
|
Reverting to draft because there are more follow-ups that can be addressed! |
|
I think this resolves everything that can be handled quickly. |
|
On my windows box I was able to run with All of the previously problematic submodules are silently skipped. |
| # I can't believe I'm catching SystemExit and preventing it. | ||
| # But this is just an import. It should be OK. | ||
| # Instead of a basic except Exception, we need to do this | ||
| # But make sure to allow a KeyBoardInterrupt |
There was a problem hiding this comment.
I'm sorry this PR made you do such horrible things :(
There was a problem hiding this comment.
Forgive me, for I have sinned
tangkong
left a comment
There was a problem hiding this comment.
Looks good to me, I'm excited to use it out in the field.
klauer
left a comment
There was a problem hiding this comment.
This looks clean to me. I like the new functionality.
The only recommendation I have is that a save_results that takes a file-like object would be useful from an API standpoint. It would allow for using in-memory StringIO, easier testing, and so on.
And then I believe print_results and save_results_to_file effectively then rely on the same underlying code (as sys.stdout, sys.stderr, and open() as fp are all output streams/file-like objects)
|
Yeah, I can do that- that's how py-spy's api is under the hood too. |
Description
profiler_contextuse a non-global profiler by defaultMotivation and Context
I want to keep this easy to use while not locking the use case into "call this one time only please"
How Has This Been Tested?
Interactively only
Where Has This Been Documented?
docstrings only