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.


  • administrators

    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 than Math.round()?


Log in to reply
 

2
Online

315
Users

919
Topics

6.0k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.