Page 1 of 1

FPSCounter: A framerate display plugin

Posted: Fri Nov 06, 2020 6:58 pm
by drakinite
Hi there!

Today, I decided to make an FPS counter to help with performance analysis, but I realized it would be quite useful as a standalone extension. I learned how to register keyboard shortcuts properly for this one, so you can even remap the hotkey for it. :wink:

Pressing F6 will toggle the FPS counter, which will show up in the top-left corner of the screen. It displays the average FPS over the course of 5 frames, to improve both readability and performance. The extension displays a message saying it comes with a small performance penalty when idle. This is because it has to constantly request animation frames, even when the interface would normally be idle. On my computer, it usually increases CPU usage by around 2-3% and GPU usage by around 2-4%. It's small, but it would be wasteful if you kept it on all the time.
Here's a preview of what it looks like:
Image

Official listing: https://www.mediamonkey.com/addons/brow ... s-counter/
You can also download the most recent version here: https://1drv.ms/u/s!AqHzUrf30uprpIcsZ1kIX32styqIkA

I hope it's helpful! Enjoy!

Re: FPSCounter: An FPS counter plugin

Posted: Mon Nov 09, 2020 1:41 pm
by Ludek
Nice utility, just installed and it works as expected ;-)

Although (as a developer) I use DevTools > Performance tab (and its record button) to see the timeline and all the details about frames (and used processing time).

Re: FPSCounter: An FPS counter plugin

Posted: Mon Nov 09, 2020 2:15 pm
by drakinite
Absolutely, the performance tab definitely gives more useful and detailed info, but of course there's a huge performance impact when using that.
I think there are appropriate use cases for both. :blush:

Re: FPSCounter: An FPS counter plugin

Posted: Tue Nov 10, 2020 9:14 pm
by drakinite
Submitted version 1.0.2 - Configurable settings!
You can now change the position, size, text color, and font weight of the counter.
In addition, it now automatically pauses after 5 minutes of inactivity (if the MM5 window is not focused) in case you leave it on by accident.

As always, you can get the most recent version from the link in the original post.

(Edit: There was a bug where multiple requestAnimationFrame loops. Fixed and uploaded)

Re: FPSCounter: A framerate display plugin

Posted: Fri Nov 20, 2020 7:46 pm
by drakinite
Updated to version 1.0.3; Fixed two issues.
1. Default hotkeys did not show up when persistent.json is deleted (Hotkey needs to be registered after window.hotkeys.whenLoaded(), otherwise it won't detect an empty hotkey list and the default hotkeys are not added)
2. When both FPSCounter and ReloadShortcut were installed, ReloadShortcut would not register its hotkey because it used the same variable name (didRegisterHotkey) as FPSCounter. This is resolved by executing the entire script in an anonymous function, which I believe should be best-practice for addons.