示例#1
0
    echo $task['id'];
    ?>
"><?php 
    echo $task['title'];
    ?>
</a></td>
          <td><?php 
    echo date('d.m.Y h:i', $task['lastExec']);
    ?>
</td>
          <td><?php 
    echo date('d.m.Y h:i', nextExecDateTime($task));
    ?>
</td>
          <td><?php 
    echo getMemoryUsage($task);
    ?>
</td>
          <td><?php 
    echo $task['type'];
    ?>
</td>
          <td><span class="tag_<?php 
    echo strtolower($taskStatuses[$status]);
    ?>
"><?php 
    echo $taskStatuses[$status];
    ?>
<span></td>
          <td class="align-right">
            <form method="post">
<?php

/*
	This script tests the memory issues in the ranking API.
*/
// Fetch ALL players
define('DISABLE_STATIC_FACTORY', true);
$db = Neuron_Core_Database::__getInstance();
$players = $db->getDataFromQuery($db->customQuery("\n\t\tSELECT\n\t\t\tn_players.*, \n\t\t\tSUM(villages.networth) AS score\n\t\tFROM\n\t\t\tn_players\n\t\tLEFT JOIN\n\t\t\tvillages ON villages.plid = n_players.plid\n\t\tWHERE\n\t\t\tn_players.plid IS NOT NULL \n\t\t\tAND villages.vid IS NOT NULL\n\t\t\tAND villages.isActive = 1\n\t\t\tAND n_players.isPlaying = '1' \n\t\t\tAND n_players.isRemoved = '0'\n\t\tGROUP BY\n\t\t\tvillages.vid\n\t\tORDER BY\n\t\t\tscore DESC,\n\t\t\tLOWER(n_players.nickname) ASC\n\t"));
$last = memory_get_usage();
$run = 0;
function getMemoryUsage()
{
    global $last;
    global $run;
    $usage = memory_get_usage();
    $out = "Run " . $run . ": " . number_format($usage) . ' <span style="color: green;">' . ($usage - $last) . '</span>';
    $last = $usage;
    $run++;
    return $out;
}
echo '<pre>';
echo 'Memory usage (initial) ' . getMemoryUsage() . "\n";
foreach ($players as $v) {
    $objPlayer = Neuron_GameServer::getPlayer($v['plid'], $v);
    $tmp = $objPlayer->getBrowserBasedGamesData();
    $objPlayer->__destruct();
    unset($objPlayer);
    echo getMemoryUsage() . "\n";
}
echo '</pre>';