Performance meter customisation
-
I would like to customise the performance meter, I want to add some more text to it. The floating tile docs say to use the individual calls such as
Engine.getCpuUsage()
however those calls don't update in real-time like the default performance meter does. -
Actually the performance meter is just a label with a timer so you can roll your own versiom pretty easily.
I‘d recommend writing a custom Panel for this, this way you can also implement bar meters, anither layout etc.
-
Thank you. For anyone else who comes across this, here is what I've done.
const var pnlStats = Content.getComponent("pnlStats"); const var lblStats = Content.getComponent("lblStats"); pnlStats.startTimer(250); pnlStats.setTimerCallback(function() { lblStats.set("text", "CPU: " + Math.round(Engine.getCpuUsage()) + "%" + ", " + "RAM: " + Math.round(Engine.getMemoryUsage()) + "MB" + ", " + "Voices: " + Engine.getNumVoices()); });
Is
Engine.doubleToString()
faster thanMath.round()
?