Get the native framerate of the target device

Hi,
The base/target framerate of a babylon.js application can be different depending on the device it is running on.
For example, most browsers an your typical monitor will run at 60fps. Nice gaming monitors may run much higher, say 320fps. When my laptop is connected to 3 external hi-res displays it can only run at 30fps. My Quest 2 is either 72fps or 90fps (not actually sure which) and it may change depending if the user is in XR mode or not.
Is there a robust way to get this target rate from within javascript?
Thanks.

Hey, we are using absolute FPS for that:

1000.0 / sceneInstrumentation.frameTimeCounter.lastSecAverage

The instrumentation is built like this:

sceneInstrumentation = new SceneInstrumentation(scene);
sceneInstrumentation.captureFrameTime = true;

Doc: Optimizing Your Scene | Babylon.js Documentation (babylonjs.com)

Hi @Deltakosh,
Thanks for the info. My understanding is that the technique you describe will allow me to see what frame rate a babylonjs app is currently running at.
What I really would like is the ability to see what the target device frame-rate will be in advance.

This is because every few seconds I check the actual frame rate of my app and adjust the fixed physics frame rate depending if the application frame rate is below or at the target rate. Currently, this target rate is hardcoded at 60fps, however as I mentioned in my first post, the assumption that the device runs at a maximum of 60fps is incorrect.
I would really like to know the target frame rate of the device my app is running on so that I can use it in my physics rate adjustment code as the target rate rather than the hardcoded 60fps.

Hope this clarifies what I’m looking for.
Thanks

However, now I have thought about it some more, there is no real need for me to know at the very start of the app…
Also, re-reading what you suggest does give me the value I require, so I can adjust the target just as I adjust the rate.
Thanks for the help, I will give it a try once I have finished my current work. :+1:

Haha my pleasure

Perhaps this will be useful?
The Scene Optimizer | Babylon.js Documentation (babylonjs.com)

Fwiw , request animation frame runs at the interval of the device’s screen refresh rate.