Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Vsynch CPU usage is unusual  (Read 4149 times)

0 Members and 1 Guest are viewing this topic.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Vsynch CPU usage is unusual
« on: July 05, 2019, 02:20:01 pm »
When I run my game with

Code: [Select]
Window.setFramerateLimit(60);
... the CPU usage of the program is at about 1% in task manager.

If I increase the frame rate to 120, the CPU usage is at about 2%. At 240 it's about 4% and so on. It's pretty consistent.

HOWEVER, when I enable Vsynch instead of using setFrameLimit(), the CPU usage jumps to around 30 percent.

Isn't this unusual considering my monitor refresh rate is 60hz?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11038
    • View Profile
    • development blog
    • Email
Re: Vsynch CPU usage is unusual
« Reply #1 on: July 08, 2019, 03:17:21 pm »
vsync can be disabled in most GPU settings, so even when SFML requests it, it doesn't guarantee to be set.
Check your GPU settings.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Vsynch CPU usage is unusual
« Reply #2 on: July 08, 2019, 04:40:25 pm »
vsync can be disabled in most GPU settings, so even when SFML requests it, it doesn't guarantee to be set.
Check your GPU settings.

Driver Vsynch settings currently leave it to the 3d application. I can't force it to be always on because of a Windows 10 upgrade issue (according to some knowledgeable folks I have reinstall drivers to fix it).

Anyway, just to be clear, I'm not wrong about expecting the program to have the same amount of CPU usage as if I was running it with a fixed frame limit of 60, right? Since the monitor refresh rate is 60hz and Vsynch is supposed to make the program run at that many cycles?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11038
    • View Profile
    • development blog
    • Email
Re: Vsynch CPU usage is unusual
« Reply #3 on: July 08, 2019, 05:13:44 pm »
Depends. In a perfect world, you could expect that, but it's not unheard of that some GPU drivers just implement a busy-waiting loop of some sort, so your vsynch wait just loops until the next frame needs to be rendered, thus the CPU usage can be quite high.
Not sure if that's the case on your end. Do you render 60fps or do you render more than that with vsync on?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: Vsynch CPU usage is unusual
« Reply #4 on: July 08, 2019, 06:01:43 pm »
Depends. In a perfect world, you could expect that, but it's not unheard of that some GPU drivers just implement a busy-waiting loop of some sort, so your vsynch wait just loops until the next frame needs to be rendered, thus the CPU usage can be quite high.
Not sure if that's the case on your end. Do you render 60fps or do you render more than that with vsync on?

The game renders 60 fps with vsynch on.

 

anything