Skip to content

Profiler: Fix visual profiler showing inaccurate times for categories #120914

Open
VeryKurz wants to merge 3 commits into
godotengine:masterfrom
VeryKurz:visual-profiler-inaccuracy-fix
Open

Profiler: Fix visual profiler showing inaccurate times for categories #120914
VeryKurz wants to merge 3 commits into
godotengine:masterfrom
VeryKurz:visual-profiler-inaccuracy-fix

Conversation

@VeryKurz

@VeryKurz VeryKurz commented Jul 3, 2026

Copy link
Copy Markdown

What problem(s) does this PR solve?

Additional information

This PR adds time to the GPU and CPU times, which is rendered in the Graph but is missing in the overview:

Screenshot 2026-07-03 211351 Screenshot 2026-07-03 235102

For reproduction and further explanation of the issue please read the issue and especially this comment:
#97854 (comment)

Issues and uncertainties with this PR

  1. Areas in the Graph, which are associated with a Category instead of an Item aren't clickable in the Graph. This might cause confusion for the User.

  2. A new TimeStamp could be added which encapsulates swap_buffer() and its surrounding functions. This shows the user more transparently what is happening in the Visual Profiler and would make the specific Area from Unexplained Blue Area on Visual Profiler in Compatibility Renderer #97854 clickable and explained.

  3. The for loop in the commit is copied from a few lines below it. Instead of having duplicate code, an if statement could be added after that loop, which would just continue. I didn't do this because I think the current version is easier to read.

  4. This PR adds the time from closing Categories to it's parent Categories, but not to itself. This makes the most sense in my opinion, but the color displayed in the graph for this time still belongs to the closing category. This is probably not a big issue since the color of categories is not displayed in the overview, so Categories aren't associated with specific colors from the viewpoint of the user.

##Disclaimers

This is my first PR, hopefully it's enough/ not to much information.

No AI was used in this PR or the code.

@VeryKurz VeryKurz requested review from a team as code owners July 3, 2026 22:29
@Nintorch Nintorch added this to the 4.x milestone Jul 4, 2026
Comment thread editor/debugger/editor_visual_profiler.cpp Outdated
@AThousandShips AThousandShips changed the title Profiler: Fix visual profiler showing inaccurate times for categorys Profiler: Fix visual profiler showing inaccurate times for categories Jul 4, 2026
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
@clayjohn

clayjohn commented Jul 4, 2026

Copy link
Copy Markdown
Member

The time from swap buffers shouldn't be included at all (either in the graph or the side panel) So this actually makes the problem worse.

@VeryKurz

VeryKurz commented Jul 5, 2026

Copy link
Copy Markdown
Author

The time from swap buffers shouldn't be included at all (either in the graph or the side panel) So this actually makes the problem worse.

If swap buffers shouldn't be included, the Graph could be changed to ignore closing Categories, as the Overview does in master.

Additionally the Categories opening time could also be ignored in both Graph and Overview, since Categories aren't clickable, or selectable and from my experience don't add more then ~0.1 ms to the total time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexplained Blue Area on Visual Profiler in Compatibility Renderer

4 participants