Godot: Profiler frame number stops updating when game window is minimized

Created on 26 Mar 2020  Â·  12Comments  Â·  Source: godotengine/godot

Godot version:
Master branch
a2da99f40cf2123c0906c734a2eb01e9b65a45a2

OS/device including version:
Windows 10

Issue description:
When profiler is running and game window is minimized, the frame number at the top right of the profiler will stop updating. Meanwhile the profiler will still be running - still outputting graph, statistics.

Additional remark : During this time (when the game window is minimized), if we try to export measures as CSV, the Editor will crash. It doesn't happen _as often_ when the game window is not minimized. Closely related to #34640

Steps to reproduce:

  1. Create an empty project.
  2. Add a 2d Node and attach a script to it.
  3. Run the scene.
  4. Start the profiler.
  5. Minimize the game window.

Minimal reproduction project:
test.zip

bug confirmed editor

All 12 comments

@SkyLucilfer are you sure you tested at that commit?
I can't reproduce at that commit, but I can reproduce in a build after the display-server branch

Seems a regression after the merge from the display-server branch.

@SkyLucilfer are you sure you tested at that commit?
I can't reproduce at that commit, but I can reproduce in a build after the display-server branch

Yes I confirm its the correct commit with git log - 1.
I'm interested or can help in working on this issue if you think it's accessible for me (relatively new contributor)

@SkyLucilfer can you check if you are getting this at b8577ecce1bb62a4a589d02bdd71b701e5bdea81 ?

Yes I'm still getting it with that commit.

profilerBug2

I can see you are also getting very low idle times, can you try adding this to your _process:

    print(Engine.get_idle_frames())  # number of `idle` (process) iterations called
    print(Engine.get_frames_drawn()) # number of drawn frames (number you see in the debugger)
    print(Engine.get_frames_per_second()) # should be 60 when you have vsync active (default).

I think we probably want to use get_idle_frames() for the frame # instead, since when render loop is disabled get_frames_drawn() returns 0.
I guess get_frames_drawn() is not updated when the window is minimized.

with game window open :
idle frames = frames shown in the profiler
drawn frames = frames shown in the profiler
FPS = 60

with game window minimized :
idle frames = continue increasing like before
drawn frames = last frame shown in the profiler ( the frame that has been put on pause )
FPS = increased to around 120. Interesting, because I have vsync on

If I reopen the game window (after minimizing), drawn frames increase with frames in the profiler again and FPS returns to 60.

Probably this:

diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp
index b9db8ab1b0..783723d1a1 100644
--- a/core/debugger/remote_debugger.cpp
+++ b/core/debugger/remote_debugger.cpp
@@ -318,7 +318,7 @@ struct RemoteDebugger::ServersProfiler {

        void _send_frame_data(bool p_final) {
                DebuggerMarshalls::ServersProfilerFrame frame;
-               frame.frame_number = Engine::get_singleton()->get_frames_drawn();
+               frame.frame_number = Engine::get_singleton()->get_idle_frames();
                frame.frame_time = frame_time;
                frame.idle_time = idle_time;
                frame.physics_time = physics_time;

FPS = increased to around 120. Interesting, because I have vsync on

And this might be related to #32404 . Interesting.

@Faless Do you want me to change get_frames_drawn() to get_idle_frames(), do some manual testing in the Editor and open a pull request? Or maybe you have some other plans for this issue?

About the vsync and FPS maybe I will take a look in the future. I think it's hard for my level now.

Yeah, if you can test it, and open a pull request. Thanks!

On Fri, Mar 27, 2020, 13:57 SkyLucilfer notifications@github.com wrote:

@Faless https://github.com/Faless Do you want me to change
get_frames_drawn() to get_idle_frames(), do some manual testing in the
Editor and open a pull request? Or maybe you have some other plans for this
issue?

About the vsync and FPS maybe I will take a look in the future. I think
it's hard for my level now.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/37341#issuecomment-604985791,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAM4C3SSKM6XBGCY23HJY6LRJSPDHANCNFSM4LUSE3RA
.

It seems like with the newest pull from master branch 307b1b3a5835ecdb477859785c673a07e248f904 the game window will crash when minimized. Think that issue #37365 needs to be solved first before I can test this one.

Was this page helpful?
0 / 5 - 0 ratings