1
0
Fork 0

show stats

master
Chris 2021-01-08 15:14:09 +01:00
parent da1fad0ae1
commit 199920942e
1 changed files with 41 additions and 1 deletions

View File

@ -2,6 +2,44 @@
$HTML->setHTMLTitle("Deine Regionen"); $HTML->setHTMLTitle("Deine Regionen");
$HTML->importSeitenInhalt("pages/HTML/deine-regionen.html"); $HTML->importSeitenInhalt("pages/HTML/deine-regionen.html");
function cleanSize($bytes)
{
if ($bytes > 0)
{
$unit = intval(log($bytes, 1024));
$units = array('B', 'KB', 'MB', 'GB');
if (array_key_exists($unit, $units) === true)
{
return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]);
}
}
return $bytes;
}
function getRegionStatsData($regionID)
{
global $RUNTIME;
$statement = $RUNTIME['PDO']->prepare("SELECT * FROM regions_info WHERE regionID = ?");
$statement->execute([$regionID]);
if($row = $statement->fetch())
{
$return = array();
$return['Prims'] = $row['Prims'];
$return['SimFPS'] = $row['SimFPS'];
$return['PhyFPS'] = $row['PhyFPS'];
$return['ProcMem'] = cleanSize(str_replace(".", "", str_replace(",", ".", $row['ProcMem']))."000");
$return['RegionVersion'] = $row['RegionVersion'];
return $return;
}
return array();
}
if(@$_REQUEST['action'] == 'remove' && @$_REQUEST['region'] != '') if(@$_REQUEST['action'] == 'remove' && @$_REQUEST['region'] != '')
{ {
if(@$_SESSION['LEVEL'] >= 100) if(@$_SESSION['LEVEL'] >= 100)
@ -29,7 +67,9 @@
while($row = $statement->fetch()) while($row = $statement->fetch())
{ {
$entry = '<tr><td>'.$row['regionName'].'</td><td>'.$RUNTIME['OPENSIM']->getUserName($row['owner_uuid']).'</td><td>'.fillString(($row['locX'] / 256), 4).' / '.fillString(($row['locY'] / 256), 4).'</td><td><a href="index.php?page=regions&action=remove&region='.$row['uuid'].'">LÖSCHEN</a></td></tr>'; $stats = getRegionStatsData($row['uuid']);
$entry = '<tr><td>'.$row['regionName'].'<div class="blockquote-footer">Prims: '.$stats['Prims'].'; RAM-Nutzung: '.$stats['ProcMem'].'; SIM/PHYS FPS: '.$stats['SimFPS'].'/'.$stats['PhyFPS'].' ('.$stats['RegionVersion'].')</div></td><td>'.$RUNTIME['OPENSIM']->getUserName($row['owner_uuid']).'</td><td>'.fillString(($row['locX'] / 256), 4).' / '.fillString(($row['locY'] / 256), 4).'</td><td><a href="index.php?page=regions&action=remove&region='.$row['uuid'].'">LÖSCHEN</a></td></tr>';
$table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table); $table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table);
} }