FPSCounter: A framerate display plugin

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

FPSCounter: A framerate display plugin

Post 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!
Last edited by drakinite on Fri Nov 20, 2020 7:37 pm, edited 3 times in total.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Ludek
Posts: 4945
Joined: Fri Mar 09, 2007 9:00 am

Re: FPSCounter: An FPS counter plugin

Post 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).
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: FPSCounter: An FPS counter plugin

Post 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:
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: FPSCounter: An FPS counter plugin

Post 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)
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: FPSCounter: A framerate display plugin

Post 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.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply