I would like to measure the refresh rate of an arbitrary window. I am not sure, if there is a generic way to do this, but on the other hand, some FPS measuring tools exist:
- XBox Game Bar, however, very unstable and crashes / freezes all the time
- Steam FPS overlay, seems to work fine with any Steam app
- Overlay from MSI Afterburner
Just to be clear, I am not looking for a good FPS overlay, I want to read the framerate from code. I am not sure how a library could report this, maybe the FPS or frametime directly, maybe the last frame's timestamp, or a callback whenever a frame is rendered. I am open for any solution from which you can somehow calculate the framerate.
I would prefer a solution that works in Java (probably with some native library running in the background), but I am also ok with platform dependent C/C++ code or similar.
I personally believe that this question belongs to Stack Overflow, but whatever.