当前位置: 首页>>代码示例>>PHP>>正文


PHP Benchmark::StartTimer方法代码示例

本文整理汇总了PHP中Benchmark::StartTimer方法的典型用法代码示例。如果您正苦于以下问题:PHP Benchmark::StartTimer方法的具体用法?PHP Benchmark::StartTimer怎么用?PHP Benchmark::StartTimer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Benchmark的用法示例。


在下文中一共展示了Benchmark::StartTimer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: QueryServer

 function QueryServer($server)
 {
     $benchmark = new Benchmark();
     $benchmark->StartTimer("lgsl");
     $result = lgsl_query_live($server->protocol, $server->address, $server->cport, $server->qport, $server->sport, "sep");
     $benchmark->EndTimer("lgsl");
     $queryinfo = $result["b"];
     $serverinfo = $result["s"];
     $servervars = $result["e"];
     $players = $result["p"];
     /*foreach($result as $k => $v)
     	 {
     		echo "<br/><br/>$k<br/>";
     		var_dump($v);
     		}*/
     //If the server is online then copy the data over.
     if ($queryinfo["status"] == 1) {
         $server->ping = $benchmark->GetBenchmarkMilliSeconds("lgsl");
         $server->hostname = $serverinfo["name"];
         $server->game = $serverinfo["game"];
         $server->map = $serverinfo["map"];
         $server->maxplayers = $serverinfo["playersmax"];
         $server->password = $serverinfo["password"];
         if (isset($servervars["dedicated"])) {
             $server->dedicated = streq($servervars["dedicated"], "d");
         } else {
             $server->dedicated = 1;
         }
         if (isset($servervars["description"])) {
             $server->gamename = $servervars["description"];
         } else {
             $server->gamename = $server->game;
         }
         $server->setServerVars($servervars);
         $playerlist = array();
         foreach ($players as $k => $v) {
             $player = new Lan_servers_player();
             $player->name = $v["name"];
             if (isset($v["score"])) {
                 $player->score = $v["score"];
             } else {
                 if (isset($v["frags"])) {
                     $player->score = $v["frags"];
                 } else {
                     if (isset($v["rank"])) {
                         $player->score = $v["rank"];
                     } else {
                         $player->Score = "0";
                     }
                 }
             }
             if (isset($v["time"])) {
                 $player->time = $v["time"];
             } else {
                 $player->time = "";
             }
             $playerlist[] = $player;
         }
         $server->setPlayers($playerlist);
         $server->playercount = count($playerlist);
     } else {
         $server->ping = "-1";
         $playerlist = array();
         $server->setPlayers($playerlist);
         $server->maxplayers = "";
         $server->playercount = "";
     }
     return $server;
 }
开发者ID:Kayomani,项目名称:Obsidian,代码行数:69,代码来源:lgsl.php

示例2: Benchmark

<?php

//Load System functions
require_once 'util.php';
require_once 'integration/integration.php';
$benchmark = new Benchmark();
$benchmark->StartTimer("gen");
//Load system config
require_once 'config.php';
//require_once ('integration/integration.php');
//Load template libary
require_once 'libs/smarty/Smarty.class.php';
//Load Data objects
LoadDataObjects();
//Load Master
$master = new Master();
// Check LAN ID
if (getCurrentLID() == "0" || isset($_GET["lanid"])) {
    if (isset($_GET["lanid"])) {
        $lan = new Lan_events();
        $lan->id = $lan->escape($_GET["lanid"]);
        $lan->find();
        if (!$lan->fetch()) {
            die("Unknown LAN :-O");
        }
        $_SESSION["lanmode"] = $lan->mode_id;
        setCurrentLID($_GET["lanid"]);
        $master->Smarty->assign("lan", $lan);
    } else {
        die("Unknown LAN :-(");
    }
开发者ID:Kayomani,项目名称:Obsidian,代码行数:31,代码来源:core.php


注:本文中的Benchmark::StartTimer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。