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


PHP Timer::get方法代码示例

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


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

示例1: getSingleBenchmarkTimeSecs

/**
 * Returns single benchmark time in seconds
 *
 * @param string $benchmarkLambdaFunction Benchmark lambda function
 * @param array $benchmarkFunctionArgumentsArray Benchmark arguments array
 *
 * @return float
 */
function getSingleBenchmarkTimeSecs($benchmarkLambdaFunction, array $benchmarkFunctionArgumentsArray)
{
    $autoStartTimer = 1;
    $timer = new Timer($autoStartTimer);
    call_user_func_array($benchmarkLambdaFunction, $benchmarkFunctionArgumentsArray);
    return $timer->get();
}
开发者ID:OlOst,项目名称:magecert_ce,代码行数:15,代码来源:benchmark_cat_save.php

示例2: render

 private function render($controller, $is404 = false)
 {
     $response = thin('response');
     if (!$is404) {
         $response->setStatusCode(200, 'OK');
     } else {
         $response->setStatusCode(404, 'Not Found');
     }
     ob_start();
     $response->sendHeaders()->setContent($this->html($controller))->send();
     $html = ob_get_contents();
     ob_end_clean();
     die($html . '<!-- generated in ' . Timer::get() . ' s. -->');
 }
开发者ID:schpill,项目名称:standalone,代码行数:14,代码来源:routes.php

示例3: pushToSession

 public function pushToSession($account_id, array $data = [])
 {
     $session = Model::Sessionmobile()->firstOrCreate(['account_id' => (int) $account_id]);
     if ($session) {
         $session = $session->toArray();
         $regid = isAke($session, 'regid', false);
         $socket_id = isAke($session, 'socket_id', false);
         // if ($regid) {
         //     $this->send([$regid], $data);
         // }
         if ($socket_id) {
             $io = lib('io');
             $data['id'] = $socket_id;
             $message = $io->emit('bump', $data);
         }
         return Timer::get();
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:18,代码来源:notification.php

示例4: finish

 public static function finish()
 {
     $time = Timer::get();
 }
开发者ID:schpill,项目名称:jsoncms,代码行数:4,代码来源:index.php

示例5: showStats

 public static function showStats()
 {
     Timer::stop();
     $executionTime = Timer::get();
     $queries = null === Utils::get('NbQueries') ? 0 : Utils::get('NbQueries');
     $valQueries = $queries < 2 ? 'SQL Query executed' : 'SQL Queries executed';
     $SQLDuration = null === Utils::get('SQLTotalDuration') ? 0 : Utils::get('SQLTotalDuration');
     $queriesNoSQL = null === Utils::get('NbQueriesNOSQL') ? 0 : Utils::get('NbQueriesNOSQL');
     $valQueriesNoSQL = $queriesNoSQL < 2 ? 'NoSQL Query executed' : 'NoSQL Queries executed';
     $SQLDurationNoSQL = null === Utils::get('SQLTotalDurationNOSQL') ? 0 : Utils::get('SQLTotalDurationNOSQL');
     $execPHPSQL = $executionTime - $SQLDuration;
     $execPHPNoSQL = $executionTime - $SQLDurationNoSQL;
     $execPHP = $executionTime - $SQLDuration;
     $PCPhp = round($execPHP / $executionTime * 100, 2);
     $PCPhpSQL = round($execPHPSQL / $executionTime * 100, 2);
     $PCPhpNoSQL = round($execPHPNoSQL / $executionTime * 100, 2);
     $PCSQL = 100 - $PCPhpSQL;
     $PCNoSQL = 100 - $PCPhpNoSQL;
     $included = count(get_included_files());
     return "\n<!--\n\n\tPage generated in {$executionTime} s. by Thin Framework (C) www.geraldplusquellec.me 1996 - " . date('Y') . "\n\t{$queries} {$valQueries} in {$SQLDuration} s. (" . $PCSQL . " %)\n\t{$queriesNoSQL} {$valQueriesNoSQL} in {$SQLDurationNoSQL} s. (" . $PCNoSQL . " %)\n\tPHP Execution {$execPHP} s. ({$PCPhp} %)\n\n\n\n\t" . $included . " scripts included\n\tUsed Memory : " . convertSize(memory_get_usage()) . "\n\n-->";
 }
开发者ID:noikiy,项目名称:inovi,代码行数:21,代码来源:View.php

示例6: fclose

            }
        }
    }
    fclose($handle);
}
if ($db == NULL || $user == NULL || $pass == NULL || $host == NULL) {
    echo "Something went wrong trying to grab the connection data\n";
    echo "db={$db}; user={$user}; pass={$pass}; host={$host}";
    exit;
}
$db = new mysqli($host, $user, $pass, $db);
if ($db->connect_errno > 0) {
    die("Unable to connect to the database [ " . $db->connect_error . " ]");
}
echo "\n ";
echo "DB connection established at \t\t" . $timer->get() . " secs\n ";
$db->query("DROP TABLE IF EXISTS TEST_TBL");
$tableCreate = "CREATE TABLE TEST_TBL ( id int(11) NOT NULL auto_increment , txt TEXT , PRIMARY KEY (id))";
if ($db->query($tableCreate) === FALSE) {
    die("Error creating the table [ " . $db->error . " ]");
} else {
    echo "Table created at \t\t\t" . $timer->get() . " secs\n ";
    echo "Generating random data\t\t\t";
    for ($i = 1; $i <= 1000; $i++) {
        if ($i % 66 == 0) {
            echo ".";
        }
        if ($i == 1000) {
            echo "\n ";
        }
        if (!($insert = $db->query("INSERT INTO TEST_TBL (txt) VALUES ('" . $timer->randString(25) . "')"))) {
开发者ID:Brother-Simon,项目名称:simple-mysql-bench,代码行数:31,代码来源:mysql_bench.php

示例7: timeIntervalStr

    // Show spinner phase and status
    $time = $timer->get();
    if ($time >= 1) {
        $timeSpent = timeIntervalStr($timer->get());
    } else {
        $timeSpent = '-';
    }
    $timeSpentText = $GColors->getColoredString("[{$timeSpent}]", $GTimeTextColor);
    $statusText = $GColors->getColoredString($GStatusText, $GStatusTextColor);
    $memUsage = formatBytes(memory_get_usage(true));
    $memUsageText = $GColors->getColoredString("[{$memUsage}]", 'yellow');
    echo "\r{$spinnerChars[$spinnerPhase]} {$timeSpentText} {$memUsageText} {$statusText}";
    // Change phase
    $spinnerPhase = $spinnerPhase < count($spinnerChars) - 1 ? $spinnerPhase + 1 : 0;
});
$GScriptTimer = new Timer(1);
register_shutdown_function(function () use($GScriptTimer, $GColors) {
    $time = $GScriptTimer->get();
    if ($time >= 1) {
        $timeSpent = timeIntervalStr($time);
    } else {
        $timeSpent = 'less then a second';
    }
    if (is_callable('beforeShutdown')) {
        beforeShutdown();
    }
    $timeText = $GColors->getColoredString($timeSpent, 'light_blue');
    $doneMsg = " DONE. Time spent: {$timeText} ";
    $doneText = str_repeat('*', 3) . $doneMsg;
    echo $GColors->getColoredString("\n{$doneText}\n", 'light_green');
});
开发者ID:OlOst,项目名称:magecert_ce,代码行数:31,代码来源:script_base.php

示例8: printAndStop

 /**
  * Prints the current timer value and stops the timer.
  *
  * @param string $ps_name Name of timer
  * @param string $ps_message Formatting string for display. String may contain placeholders for time (%time) and timer name (%name). [Default is "[%name] %time seconds<br/>\n"]
  * @param array $pa_option Options include:
  *		decimals = Number of decimal places to display [Default is 6]
  *
  * @return void
  */
 static function printAndStop($ps_name, $ps_message = "[%name] %time seconds<br/>\n", $pa_options = null)
 {
     print Timer::get($ps_name, $ps_message, $pa_options);
     return Timer::stop($ps_name);
 }
开发者ID:samrahman,项目名称:providence,代码行数:15,代码来源:Timer.php

示例9: foreach

			</div>
		</div>
    	<div class="debuginfo break">
        <p>
        <?php
        foreach($genotypes as $id => $genotype)
        {
            echo "<h3>Debug data for genotype nr $id: </h3><p>";
            foreach($genotype as $note)
            {
                $degreeInfo = $music->getDegreeWithOctaveFromNote($note, MusicScales::Major(), NoteSearchMode::UP);
                echo $music->getHumanReadableNoteFromDegree($degreeInfo, 'American').', ';
            }
            echo '</p>';
        }
        if (defined('DEBUG'))
        {
            echo '<div class="debuglog"><pre>';
            echo nl2br(file_get_contents(DEBUG.'/log.txt'), true);
            echo '</pre></div>';
            unlink(DEBUG.'/log.txt');
        }
        $mainTimer->stop();
        echo '<p>Page generation time: '.$mainTimer->get().'</p>';
        ?>
        </p>
        </div>
	</div>
</div>
</body>
</html>
开发者ID:niieani,项目名称:nandu,代码行数:31,代码来源:index.php

示例10: run_test

function run_test($all_t)
{
    echo 'Start test ' . $all_t . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    $timer = new Timer(1);
    $servername = "localhost";
    $username = "root";
    $password = "";
    $database = 'randomy';
    $looper = 10;
    // Create connection
    $conn = mysqli_connect($servername, $username, $password);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    // Create database
    $sql = "CREATE DATABASE " . $database;
    if ($conn->query($sql) === TRUE) {
        $time1 = $timer->get();
        echo "Start(pass) " . $time1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
    } else {
        echo "Error creating database: " . $conn->error . '<br>';
        //echo 'Database Exists';
        $time1 = $timer->get();
        echo "Start(fail) " . $time1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
    }
    $conn->close();
    $time_2 = $time_3 = $time_4 = $time_5 = array();
    for ($ff = 1; $ff <= $looper; $ff++) {
        $mysqli = mysqli_connect($servername, $username, $password, $database) or die("could not connect to mysql");
        $time_2[] = $timer->get();
        //echo  "<br>Db connection established  at  : " . $timer->get() . "<br \> " ;
        // Create an sql command structure for creating a table
        $tableCreate = "CREATE TABLE IF NOT EXISTS test_tbl (\n                                          id int(11) NOT NULL auto_increment ,\n                                          RandomTxt TEXT ,\n                                          RandomTxty TEXT,\n                                          PRIMARY KEY (id)\n                                          ) ";
        // This line uses the mysqli_query() function to create the table now
        $queryResult = mysqli_query($mysqli, $tableCreate);
        $time_3[] = $timer->get();
        //echo  "Table created at  : " . $timer->get() . "<br \> " ;
        // Create a conditional to see if the query executed successfully or not
        if ($queryResult === TRUE) {
            for ($i = 1; $i <= 1000; $i++) {
                mysqli_query($mysqli, "INSERT INTO Test_tbl (RandomTxt,RandomTxty) VALUES ('abcdefghklmnopqrsst','abcdefghklmnopqrsst')");
            }
        } else {
            print "<br /><br />No TABLE created. Check";
        }
        $time_4[] = $timer->get();
        //echo  "Data inserted into the table at  : " . $timer->get() . "<br \> " ;
        $result = mysqli_query($mysqli, 'SELECT * FROM Test_tbl');
        $arrayResults = array();
        while ($row = $result->fetch_assoc()) {
            array_push($arrayResults, $row['RandomTxt']);
        }
        $time_5[] = $timer->get();
        //echo "Data is read from table and inserted into an array at  : ". $timer->get() . "" ;
        //print_r($arrayResults) ;
        $mysqli->close();
    }
    //drop database
    //drop database
    $connt = mysqli_connect($servername, $username, $password);
    // Check connection
    if ($connt->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    // Create database
    $sql = "DROP DATABASE " . $database;
    if ($connt->query($sql) === TRUE) {
        $time10 = $timer->get();
        echo " End(pass): " . $time10;
    } else {
        //echo "Error creating database: " . $conn->error;
        //echo 'Database Exists';
        $time10 = $timer->get();
        echo " End(fail) " . $time10;
    }
    $connt->close();
    ?>
<BR>
<table class="my_sup_table">
  <tbody>
    <tr>
      <td>&nbsp;</td>
      <?php 
    for ($ff = 0; $ff < $looper; $ff++) {
        ?>
       <td> Test <?php 
        echo $ff + 1;
        ?>
</td>
      <?php 
    }
    ?>
    </tr>
    <tr>
      <td>Connection established</td>
      <?php 
    for ($ff = 0; $ff < $looper; $ff++) {
        ?>
       <td><?php 
//.........这里部分代码省略.........
开发者ID:evansonbiwot,项目名称:stressdb,代码行数:101,代码来源:Mysql.php

示例11: run_test

function run_test($all_t)
{
    echo 'Start test ' . $all_t . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
    $timer = new Timer(1);
    $servername = "localhost";
    $username = "root";
    $password = "";
    $database = 'randomy';
    $looper = 15;
    // Create connection
    //$conn = mysqli_connect($servername, $username, $password);
    try {
        $dbh = new PDO('mysql:host=' . $servername . ';', $username, $password);
        $stmt = $dbh->query("CREATE DATABASE " . $database);
        $time1 = $timer->get();
        echo "Start(pass) " . $time1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
        $dbh = null;
    } catch (PDOException $e) {
        print "Error!: " . $e->getMessage() . "<br/>";
        $time1 = $timer->get();
        echo "Start(fail) " . $time1 . '&nbsp;&nbsp;&nbsp;&nbsp;';
        die;
    }
    $time_2 = $time_3 = $time_4 = $time_5 = array();
    for ($ff = 1; $ff <= $looper; $ff++) {
        //$mysqli = mysqli_connect($servername,$username,$password, $database) ;
        $mysqli = new PDO('mysql:host=' . $servername . ';dbname=' . $database, $username, $password);
        $time_2[] = $timer->get();
        $tableCreate = "CREATE TABLE IF NOT EXISTS test_tbl (\n                                          id int(11) NOT NULL auto_increment ,\n                                          RandomTxt TEXT ,\n                                          RandomTxty TEXT,\n                                          PRIMARY KEY (id)\n                                          ) ";
        try {
            $stmt = $mysqli->query($tableCreate);
            $time1 = $timer->get();
            //echo "table created ".$time1.'&nbsp;&nbsp;&nbsp;&nbsp;';
            $time_3[] = $timer->get();
        } catch (PDOException $e) {
            print "Error!: " . $e->getMessage() . "<br/>";
            $time_3[] = $timer->get();
            echo "unable to create table ";
        }
        //echo  "Table created at  : " . $timer->get() . "<br \> " ;
        // Create a conditional to see if the query executed successfully or not
        for ($i = 1; $i <= 1000; $i++) {
            $mysqli->query("INSERT INTO Test_tbl (RandomTxt,RandomTxty) VALUES ('abcdefghklmnopqrsst','abcdefghklmnopqrsst')");
        }
        $time_4[] = $timer->get();
        $arrayResults_data = [];
        foreach ($mysqli->query('SELECT * from Test_tbl') as $arrayResults) {
            $arrayResults_data[] = $arrayResults;
            // print_r($arrayResults);
        }
        $time_5[] = $timer->get();
        //echo "Data is read from table and inserted into an array at  : ". $timer->get() . "" ;
        //print_r($arrayResults) ;
        $mysqli = null;
    }
    //drop database
    //drop database
    //$connt = mysqli_connect($servername, $username, $password);
    try {
        $dbh2 = new PDO('mysql:host=' . $servername . ';', $username, $password);
        $stmt = $dbh2->query("DROP DATABASE " . $database);
        $time10 = $timer->get();
        echo "End(pass) " . $time10 . '&nbsp;&nbsp;&nbsp;&nbsp;';
        $dbh2 = null;
    } catch (PDOException $e) {
        print "Error!: " . $e->getMessage() . "";
        $time10 = $timer->get();
        echo "End(fail) " . $time10 . '&nbsp;&nbsp;&nbsp;&nbsp;';
        die;
    }
    ?>
<BR>
<table class="my_sup_table">
  <tbody>
    <tr>
      <td>&nbsp;</td>
      <?php 
    for ($ff = 0; $ff < $looper; $ff++) {
        ?>
       <td> Test <?php 
        echo $ff + 1;
        ?>
</td>
      <?php 
    }
    ?>
    </tr>
    <tr>
      <td>Connection established</td>
      <?php 
    for ($ff = 0; $ff < $looper; $ff++) {
        ?>
       <td><?php 
        if ($ff > 0) {
            if (isset($time_5[$ff - 1])) {
                $first = roundme($time_2[$ff] - $time_5[$ff - 1]);
            } else {
                $first = roundme($time_2[$ff] - $time1);
            }
        } else {
//.........这里部分代码省略.........
开发者ID:evansonbiwot,项目名称:stressdb,代码行数:101,代码来源:PDO.php

示例12: foreach

            $classifiers[$k] = $v[$_POST['set']];
            if ($suppressThreshold) {
                $classifiers[$k]['threshold'] = 0.0;
            }
        }
    }
    // utwórz obiekty klasyfikatorów, obiekty czasomierzy a nastêpnie klasyfikuj
    foreach ($classifiers as $k => $v) {
        $tmpc = new ReflectionClass($k);
        $classObj[$k] = $tmpc->newInstance($db, $dictionaries, $_POST['set'], false, $v);
        $time = new Timer();
        if (is_null($prepText)) {
            $time->set('start');
            $prepText = $classObj[$k]->doPreparation($_POST['comment']);
            $time->set('doPreparation');
            $prepResult['time'] = '<b>' . $time->format($time->get('doPreparation')) . '</b>';
            if ($prepText === false) {
                break;
            }
        }
        $time->set('start');
        $results[$k] = $classObj[$k]->doClassify($prepText, true);
        $time->set('doClassify');
        $times[$k] = $time->format($time->get('doClassify'));
    }
    unset($classObj);
    $prepResult['org'] = $_POST['comment'];
    ?>
<!--<h4>Testowany komentarz</h4>
<textarea readonly="true" cols="60" rows="15" name="comment" id="comment" title="Tre¶æ komentarza">
<?php 
开发者ID:gluwer,项目名称:categorization,代码行数:31,代码来源:demo.php

示例13: logTime

 function logTime($key)
 {
     MateApplication::logValue($key, Timer::get());
 }
开发者ID:NerdZombies,项目名称:MateCode,代码行数:4,代码来源:MateApplication.php


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