|
1 | 1 | module SCPyPlotExt
|
2 | 2 |
|
| 3 | +import Profile |
| 4 | + |
3 | 5 | using SnoopCompile
|
4 | 6 | using SnoopCompile: MethodLoc, InferenceTimingNode, PGDSData, lookups
|
5 | 7 | using PyPlot: PyPlot, plt, PyCall
|
6 | 8 |
|
7 | 9 | get_bystr(@nospecialize(by)) = by === inclusive ? "Inclusive" :
|
8 | 10 | by === exclusive ? "Exclusive" : error("unknown ", by)
|
9 | 11 |
|
10 |
| -function pgdsgui(ax::PyCall.PyObject, ridata::AbstractVector{Pair{Union{Method,MethodLoc},PGDSData}}; bystr, consts, markersz=25, linewidth=0.5, t0 = 0.001, interactive::Bool=true, kwargs...) |
| 12 | +function SnoopCompile.pgdsgui(ax::PyCall.PyObject, ridata::AbstractVector{Pair{Union{Method,MethodLoc},PGDSData}}; bystr, consts, markersz=25, linewidth=0.5, t0 = 0.001, interactive::Bool=true, kwargs...) |
11 | 13 | methodref = Ref{Union{Method,MethodLoc}}() # returned to the user for inspection of clicked methods
|
12 | 14 | function onclick(event)
|
13 | 15 | xc, yc = event.xdata, event.ydata
|
@@ -48,18 +50,18 @@ function pgdsgui(ax::PyCall.PyObject, ridata::AbstractVector{Pair{Union{Method,M
|
48 | 50 | return methodref
|
49 | 51 | end
|
50 | 52 |
|
51 |
| -function pgdsgui(ax::PyCall.PyObject, args...; consts::Bool=true, by=inclusive, kwargs...) |
| 53 | +function SnoopCompile.pgdsgui(ax::PyCall.PyObject, args...; consts::Bool=true, by=inclusive, kwargs...) |
52 | 54 | pgdsgui(ax, prep_ri(args...; consts, by, kwargs...); bystr=get_bystr(by), consts, kwargs...)
|
53 | 55 | end
|
54 | 56 |
|
55 |
| -function pgdsgui(args...; kwargs...) |
| 57 | +function SnoopCompile.pgdsgui(args...; kwargs...) |
56 | 58 | fig, ax = plt.subplots()
|
57 | 59 | pgdsgui(ax, args...; kwargs...), ax
|
58 | 60 | end
|
59 | 61 |
|
60 | 62 | function prep_ri(tinf::InferenceTimingNode, pdata=Profile.fetch(); lidict=lookups, consts, by, kwargs...)
|
61 |
| - lookup_firstip!(lookups, pdata) |
62 |
| - return runtime_inferencetime(tinf, pdata; lidict, consts, by) |
| 63 | + SnoopCompile.lookup_firstip!(lookups, pdata) |
| 64 | + return SnoopCompile.runtime_inferencetime(tinf, pdata; lidict, consts, by) |
63 | 65 | end
|
64 | 66 |
|
65 | 67 | end
|
0 commit comments