ProfileView's @profview generates blank window

I am trying to use ProfileView’s @profview, but it’s only generating a blank window instead of a flamegraph. For a minimum working example, this behavior occurs for me with the ProfileView tutorial example:

function profile_test(n)
    for i = 1:n
        A = randn(100,100,20)
        m = maximum(A)
        Am = mapslices(sum, A; dims=2)
        B = A[:,:,5]
        Bsort = mapslices(sort, B; dims=1)
        b = rand(100)
        C = B.*b
    end
end

using ProfileView
@profview profile_test(1)  # run once to trigger compilation (ignore this one)
@profview profile_test(10)

I am using the most recent version of ProfileView (v1.3.1) and Julia v1.7.1. My platform info is

  OS: macOS (x86_64-apple-darwin19.5.0)
  CPU: Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, haswell)

My blank window output (if helpful) is

Gtk.GtkWindowLeaf(name="", parent, width-request=-1, height-request=-1, visible=TRUE, sensitive=TRUE, app-paintable=FALSE, can-focus=FALSE, has-focus=FALSE, is-focus=FALSE, focus-on-click=TRUE, can-default=FALSE, has-default=FALSE, receives-default=FALSE, composite-child=FALSE, style, events=0, no-show-all=FALSE, has-tooltip=FALSE, tooltip-markup=NULL, tooltip-text=NULL, window, opacity=1.000000, double-buffered, halign=GTK_ALIGN_FILL, valign=GTK_ALIGN_FILL, margin-left, margin-right, margin-start=0, margin-end=0, margin-top=0, margin-bottom=0, margin=0, hexpand=FALSE, vexpand=FALSE, hexpand-set=FALSE, vexpand-set=FALSE, expand=FALSE, scale-factor=2, border-width=0, resize-mode, child, type=GTK_WINDOW_TOPLEVEL, title="Profile", role=NULL, resizable=TRUE, modal=FALSE, window-position=GTK_WIN_POS_NONE, default-width=800, default-height=600, destroy-with-parent=FALSE, hide-titlebar-when-maximized=FALSE, icon, icon-name=NULL, screen, type-hint=GDK_WINDOW_TYPE_HINT_NORMAL, skip-taskbar-hint=FALSE, skip-pager-hint=FALSE, urgency-hint=FALSE, accept-focus=TRUE, focus-on-map=TRUE, decorated=TRUE, deletable=TRUE, gravity=GDK_GRAVITY_NORTH_WEST, transient-for, attached-to, has-resize-grip, resize-grip-visible, application, is-active=FALSE, has-toplevel-focus=FALSE, startup-id, mnemonics-visible=FALSE, focus-visible=FALSE, is-maximized=FALSE)

I do not have the knowledge to debug this, but it would probably be useful to know on what system this is happening (could be important if it is an issue with GTK which could have platform-specific bugs). versioninfo() would have useful information.

1 Like

Thanks for this suggestion!! I have now added the platform info.

It seem GTK has had similar problems on Mac before, seemingly related to how the (non-julia) GTK library is installed on the system. Until more knowledgeable people show up, this search might be a good start julia gtk on mac blank window - Google Search

But if you do not want to bother debugging this, I would suggest just using the SVG backend for flamegraphs https://github.com/kimikage/ProfileSVG.jl

2 Likes

Perfect this is now working

function profile_test(n)
    for i = 1:n
        A = randn(100,100,20)
        m = maximum(A)
        Am = mapslices(sum, A; dims=2)
        B = A[:,:,5]
        Bsort = mapslices(sort, B; dims=1)
        b = rand(100)
        C = B.*b
    end
end

using ProfileSVG
@profview profile_test(1)  # run once to trigger compilation (ignore this one)
@profview profile_test(10)

ProfileSVG.save("exflame.svg")
1 Like

I don’t know your IDE, but in VSC you should use

ProfileView.@profview

or (without the leading “ProfileView.”) VSC use his own profiler and you should
get something like this: