-
Notifications
You must be signed in to change notification settings - Fork 56
Add --gzip option to cli #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jonashaag How do you think this approach? |
|
I'd like to have this available from the python API as well, not only CLI -- you'll have to implement it in the reader anyways (or in the uploaded and shower but then you might as well implement it in the reader) |
|
This pull request demonstrated that starting subprocess in Python doesn't have
You can add utility context manager which manage subprocess.
done. |
vmprof/__init__.py
Outdated
| proc = subprocess.Popen(pipecmd, bufsize=-1, stdin=subprocess.PIPE, stdout=of.fileno()) | ||
| fileno = proc.stdin.fileno() | ||
| enable(fileno, period, memory) | ||
| yield |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you have to use
try:
yield
finally:
disable()
...to account for the case that an exception is thrown in the profiled function.
That's not really an integration into vmprof. Of course you can always use Unix tools here, but it would be nice to integrate it directly into vmprof.
That's no good abstraction. The decorator has nothing to do with gzipping, i.e. both can live without the other. Why not simply use gzip all the time, and make it an implementation detail of the profile format? This way it should live in the |
|
Oh, I didn't thinking about tightly integrate compression. @fijal How do you think? |
|
You can always use Python for implementing a gzip "binary", that's the approach I used (but with C) |
|
I would prefer if the file was compressed in a way that is slightly more transparent (e.g. if you want to upload it, you need to ungzip it, then upload it, there is no support for reading). That said, this is a bike color - if you say "that's too much work" I'm happy to merge it as it is |
|
@fijal To make it transparent, which do you prefer?
|
|
Maybe we should move this discussion to #88 |
|
By sniffing the bytes. Generally speaking I want the reader to transparently recognize the format somehow. Working on windows would be a nice bonus (but not a blocker) |
|
Python is only required where there is no /usr/bin/gzip |
|
If I can ask for one thing, can you please come up with this in one pull request if possible? If not, I'll try to look them bit by bit, but e.g. #71 is closed, so I did not even consider it right now. I'm trying to undig myself from a gigantic pile of other work, so anything that simplifies reviewing would make the merge a lot faster, sorry for being so difficult :-/ |
Absolutely, that's the plan! |
No description provided.