Exemplo n.º 1
0
 public function loadData()
 {
     $id = $this->id;
     if ($id) {
         $data = Cache::getObject($id);
         if (!$data || (int) util::array_get($_GET['nocache']) === 1 && DEBUGGING) {
             $data = $this->storage->get($id);
             $data = TimingsMaster::createObject(json_decode($data));
             Cache::putObject($id, $data);
         }
         $this->data = $data;
         $GLOBALS['timingsData'] = $data;
     }
 }
Exemplo n.º 2
0
 public static function loadData()
 {
     global $ini;
     $timings = Timings::getInstance();
     $timings->loadData();
     $data = TimingsMaster::getInstance();
     $tpl = self::getInstance();
     $ranges = [];
     $first = -1;
     foreach ($data->data as $history) {
         $ranges[] = $history->start;
         $ranges[] = $history->end;
         if ($first === -1 || $first > $history->start) {
             $first = $history->start;
         }
     }
     $ranges = array_values(array_unique($ranges));
     //$ranges = array_unique($ranges);
     //sort($ranges);
     $last = count($ranges) - 1;
     $tpl->js['ranges'] = $ranges;
     $defStart = (int) ($timings->id === $ini['dev_id'] && !empty($ini['dev_def_start']) ? $ini['dev_def_start'] : $ranges[0]);
     $defEnd = (int) ($timings->id === $ini['dev_id'] && !empty($ini['dev_def_end']) ? $ini['dev_def_end'] : $ranges[$last]);
     $tpl->js['start'] = $start = (int) (!empty($_GET['start']) ? $_GET['start'] : $defStart);
     $tpl->js['end'] = $end = (int) (!empty($_GET['end']) ? $_GET['end'] : $defEnd);
     /**
      * @var TimingHandler[] $handlerData
      */
     $handlerData = [];
     $lagData = [];
     $tpsData = [];
     $tentData = [];
     $entData = [];
     $aentData = [];
     $chunkData = [];
     $playerData = [];
     $timestamps = [];
     $masterHandler = null;
     $max = 0;
     $areaMap = [];
     foreach ($data->data as $history) {
         $tileEntities = 0;
         $entities = 0;
         $chunks = 0;
         $players = 0;
         foreach ($history->worldData as $world) {
             foreach ($world->chunks as $chunk) {
                 $areaId = $chunk->areaId;
                 if (!array_key_exists($areaId, $areaMap)) {
                     $areaMap[$areaId] = ["count" => 0, "x" => $chunk->areaLocX, "z" => $chunk->areaLocZ, "e" => [], "ec" => 0, "te" => [], "tec" => 0];
                 }
                 $areaMap[$areaId]['count']++;
                 foreach ($chunk->tileEntities as $id => $count) {
                     $areaMap[$areaId]['te'][$id] += $count;
                     $areaMap[$areaId]['tec'] += $count;
                 }
                 foreach ($chunk->entities as $id => $count) {
                     $areaMap[$areaId]['e'][$id] += $count;
                     $areaMap[$areaId]['ec'] += $count;
                 }
                 $chunks++;
             }
         }
         $firstMP = $history->minuteReports[0];
         for ($i = $firstMP->time; $i - $first < 65; $i += 60) {
             $clone = clone $firstMP;
             $clone->time = $first;
             array_unshift($history->minuteReports, $clone);
         }
         foreach ($history->minuteReports as $mp) {
             $total = $mp->fullServerTick->total;
             $lag = $mp->fullServerTick->lagTotal;
             $max = max($total, $max);
             $timestamps[] = $mp->time;
             $tpsData[] = $mp->tps > 19.85 ? 20 : $mp->tps;
             $lagData[] = $lag;
             $chunkData[] = $chunks;
             $entData[] = $mp->ticks->entityTicks / $mp->ticks->timedTicks;
             $playerData[] = $mp->ticks->playerTicks / $mp->ticks->timedTicks;
             $aentData[] = $mp->ticks->activatedEntityTicks / $mp->ticks->timedTicks;
             $tentData[] = $mp->ticks->tileEntityTicks / $mp->ticks->timedTicks;
         }
         if ($history->start >= $start && $history->end <= $end) {
             foreach ($history->handlers as $handler) {
                 $id = $handler->id->id;
                 if (!array_key_exists($id, $handlerData)) {
                     $handlerData[$id] = clone $handler;
                     $handlerData[$id]->mergedCount = 1;
                 } else {
                     $handlerData[$id]->addDataFromHandler($handler);
                 }
                 if ($handler->id->name === "Full Server Tick" && $masterHandler === null) {
                     $masterHandler = $handlerData[$id];
                 }
             }
         }
     }
     if (DEBUGGING && util::array_get($_GET['showmaster'])) {
         util::var_dump($masterHandler);
     }
     $tpl->handlerData = $handlerData;
     $tpl->js['stamps'] = $timestamps;
     $tpl->js['maxTime'] = $max;
     $tpl->js['chunkData'] = $chunkData;
     $tpl->js['entData'] = $entData;
     $tpl->js['aentData'] = $aentData;
     $tpl->js['tentData'] = $tentData;
     $tpl->js['plaData'] = $playerData;
     $tpl->js['lagData'] = $lagData;
     $tpl->js['tpsData'] = $tpsData;
     $tpl->js['id'] = $timings->id;
     $tpl->lagData = $lagData;
     $tpl->tpsData = $tpsData;
     $tpl->masterHandler = $masterHandler;
 }
Exemplo n.º 3
0
$tpl = Template::getInstance();
global $totalTime;
$totalTime = 0;
$totalTimings = 0;
foreach ($timingsData->data as $data) {
    $totalTime += $data->totalTime;
    //var_dump($data->minuteReports);
    foreach ($data->handlers as $handler) {
        $totalTimings += $handler->count;
    }
}
global $section, $propTotal, $propCount;
define('LAG_ONLY', $section === 'lag');
$propTotal = LAG_ONLY ? 'lagTotal' : 'total';
$propCount = LAG_ONLY ? 'lagCount' : 'count';
define('NOFILTER', !empty(util::array_get($_GET['nofilter'])));
//http://timings.aikar.co/dev/?id=2a72cf2099e0439780c91e64abadcf7d&start=1436841958&end=1436843422
$lag = $tpl->masterHandler->children;
?>
<div class="full-timing-row">
	<div class="indent depth1 full-depth1"></div>
	<div class="timing-row">
<?php 
printRecord($tpl->masterHandler);
?>
	</div>
</div>
<?php 
usort($lag, 'lagSort');
printRows($lag, 1);
$cost = $timingsData->system->timingcost * 1.1;
Exemplo n.º 4
0
"
			><?php 
echo util::esc($timingsData->server);
?>
</b> (max: <?php 
echo util::esc($timingsData->maxplayers);
?>
)</span><br />
	<span>MOTD: <b><?php 
echo util::mccolor(util::esc($timingsData->motd));
?>
</b></span><br />
	<span>Version: <b><?php 
echo util::esc($timingsData->version);
?>
</b></span><br />
	<span title="OS: <?php 
echo util::esc("{$system->name} {$system->version} {$system->arch} CPU: {$system->cpu}");
?>
">
		Uptime: <b><?php 
echo util::esc(round($system->runtime / 60 / 60 / 1000, 2));
?>
hr</b> -
		Memory: <b><?php 
echo util::esc($system->maxmem / 1024 / 1024);
?>
MB</b>
	</span>
</div>