From dcdaac33f97937b56c92209e5f3813fdd9b9963d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 10 Aug 2018 13:38:27 +0200 Subject: [PATCH 01/10] Fix Julia 0.7 deprecations. --- .travis.yml | 4 ++-- REQUIRE | 2 +- src/ProfileView.jl | 16 ++++++++-------- src/ProfileViewGtk.jl | 2 +- src/pvtree.jl | 2 +- src/tree.jl | 23 ++++++++++++----------- test/test.jl | 6 +++--- test/tree.jl | 5 +++-- 8 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.travis.yml b/.travis.yml index abc5220..b52f862 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: julia os: - linux julia: - - 0.5 - - 0.6 + - 0.7 + - 1.0 - nightly notifications: email: false diff --git a/REQUIRE b/REQUIRE index a4c0f68..d0177bd 100644 --- a/REQUIRE +++ b/REQUIRE @@ -1,4 +1,4 @@ -julia 0.5 +julia 0.7 Gtk GtkReactive 0.0.3 Cairo 0.5.1 diff --git a/src/ProfileView.jl b/src/ProfileView.jl index 7466e63..e654f29 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -14,13 +14,13 @@ using .PVTree include("svgwriter.jl") -immutable TagData +struct TagData ip::UInt status::Int end const TAGNONE = TagData(UInt(0), -1) -type ProfileData +mutable struct ProfileData img lidict imgtags @@ -33,11 +33,11 @@ const gccolor = colorant"red" const colors = distinguishable_colors(13, [bkg,fontcolor,gccolor], lchoices=Float64[65, 70, 75, 80], cchoices=Float64[0, 50, 60, 70], - hchoices=linspace(0, 330, 24))[4:end] + hchoices=range(0, stop=330, length=24))[4:end] function have_display() - !is_unix() && return true - is_apple() && return true + !Sys.isunix() && return true + Sys.isapple() && return true return haskey(ENV, "DISPLAY") end @@ -53,12 +53,12 @@ function __init__() @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewGtk.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) - closeall() = ProfileViewGtk.closeall() @doc """ closeall() Closes all windows opened by ProfileView. -""" -> closeall +""" + closeall() = ProfileViewGtk.closeall() end end pop!(LOAD_PATH) @@ -105,7 +105,7 @@ function prepare_data(data, lidict) bt, uip, counts, lidict, lkup end -prepare_data(::Void, ::Void) = nothing, nothing, nothing, nothing, nothing +prepare_data(::Nothing, ::Nothing) = nothing, nothing, nothing, nothing, nothing function prepare_image(bt, uip, counts, lidict, lkup, C, colorgc, combine, pruned) diff --git a/src/ProfileViewGtk.jl b/src/ProfileViewGtk.jl index 227c8a5..e9190ec 100644 --- a/src/ProfileViewGtk.jl +++ b/src/ProfileViewGtk.jl @@ -8,7 +8,7 @@ using Graphics using Gtk.GConstants.GdkModifierType: SHIFT, CONTROL, MOD1 -type ZoomCanvas +mutable struct ZoomCanvas bb::BoundingBox # in user-coordinates c::Canvas end diff --git a/src/pvtree.jl b/src/pvtree.jl index 7a60cae..28922f0 100644 --- a/src/pvtree.jl +++ b/src/pvtree.jl @@ -5,7 +5,7 @@ using ..Tree export PVData, buildgraph!, prunegraph! # ProfileView data we need attached to each node of the graph: -type PVData +mutable struct PVData ip::UInt # the instruction pointer hspan::UnitRange{Int} # horizontal span (used as the x-axis in display) status::Int # nonzero for special handling, (e.g., gc events) diff --git a/src/tree.jl b/src/tree.jl index ea8da73..62e01e8 100644 --- a/src/tree.jl +++ b/src/tree.jl @@ -1,6 +1,6 @@ module Tree -import Base: start, done, next, show +import Base: iterate, show export Node, addchild, @@ -16,14 +16,14 @@ export Node, # Any missing links (e.g., "c" does not have a sibling) link back to itself (c.sibling == c) # With this organization, no arrays need to be allocated. -type Node{T} +mutable struct Node{T} data::T parent::Node{T} child::Node{T} sibling::Node{T} # Constructor for the root of the tree - function (::Type{Node{T}}){T}(data::T) + function (::Type{Node{T}})(data::T) where T n = new{T}(data) n.parent = n n.child = n @@ -31,15 +31,15 @@ type Node{T} n end # Constructor for all others - function (::Type{Node{T}}){T}(data::T, parent::Node) + function (::Type{Node{T}})(data::T, parent::Node) where T n = new{T}(data, parent) n.child = n n.sibling = n n end end -Node{T}(data::T) = Node{T}(data) -Node{T}(data::T, parent::Node{T}) = Node{T}(data, parent) +Node(data::T) where {T} = Node{T}(data) +Node(data::T, parent::Node{T}) where {T} = Node{T}(data, parent) function lastsibling(sib::Node) newsib = sib.sibling @@ -50,7 +50,7 @@ function lastsibling(sib::Node) sib end -function addsibling{T}(oldersib::Node{T}, data::T) +function addsibling(oldersib::Node{T}, data::T) where T if oldersib.sibling != oldersib error("Truncation of sibling list") end @@ -59,7 +59,7 @@ function addsibling{T}(oldersib::Node{T}, data::T) youngersib end -function addchild{T}(parent::Node{T}, data::T) +function addchild(parent::Node{T}, data::T) where T newc = Node(data, parent) prevc = parent.child if prevc == parent @@ -80,9 +80,10 @@ show(io::IO, n::Node) = print(io, n.data) # for c in parent # # do something # end -start(n::Node) = n.child -done(n::Node, state::Node) = n == state -next(n::Node, state::Node) = state, state == state.sibling ? n : state.sibling +function iterate(n::Node, state = n.child) + n == state && return nothing + return state, state == state.sibling ? n : state.sibling +end function showedges(io::IO, parent::Node, printfunc = identity) str = printfunc(parent.data) diff --git a/test/test.jl b/test/test.jl index efc9b5a..8c9b9f4 100644 --- a/test/test.jl +++ b/test/test.jl @@ -4,10 +4,10 @@ function profile_test(n) for i = 1:n A = randn(100,100,20) m = maximum(A) - Afft = fft(A) - Am = mapslices(sum, A, 2) + # Afft = fft(A) + Am = mapslices(sum, A, dims = 2) B = A[:,:,5] - Bsort = mapslices(sort, B, 1) + Bsort = mapslices(sort, B, dims = 1) b = rand(100) C = B.*b end diff --git a/test/tree.jl b/test/tree.jl index c84f70e..5d1e40d 100644 --- a/test/tree.jl +++ b/test/tree.jl @@ -3,7 +3,7 @@ root = Tree.Node(0) @assert Tree.isleaf(root) nchildren = 0 for c in root - nchildren += 1 + global nchildren += 1 end @assert nchildren == 0 c1 = Tree.addchild(root, 1) @@ -17,7 +17,7 @@ c22 = Tree.addchild(c2, 5) nchildren = 0 for c in root @assert !Tree.isroot(c) - nchildren += 1 + global nchildren += 1 end @assert nchildren == 3 @assert Tree.isleaf(c1) @@ -30,5 +30,6 @@ end children2 = [c21,c22] i = 0 for c in c2 + global i @assert c == children2[i+=1] end From f67b9c1cacffbdaf7fec1d2e99f2c92f85d7fba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 10 Aug 2018 14:56:06 +0200 Subject: [PATCH 02/10] Attempt to fix conditional submodule import. --- src/ProfileView.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index e654f29..356e639 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -41,15 +41,17 @@ function have_display() return haskey(ENV, "DISPLAY") end +include("ProfileViewSVG.jl") +include("ProfileViewGtk.jl") + function __init__() - push!(LOAD_PATH, splitdir(@__FILE__)[1]) if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display() - eval(Expr(:import, :ProfileViewSVG)) + eval(Expr(:import, Symbol(".ProfileViewSVG"))) @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewSVG.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) end else - eval(Expr(:import, :ProfileViewGtk)) + eval(Expr(:import, Symbol(".ProfileViewGtk"))) @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewGtk.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) From 8fe3b021a1e091489029765eaffdd5b6707ee0f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Sat, 11 Aug 2018 16:08:15 +0200 Subject: [PATCH 03/10] Simplify constructurs. Relax dispatch for addsibling and addchild. Remove commented out fft call during testing. --- src/tree.jl | 10 +++++----- test/test.jl | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tree.jl b/src/tree.jl index 62e01e8..d1f23ae 100644 --- a/src/tree.jl +++ b/src/tree.jl @@ -23,7 +23,7 @@ mutable struct Node{T} sibling::Node{T} # Constructor for the root of the tree - function (::Type{Node{T}})(data::T) where T + function Node{T}(data) where T n = new{T}(data) n.parent = n n.child = n @@ -31,7 +31,7 @@ mutable struct Node{T} n end # Constructor for all others - function (::Type{Node{T}})(data::T, parent::Node) where T + function Node{T}(data, parent::Node) where T n = new{T}(data, parent) n.child = n n.sibling = n @@ -39,7 +39,7 @@ mutable struct Node{T} end end Node(data::T) where {T} = Node{T}(data) -Node(data::T, parent::Node{T}) where {T} = Node{T}(data, parent) +Node(data, parent::Node{T}) where {T} = Node{T}(data, parent) function lastsibling(sib::Node) newsib = sib.sibling @@ -50,7 +50,7 @@ function lastsibling(sib::Node) sib end -function addsibling(oldersib::Node{T}, data::T) where T +function addsibling(oldersib::Node{T}, data) where T if oldersib.sibling != oldersib error("Truncation of sibling list") end @@ -59,7 +59,7 @@ function addsibling(oldersib::Node{T}, data::T) where T youngersib end -function addchild(parent::Node{T}, data::T) where T +function addchild(parent::Node{T}, data) where T newc = Node(data, parent) prevc = parent.child if prevc == parent diff --git a/test/test.jl b/test/test.jl index 8c9b9f4..bb98eb1 100644 --- a/test/test.jl +++ b/test/test.jl @@ -4,7 +4,6 @@ function profile_test(n) for i = 1:n A = randn(100,100,20) m = maximum(A) - # Afft = fft(A) Am = mapslices(sum, A, dims = 2) B = A[:,:,5] Bsort = mapslices(sort, B, dims = 1) From 069910b49bc34ee2140e0c4a55e94562fee907c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Sun, 12 Aug 2018 10:19:33 +0200 Subject: [PATCH 04/10] Revert "Attempt to fix conditional submodule import." This reverts commit f67b9c1cacffbdaf7fec1d2e99f2c92f85d7fba5. --- src/ProfileView.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index 356e639..e654f29 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -41,17 +41,15 @@ function have_display() return haskey(ENV, "DISPLAY") end -include("ProfileViewSVG.jl") -include("ProfileViewGtk.jl") - function __init__() + push!(LOAD_PATH, splitdir(@__FILE__)[1]) if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display() - eval(Expr(:import, Symbol(".ProfileViewSVG"))) + eval(Expr(:import, :ProfileViewSVG)) @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewSVG.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) end else - eval(Expr(:import, Symbol(".ProfileViewGtk"))) + eval(Expr(:import, :ProfileViewGtk)) @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewGtk.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) From 6e0d29144b2f08ac5eb798d699e0746ef4df0188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 17 Aug 2018 10:49:05 +0200 Subject: [PATCH 05/10] Make eval of import robust to AST changes. --- src/ProfileView.jl | 4 ++-- src/ProfileViewGtk.jl | 2 +- src/ProfileViewSVG.jl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index e654f29..4cedd7a 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -44,12 +44,12 @@ end function __init__() push!(LOAD_PATH, splitdir(@__FILE__)[1]) if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display() - eval(Expr(:import, :ProfileViewSVG)) + @eval import ProfileViewSVG @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewSVG.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) end else - eval(Expr(:import, :ProfileViewGtk)) + @eval import ProfileViewGtk @eval begin view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = []) = ProfileViewGtk.view(data; C=C, lidict=lidict, colorgc=colorgc, fontsize=fontsize, combine=combine, pruned=pruned) diff --git a/src/ProfileViewGtk.jl b/src/ProfileViewGtk.jl index e9190ec..606c1ef 100644 --- a/src/ProfileViewGtk.jl +++ b/src/ProfileViewGtk.jl @@ -14,7 +14,7 @@ mutable struct ZoomCanvas end function __init__() - eval(Expr(:import, :ProfileView)) + @eval import ProfileView end function closeall() diff --git a/src/ProfileViewSVG.jl b/src/ProfileViewSVG.jl index e8c8e07..cb9b498 100644 --- a/src/ProfileViewSVG.jl +++ b/src/ProfileViewSVG.jl @@ -3,7 +3,7 @@ __precompile__() module ProfileViewSVG function __init__() - eval(Expr(:import, :ProfileView)) + @eval import ProfileView end function view(data = Profile.fetch(); C = false, lidict = nothing, colorgc = true, fontsize = 12, combine = true, pruned = true) From bc0dcb9ae7caca2dd07145b22ebfe72005ddf68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 17 Aug 2018 10:50:19 +0200 Subject: [PATCH 06/10] Use __DIR__ macro directly instead of extracting dir name from __FILE__. --- src/ProfileView.jl | 2 +- src/svgwriter.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index 4cedd7a..f44a6a0 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -42,7 +42,7 @@ function have_display() end function __init__() - push!(LOAD_PATH, splitdir(@__FILE__)[1]) + push!(LOAD_PATH, @__DIR__) if (isdefined(Main, :IJulia) && !isdefined(Main, :PROFILEVIEW_USEGTK)) || !have_display() @eval import ProfileViewSVG @eval begin diff --git a/src/svgwriter.jl b/src/svgwriter.jl index e6e115d..fed5f0d 100644 --- a/src/svgwriter.jl +++ b/src/svgwriter.jl @@ -1,5 +1,5 @@ -const snapsvgjs = joinpath(dirname(@__FILE__), "..", "templates", "snap.svg-min.js") -const viewerjs = joinpath(dirname(@__FILE__), "viewer.js") +const snapsvgjs = joinpath(@__DIR__, "..", "templates", "snap.svg-min.js") +const viewerjs = joinpath(@__DIR__, "viewer.js") function escape_script(js::AbstractString) return replace(js, "]]", "] ]") From 55a99afcf43edd705a92b8273b30574110268d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 17 Aug 2018 13:23:31 +0200 Subject: [PATCH 07/10] Add using Profile. --- src/ProfileView.jl | 1 + test/test.jl | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index f44a6a0..39ced1b 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -2,6 +2,7 @@ __precompile__() module ProfileView +using Profile using Colors import Base: contains, isequal, show, mimewritable diff --git a/test/test.jl b/test/test.jl index bb98eb1..222d9fc 100644 --- a/test/test.jl +++ b/test/test.jl @@ -1,3 +1,4 @@ +using Profile using ProfileView function profile_test(n) From 754f61a0e7cc7323387e3436623229808baa0ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 17 Aug 2018 13:24:52 +0200 Subject: [PATCH 08/10] Fix more deprecations. --- src/ProfileView.jl | 12 ++++++------ src/pvtree.jl | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index 39ced1b..cc80aad 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -5,7 +5,7 @@ module ProfileView using Profile using Colors -import Base: contains, isequal, show, mimewritable +import Base: isequal, show include("tree.jl") include("pvtree.jl") @@ -98,7 +98,7 @@ function prepare_data(data, lidict) # Do code address lookups on all unique instruction pointers uip = unique(vcat(bt...)) if lidict == nothing - lkup = Vector{StackFrame}[Profile.lookup(ip) for ip in uip] + lkup = Vector{StackTraces.StackFrame}[Profile.lookup(ip) for ip in uip] lidict = Dict(zip(uip, lkup)) else lkup = [lidict[ip] for ip in uip] @@ -171,7 +171,7 @@ function svgwrite(filename::AbstractString; kwargs...) end -mimewritable(::MIME"image/svg+xml", pd::ProfileData) = true +Base.showable(::MIME"image/svg+xml", pd::ProfileData) = true function show(f::IO, ::MIME"image/svg+xml", pd::ProfileData) img = pd.img @@ -268,7 +268,7 @@ function buildtags!(rowtags, parent, level) end t = rowtags[level] for c in parent - t[c.data.hspan] = TagData(c.data.ip, c.data.status) + t[c.data.hspan] .= Ref(TagData(c.data.ip, c.data.status)) buildtags!(rowtags, c, level+1) end end @@ -319,10 +319,10 @@ end function fillrow!(img, j, rng::UnitRange{Int}, colorindex, colorlen, regcolor, gccolor, status) if status > 0 - img[rng,j] = gccolor + img[rng,j] .= gccolor return colorindex else - img[rng,j] = regcolor + img[rng,j] .= regcolor return mod1(colorindex+1, colorlen) end end diff --git a/src/pvtree.jl b/src/pvtree.jl index 28922f0..d48b257 100644 --- a/src/pvtree.jl +++ b/src/pvtree.jl @@ -37,9 +37,9 @@ function buildgraph!(parent::Node, bt::Vector{Vector{UInt}}, counts::Vector{Int} end end ngroups = length(dorder) - group = Vector{Vector{Int}}(ngroups) # indices in bt that have the same sortorder - n = Array{Int}(ngroups) # aggregated counts for this group - order = Array{Int}(ngroups) + group = Vector{Vector{Int}}(undef, ngroups) # indices in bt that have the same sortorder + n = Array{Int}(undef, ngroups) # aggregated counts for this group + order = Array{Int}(undef, ngroups) i = 1 for (key, v) in dorder order[i] = key From 52a45c58a225baedc352e01bd1bc4521e2423cba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Fri, 17 Aug 2018 13:25:53 +0200 Subject: [PATCH 09/10] tree_aggregate is gone from Profile. Revive a local copy. --- src/ProfileView.jl | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index cc80aad..8946bfe 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -71,7 +71,7 @@ function prepare(data; C = false, lidict = nothing, colorgc = true, combine = tr end function prepare_data(data, lidict) - bt, counts = Profile.tree_aggregate(data) + bt, counts = tree_aggregate(data) if isempty(counts) Profile.warning_empty() error("Nothing to view") @@ -408,4 +408,27 @@ function pushpruned!(pruned_ips, pruned, lidict) end end +## A tree representation +# Identify and counts repetitions of all unique backtraces +function tree_aggregate(data::Vector{UInt64}) + iz = findall(iszero, data) # find the breaks between backtraces + treecount = Dict{Vector{UInt64},Int}() + istart = 1 + for iend in iz + tmp = data[iend - 1 : -1 : istart] + treecount[tmp] = get(treecount, tmp, 0) + 1 + istart = iend + 1 + end + bt = Vector{Vector{UInt64}}(undef, 0) + counts = Vector{Int}(undef, 0) + for (k, v) in treecount + if !isempty(k) + push!(bt, k) + push!(counts, v) + end + end + return (bt, counts) +end + + end From 837daa128c53a03a987ea4f0ec6401d719aa9b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gunnar=20Farneb=C3=A4ck?= Date: Mon, 27 Aug 2018 12:58:40 +0200 Subject: [PATCH 10/10] Fix ProfileViewGtk deprecations. --- src/ProfileViewGtk.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ProfileViewGtk.jl b/src/ProfileViewGtk.jl index 606c1ef..a90b31e 100644 --- a/src/ProfileViewGtk.jl +++ b/src/ProfileViewGtk.jl @@ -24,13 +24,13 @@ function closeall() nothing end -const window_wrefs = WeakKeyDict{Gtk.GtkWindowLeaf,Void}() +const window_wrefs = WeakKeyDict{Gtk.GtkWindowLeaf,Nothing}() function view(data = Profile.fetch(); lidict=nothing, kwargs...) bt, uip, counts, lidict, lkup = ProfileView.prepare_data(data, lidict) # Display in a window c = canvas(UserUnit) - setproperty!(widget(c), :expand, true) + set_gtk_property!(widget(c), :expand, true) f = Frame(c) tb = Toolbar() bx = Box(:v) @@ -40,8 +40,8 @@ function view(data = Profile.fetch(); lidict=nothing, kwargs...) tb_save_as = ToolButton("gtk-save-as") push!(tb, tb_open) push!(tb, tb_save_as) - signal_connect(open_cb, tb_open, "clicked", Void, (), false, (widget(c),kwargs)) - signal_connect(save_as_cb, tb_save_as, "clicked", Void, (), false, (widget(c),data,lidict,kwargs)) + signal_connect(open_cb, tb_open, "clicked", Nothing, (), false, (widget(c),kwargs)) + signal_connect(save_as_cb, tb_save_as, "clicked", Nothing, (), false, (widget(c),data,lidict,kwargs)) win = Window(bx, "Profile") GtkReactive.gc_preserve(win, c) # Register the window with closeall @@ -57,17 +57,17 @@ function view(data = Profile.fetch(); lidict=nothing, kwargs...) # Ctrl-w and Ctrl-q destroy the window signal_connect(win, "key-press-event") do w, evt if evt.state == CONTROL && (evt.keyval == UInt('q') || evt.keyval == UInt('w')) - @schedule destroy(w) + @async destroy(w) nothing end end - showall(win) + Gtk.showall(win) end function viewprof(c, bt, uip, counts, lidict, lkup; C = false, colorgc = true, fontsize = 12, combine = true, pruned=[]) img, lidict, imgtags = ProfileView.prepare_image(bt, uip, counts, lidict, lkup, C, colorgc, combine, pruned) - img24 = UInt32[reinterpret(UInt32, convert(RGB24, img[i,j])) for i = 1:size(img,1), j = size(img,2):-1:1]' + img24 = Matrix(UInt32[reinterpret(UInt32, convert(RGB24, img[i,j])) for i = 1:size(img,1), j = size(img,2):-1:1]') fv = XY(0.0..size(img24,2), 0.0..size(img24,1)) zr = Signal(ZoomRegion(fv, fv)) sigrb = init_zoom_rubberband(c, zr)