Page 1 of 1

See Render time of each node

PostPosted: Thu Nov 09, 2017 10:02 am
by Fredrik Danell
Hi!
Sorry if this is obvious, but is it possible to see the rendertime of each node to determine bottlenecks? I'm using the freeware version.

Re: See Render time of each node

PostPosted: Thu Nov 09, 2017 11:21 pm
by Ryan Bloomer
One way to do this is to watch the navigator window in to the flow and see what takes the longest to process.

If you don't see the navigator in the flow, use (v) to toggle on and off or RMB in the flow/options - show navigator.

The node will turn green as it's processing.

Not sure if there's a script that will actually print out render times of nodes, but using the navigator usually helps identify processor intensive nodes.

Re: See Render time of each node

PostPosted: Fri Nov 10, 2017 1:40 am
by Bryan Ray
The attribute TOOL_LastFrameTime contains the amount of time it took a node to render the last time Fusion called for a frame.

Here's a single-line command you can paste into the Console to get the name and render time of all selected tools:

for i,tool in ipairs(tools) do print(tool:GetAttrs().TOOLS_Name..": "..tool:GetAttrs().TOOLN_LastFrameTime); end

Re: See Render time of each node

PostPosted: Fri Nov 10, 2017 6:30 am
by Kel Philm
Very Cool Bryan! This will be very helpful (especially once I can figure out how to sort it by time).

Also Bryan I had to use 'Comp:GetToolList()' instead of 'tools' for this to work on 9.1.

Re: See Render time of each node

PostPosted: Fri Nov 10, 2017 11:30 am
by Kel Philm
Its pretty rough but I created a script in my Comp level Scripts folder and it spits out a list slowest to fastest for all tools that have time greater than 0.

Code: Select all
function spairs(t, order)
    -- collect the keys
    local keys = {}
    for k in pairs(t) do keys[#keys+1] = k end

    -- if order function given, sort by it by passing the table and keys a, b,
    -- otherwise just sort the keys
    if order then
        table.sort(keys, function(a,b) return order(t, a, b) end)
    else
        table.sort(keys)
    end

    -- return the iterator function
    local i = 0
    return function()
        i = i + 1
        if keys[i] then
            return keys[i], t[keys[i]]
        end
    end
end

   
resTab = {}

for i,tool in ipairs(comp:GetToolList()) do
   resTab[tool:GetAttrs().TOOLS_Name] = tool:GetAttrs().TOOLN_LastFrameTime
end

print("======================================================")
print(" Tools from slowest to fastest (Tools with 0 ignored)")
print("======================================================")

for k,v in spairs(resTab, function(t,a,b) return t[b] < t[a] end) do
    if v > 0 then
      print(string.format("%7.2f", v) .. "  " .. k)
   end
end

Re: See Render time of each node

PostPosted: Fri Nov 10, 2017 7:40 pm
by Bryan Ray
Whoops! Sorry, you're right: you need to get the tool list first. I'd done so and stored it in "tools" already and forgot to replace the variable with the command.

There's a script floating around out there that sets the tools' tile color according to render time, creating a heatmap. I doubt it's been updated for Fusion 8/9, which is why I didn't mention it in the first place.

Re: See Render time of each node

PostPosted: Sat Nov 11, 2017 12:37 pm
by Fredrik Danell
Absolutely amazing guys! Kel Philms script worked like a charm!

Re: See Render time of each node

PostPosted: Thu Jan 17, 2019 6:17 pm
by derah1
Kel Philm script is a great start for what I want, I don't know LUA.
I would like the script to output the same results for every frame to a file.

Could anyone help with that?

Thanks.