UXSimStatus Aternatif

From OpenSimulator

Revision as of 12:32, 11 October 2018 by Djphil (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you're having cross-origin issues, you can try this alternate version:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jsonSimStats</title>
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="https://www.gstatic.com/charts/loader.js"></script>
</head>
<body>
<script>
SimFPS = 0;
PhyFPS = 0;
Memory = 0;
RootAg = 0;
ChldAg = 0;
Uptime = "";
Version = "";
var url = "http://<IP_OR_DOMAIN>:<PORT>/jsonSimStats/?callback=?";
 
setInterval(function() {$.getJSON(url, function(data) {
    SimFPS = Math.round(data.SimFPS);
    PhyFPS = Math.round(data.PhyFPS);
    Memory = Math.round(data.Memory);
    ChldAg = data.ChldAg;
    RootAg = data.RootAg;
    Uptime = data.Uptime;
    Version = data.Version;
    drawChart();
    setTags();
})}, 3000);
 
google.charts.load('current', {'packages': ['gauge']});
 
function drawChart() {
    var cdata = new google.visualization.DataTable();
    cdata.addColumn('string', 'Label');
    cdata.addColumn('number', 'Value');
    cdata.addRows(3);
    cdata.setValue(0, 0, 'SimFPS');
    cdata.setValue(0, 1, SimFPS);
    cdata.setValue(1, 0, 'PhyFPS');
    cdata.setValue(1, 1, PhyFPS);
    cdata.setValue(2, 0, 'Memory');
    cdata.setValue(2, 1, Memory);
    var chart = new google.visualization.Gauge(document.getElementById('chart_div'));
    var options = {width: 400, height: 120, redFrom: 90, redTo: 100, yellowFrom:75, yellowTo: 90, minorTicks: 5};
    chart.draw(cdata, options);
}
 
function setTags() {
    $("#par-version").text("Version: " + Version);
    $("#par-ragent").text("Root Agent: " + RootAg);
    $("#par-uptime").text("Uptime: "  + Uptime);
    $("#par-cagent").text("Child Agent: " + ChldAg);
}
</script>
</head>
 <body>
= jsonSimStats =
<table>
    <tr>
        <td><div id="par-version">Version:</div></td>
        <td><div id="par-ragent">Root Agent:</div></td>
    </tr>
    <tr>
        <td><div id="par-uptime">Uptime:</div></td>
        <td><div id="par-cagent">Child Agent:</div></td>
    </tr>
</table>
<div id="chart_div"></div>
</body>
</html>

Return to UXSimStatus.

Personal tools
General
About This Wiki