-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add option to snoop commands to control spawning separate process vs eval'ing in existing process #252
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #252 +/- ##
===========================================
- Coverage 85.06% 19.65% -65.42%
===========================================
Files 9 9
Lines 1587 1450 -137
===========================================
- Hits 1350 285 -1065
- Misses 237 1165 +928
Continue to review full report at Codecov.
|
Thank you. Can you please ping me when this is ready to test? (or if you want me to review it now I can also try but I do not know the code base much) |
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.
LGTM, just one small comment.
A test would be nice, of course!
@@ -23,4 +23,8 @@ if VERSION >= v"1.6.0-DEV.1192" # https://github.com/JuliaLang/julia/pull/37136 | |||
include("snoopl.jl") | |||
end | |||
|
|||
if VERSION >= v"1.6.0-DEV.1192" # https://github.com/JuliaLang/julia/pull/37136 | |||
include("snoop_all.jl") |
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.
Can't we just include this macro into SnoopCompileCore/src/snoopl.jl
? It's the same condition for including it that we use for@snoopl
.
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.
Yeah, good idea. I've just moved it into the same if-block. I guess it doesn't necessarily belong in snoopl.jl
because it will snoop all three types of compilation, which is why I put it in its own file.
Can you have another look and let me know if this looks okay? :)
```julia julia> f(x) = 2^x+100 f (generic function with 1 method) julia> tinf, snoopl_csv, snoopl_yaml, snoopc_csv = SnoopCompileCore.@snoop_all "snoop_all-f" f(2) (InferenceTimingNode: 0.003273/0.003523 on Core.Compiler.Timings.ROOT() with 1 direct children, "snoop_all-f.snoopl.csv", "snoop_all-f.snoopl.yaml", "snoop_all-f.snoopc.csv") ```
So i think this is more or less ready to go, but for some reason that I can't explain, the first call to I have no idea why. In the last commit, 995ffd2, I tried simplifying the logic that's spawning the processes and passing the commands through, but it had no effect. This is also why the tests are failing. Any advice you have would be greatly appreciated!! 😬 🤞 ================= Otherwise, I've added tests and a docstring. There's still no standalone tests for Finally, there's still no |
Tl;dr: Tests failing and i don't know why - plz help!! 😬 |
@bkamins - you could try testing this now if you'd like |
Thank you. I do not get the error you report. However I have some general minor comments:
Thank you! |
Apart from that I have analyzed the results - and all works as I would expect. Superb work - thank you! @pdeffebach - given the results of |
I've added an example with a
Please see the updated docstring, with links to what to do with each of the results. You should be able to follow all of those separate guides for how to interpret the results. :) |
Thank you!
I would normally expect that tab delimited file has .txt extension. The .csv extension is not the end of the world though. The CSV.jl will read it correctly by auto-detection of a delimiter. |
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.
Looks quite good. For consistency, let's re-export @snoop_all
from SnoopCompile.
while !eof(stdin) | ||
Core.eval(Main, deserialize(stdin)) | ||
end | ||
Core.eval(Main, deserialize(IOBuffer(read(stdin)))) |
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.
Any particular reason for this change? What if stdin
is huge? Likewise elsewhere among the changes.
Is it possible that this is the change that causes the closed stream issue? It seems possible that Julia 1.0 is not being as careful as this code.
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.
Alas, this is not responsible for the error -- this was my attempt to fix it, but it didn't help. I can happily revert these changes, yeah.
@@ -0,0 +1,34 @@ | |||
using Test | |||
|
|||
using SnoopCompile |
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.
Can't be run as a standalone unless either you say using SnoopCompileCore
also, or re-export @snoop_all
and then drop the module qualifier below.
This is not a technical issue, but the name |
Running snoop compilation in a separate process allows you to consistently measure complete compilation time on every run, without being affected by the state of the current process.
On the other hand, running the snoop compilation in the current process allows you to measure incremental compilation performance, which can also be useful in some contexts.
This PR attempts to add an option to all snoop commands to let you choose between those options.
It also adds another function,
@snoop_all
, which runs@snoopi_deep
,@snoopl
and@snoopc
together at the same time, so that you can compare results across them.Note that this branch is currently really messy, because it had a bunch of draft PRs merged into it, that have since been squash-merged into master, so we need to clean that up first as well.EDIT: Okay that's done. This branch currently only does
@snoopi_deep
and@snoopl
, so we need to add@snoopc
as well. And we need to add apspawn
-type flag to@snoopc
. And if we want to allow running all of them in a separate process, we need to add it to@snoopi_deep
as well.This addresses this comment, for a request from @bkamins: #251 (comment)