-
Notifications
You must be signed in to change notification settings - Fork 48
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
docs! #192
Conversation
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.
trivial suggestion: doc refs
There are many different ways of inspecting and using the data stored in `tinf`. | ||
The simplest is to load the `AbstracTrees` package and display the tree with | ||
`AbstractTrees.print_tree(tinf)`. | ||
See also: `flamegraph`, `flatten`, `inference_triggers`, `SnoopCompile.parcel`, |
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.
See also: `flamegraph`, `flatten`, `inference_triggers`, `SnoopCompile.parcel`, | |
See also: [`flamegraph`](@ref), [`flatten`](@ref), [`inference_triggers`](@ref), `SnoopCompile.parcel`, |
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.
Good idea, but the problem is that this is in SnoopCompileCore and those methods are in SnoopCompile. Documenter doesn't yet like cross-package references. I need to finish up JuliaDocs/Documenter.jl#1352
The simplest is to load the `AbstracTrees` package and display the tree with | ||
`AbstractTrees.print_tree(tinf)`. | ||
See also: `flamegraph`, `flatten`, `inference_triggers`, `SnoopCompile.parcel`, | ||
`runtime_inferencetime`. |
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.
`runtime_inferencetime`. | |
[`runtime_inferencetime`](@ref). |
Which branch should one use to test it out? I removed (@v1.6) pkg> st SnoopCompile
Status `~/.julia/environments/v1.6/Project.toml`
[aa65fe97] SnoopCompile v2.1.2 `https://github.com/timholy/SnoopCompile.jl.git#teh/docs`
julia> using SnoopCompile
julia> names(SnoopCompile)
10-element Vector{Symbol}:
Symbol("@snoopc")
Symbol("@snoopi")
Symbol("@snoopr")
:SnoopCompile
:ascend
:filtermod
:findcaller
:invalidation_trees
:read_snoopl
:uinvalidated
julia> VERSION
v"1.6.0-DEV.1780" |
It's both separate and together: the usual dependency rules mean you get SnoopCompileCore if you install SnoopCompile. But the oddity is that if you |
For anyone wondering about any more changes, I do expect to slightly rework the internals of InferenceTrigger and support the creation of flamegraphs from child nodes. I just pushed the |
Thanks, it is working now. |
Note to all: barring feedback, merge day is Tuesday, Jan5 in the very early hours of the morning (UTC-6). |
What's still not very clear to me is how to get a |
No worries, and thanks for the feedback!
Hmm, that could indeed be clarified. So you don't have to wait, here's a demo: julia> using SnoopCompile
julia> tinf = SnoopCompile.flatten_demo()
InferenceTimingNode: 0.002332952/0.0030147330000000003 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 1 direct children
julia> using AbstractTrees
julia> print_tree(tinf)
InferenceTimingNode: 0.00233295/0.00301473 on InferenceFrameInfo for Core.Compiler.Timings.ROOT() with 1 direct children
└─ InferenceTimingNode: 0.000179361/0.000681781 on InferenceFrameInfo for SnoopCompile.FlattenDemo.packintype(::Int64) with 2 direct children
├─ InferenceTimingNode: 0.000119137/0.000119137 on InferenceFrameInfo for MyType{Int64}(::Int64) with 0 direct children
└─ InferenceTimingNode: 0.000105458/0.000383283 on InferenceFrameInfo for SnoopCompile.FlattenDemo.dostuff(::MyType{Int64}) with 2 direct children
├─ InferenceTimingNode: 7.3179e-5/0.0001366 on InferenceFrameInfo for SnoopCompile.FlattenDemo.extract(::MyType{Int64}) with 2 direct children
│ ├─ InferenceTimingNode: 3.7388e-5/3.7388e-5 on InferenceFrameInfo for getproperty(::MyType{Int64}, ::Symbol) with 0 direct children
│ └─ InferenceTimingNode: 2.6033e-5/2.6033e-5 on InferenceFrameInfo for getproperty(::MyType{Int64}, x::Symbol) with 0 direct children
└─ InferenceTimingNode: 0.000141225/0.000141225 on InferenceFrameInfo for SnoopCompile.FlattenDemo.domath(::Int64) with 0 direct children
julia> Core.MethodInstance(tinf)
MethodInstance for ROOT()
julia> Core.MethodInstance(tinf.children[1])
MethodInstance for packintype(::Int64)
julia> Core.MethodInstance(tinf.children[2])
ERROR: BoundsError: attempt to access 1-element Vector{SnoopCompileCore.InferenceTimingNode} at index [2]
Stacktrace:
[1] getindex(A::Vector{SnoopCompileCore.InferenceTimingNode}, i1::Int64)
@ Base ./array.jl:787
[2] top-level scope
@ REPL[7]:1
julia> Core.MethodInstance(tinf.children[1].children[2])
MethodInstance for dostuff(::SnoopCompile.FlattenDemo.MyType{Int64}) |
Yay, the long wait is over! This isn't even comprehensive (it barely touches on
flatten
,accumulate_by_source
, etc.) but it should get everyone going. I've also found that many of those earlier utilities are not as useful as more focused tools likeinference_triggers
andparcel
.This is currently based on top of #191.