# How to count FPS correctly?

**URL:** <https://discourse.glfw.org/t/how-to-count-fps-correctly/2454>\
**Category:** support\
**Created:** [September 19, 2023, 4:33am UTC](https://discourse.glfw.org/t/how-to-count-fps-correctly/2454 "2023-09-19T04:33:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julcs](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/julcs/32/814_2.png) [@julcs](https://discourse.glfw.org/u/julcs)\
**Post date:** [September 19, 2023, 4:33am UTC](https://discourse.glfw.org/t/how-to-count-fps-correctly/2454/1 "2023-09-19T04:33:39Z")

</div>

I tried to count the FPS in my render loop like this:

```c++
while (!glfwWindowShouldClose(window)) {
    glfwPollEvents();
    float current = (float) glfwGetTime();
    delta = current - time;
    time = current;
    std::cout << 1.f / delta << std::endl;
    render();
    glfwSwapBuffers(window);
}

```

…with VSync enabled:

```c++
glfwSwapInterval(1);

```

…but the output looks like this:

```plaintext
72.0857
345.182
73.3988
343.092
71.9065
375.564
71.9188
353.294
71.9324
360.212
72.3131
277.364

```

So it seems like roughly every second draw call is skipped. How can I check if the drawing was skipped in a frame so that I doesn’t count it into the frame rate, what happens in these iterations and why are they skipped? I am on an ARM Mac if this is has some kind of influence.

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [September 19, 2023, 1:00pm UTC](https://discourse.glfw.org/t/how-to-count-fps-correctly/2454/2 "2023-09-19T13:00:01Z")

</div>

Hi @julcs - welcome to the GLFW forum.

This might be that related to:

> <https://github.com/glfw/glfw/issues/2249>
>
> OpenGL swap interval seems to have broken again, as reported in #1990, after hav…ing been fixed in 12.1.

---

<div class="post-metadata">

**Author:** ![julcs](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/julcs/32/814_2.png) [@julcs](https://discourse.glfw.org/u/julcs)\
**Post date:** [September 19, 2023, 2:38pm UTC](https://discourse.glfw.org/t/how-to-count-fps-correctly/2454/3 "2023-09-19T14:38:29Z")

</div>

> [@dougbinks](#):
>
> [Swap interval ignored on macOS 13 · Issue #2249 · glfw/glfw · GitHub](https://github.com/glfw/glfw/issues/2249)

Thank you very much for your time this sounds exactly like the problem I have.  
Apparently downgrading to GLFW 3.3 fixes the issue.
