本文整理汇总了PHP中microtime_float函数的典型用法代码示例。如果您正苦于以下问题:PHP microtime_float函数的具体用法?PHP microtime_float怎么用?PHP microtime_float使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了microtime_float函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: print_time
function print_time($cmnt = '')
{
static $cal_nom = 0;
global $time_start;
$cal_nom++;
echo '<hr>time: ' . (microtime_float() - $time_start) * 1000 . " ms ({$cal_nom}) [{$cmnt}]<br>";
}
开发者ID:valmat,项目名称:Cacher,代码行数:7,代码来源:demo-multiget.php
示例2: hit_
function hit_($url, $vhost = NULL, $login = NULL, $password = NULL)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (!empty($login) and !empty($password)) {
curl_setopt($ch, CURLOPT_USERPWD, "{$login}:{$password}");
}
if (!empty($vhost)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: {$vhost}"));
}
curl_setopt($ch, CURLOPT_NOBODY, true);
$start = microtime_float();
if (!curl_exec($ch)) {
die("Cant exec curl request!");
}
$end = microtime_float();
$status = curl_getinfo($ch);
if ($status['http_code'] != 200) {
die("Http repsponse code {$status['http_code']} returned by {$url}!");
}
//print_r(curl_getinfo($ch));
curl_close($ch);
$delta = round($end - $start, 1);
if ($delta < 1) {
// echo ".";
$delta = round($end - $start, 1);
} else {
// echo "-${delta}-";
$delta = round($delta, 0);
}
return $delta;
}
开发者ID:Zanop,项目名称:CDN-Tools,代码行数:32,代码来源:surl.php
示例3: GetOutput
public function GetOutput($Db)
{
/*<img src="http://image.eveonline.com/Character/<?php echo $chid; ?>_256.jpg" height=118 width=118>*/
$full_url = FULL_URL;
// TODO
$time_start = microtime_float();
$corpinf = cache_api_retrieve($Db, "/corp/CorporationSheet.xml.aspx", array("corporationID" => CORP_ID), 3 * 24 * 60 * 60)->value;
$this->Title = "About " . $corpinf->result->corporationName;
$time_end = microtime_float();
$time_api = $time_end - $time_start;
$this->Output .= <<<EOD
<table><tr><td>
<img src="http://image.eveonline.com/Corporation/{$corpinf->result->corporationID}_128.png" height=108 width=108>
</td><td valign=top>
<table>
<tr><td>CEO </td><td>{$corpinf->result->ceoName}</tr>
<tr><td>Members </td><td>{$corpinf->result->memberCount}</tr>
<tr><td>Tax </td><td>{$corpinf->result->taxRate}%</tr>
<tr><td>URL </td><td><a href="{$corpinf->result->url}" target="_blank">{$corpinf->result->url}</a></td></tr>
EOD;
if ((int) $corpinf->result->allianceID != 0) {
$this->Output .= "<tr><td>Alliance </td><td>" . $corpinf->result->allianceName . "</tr>";
}
$this->Output .= "\r\n\t\t</table>\r\n\t\t</td></table>\r\n\t\t<br>\r\n\t\t<div>";
$this->Output .= parse_ccptml($corpinf->result->description);
$this->Output .= "</div><br>";
$this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
return true;
}
开发者ID:Covert-Inferno,项目名称:eve-jacknife,代码行数:29,代码来源:auditorAboutPage.class.php
示例4: gwbbcodize
function gwbbcodize($t)
{
$start = microtime_float();
// Replace all '['s inside [pre]..[/pre] by '['
if (!defined('SMF')) {
//SMF uses the [pre] tag already
$t = preg_replace_callback('#\\[pre\\](.*?)\\[\\/pre\\]#isS', 'pre_replace', $t);
}
$t = preg_replace_callback('#\\[nobb\\](.*?)\\[\\/nobb\\]#isS', 'pre_replace', $t);
// [rand seed=465468 players=2]
$t = preg_replace_callback('#\\[rand([^\\]]*)\\]#isS', 'rand_replace', $t);
// Manage [build=...]
$t = preg_replace_callback('#\\[build=([^\\]]*)\\]\\]?(\\[/build\\])?\\r?\\n?#isS', 'build_id_replace', $t);
// Manage [build_name;template_code]
$t = preg_replace_callback('#\\[(([^]\\r\\n]+);([^];\\r\\n]+))\\]\\r?\\n?#isS', 'build_id_replace', $t);
// Replace all [skill_name] by [skill]skill_name[/skill] if skill_name is a valid skill name
$t = preg_replace_callback('#\\[(.*?)\\]#isS', 'skill_name_replace', $t);
// Manage [build]...[/build]
$t = preg_replace_callback('#\\[build ([^\\]]*)\\](.*?)\\[/build\\]\\r?\\n?#isS', 'build_replace', $t);
// Manage [skill]...[/skill]
$t = preg_replace_callback('#\\[skill([^\\]]*)\\](.*?)\\[/skill\\][ ]?#isS', 'skill_replace', $t);
// [pickup="arheu"]
$t = preg_replace_callback('#\\[pickup([^\\]]*)\\]#isS', 'pickup_replace', $t);
//[gwbbcode runtime]
if (preg_match('@\\[gwbbcode runtime\\]@i', $t) !== false) {
$t = preg_replace('@\\[gwbbcode runtime\\]@i', round(microtime_float() - $start, 3), $t);
}
//Precise enough
//Trick to use in MyBB against <p> elements screwing up first skill div, and some ending <br /> being removed
if (defined('IN_MYBB')) {
$t = '</p>' . $t;
$t = str_replace("</div>\n", "</div><br>", $t);
}
return $t;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:gwbbcode.inc.php
示例5: de_jong
function de_jong(&$im, $x, $y, $a, $b, $c, $d)
{
$i = 0;
$xsize = imagesx($im);
$yzise = imagesy($im);
$xn = sin($a * $y) - cos($b * $x);
$yn = sin($c * $x) - cos($d * $y);
$x = $xn;
$y = $yn;
$time = microtime_float();
while (imagecolorat($im, round((imagesx($im) - 1) * $x / 4) + (imagesx($im) - 1) / 2, round((imagesy($im) - 1) * $y / 4) + (imagesy($im) - 1) / 2) !== 0xffffff) {
$i++;
$color = imagecolorat($im, round((imagesx($im) - 1) * $x / 4) + (imagesx($im) - 1) / 2, round((imagesy($im) - 1) * $y / 4) + (imagesy($im) - 1) / 2);
$color += 0x10101;
imagesetpixel($im, round((imagesx($im) - 1) * $x / 4) + (imagesx($im) - 1) / 2, round((imagesy($im) - 1) * $y / 4) + (imagesy($im) - 1) / 2, $color);
$xn = sin($a * $y) - cos($b * $x);
$yn = sin($c * $x) - cos($d * $y);
$x = $xn;
$y = $yn;
}
if (microtime_float() - $time > 0.1) {
echo "\r" . round($i / (microtime_float() - $time)) . " steps per second";
}
return $i;
}
开发者ID:numist,项目名称:plot-timeline,代码行数:25,代码来源:dejong.php
示例6: query
function query($sql, $unbuffered = false)
{
if (strlen($sql) > 140000) {
exit('Insane query. Aborting.');
}
if (defined('OPENLD_SHOW_QUERIES')) {
$q_start = microtime_float();
}
if ($unbuffered) {
$this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
} else {
$this->query_result = @mysql_query($sql, $this->link_id);
}
if ($this->query_result) {
if (defined('OPENLD_SHOW_QUERIES')) {
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
}
++$this->num_queries;
return $this->query_result;
} else {
if (defined('OPENLD_SHOW_QUERIES')) {
$this->saved_queries[] = array($sql, 0);
}
return false;
}
}
开发者ID:Dawzz,项目名称:Open-Link-Directory,代码行数:26,代码来源:mysql.php
示例7: query
function query($sql, $unbuffered = false)
{
if (strlen($sql) > 140000) {
exit('Insane query. Aborting.');
}
if (defined('OPENLD_SHOW_QUERIES')) {
$q_start = microtime_float();
}
$this->query_result = @mysqli_query($this->link_id, $sql);
if ($this->query_result) {
if (defined('OPENLD_SHOW_QUERIES')) {
$this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
}
++$this->num_queries;
return $this->query_result;
} else {
if (defined('OPENLD_SHOW_QUERIES')) {
$this->saved_queries[] = array($sql, 0);
}
// Rollback transaction
if ($this->in_transaction) {
mysqli_query($this->link_id, 'ROLLBACK');
}
--$this->in_transaction;
return false;
}
}
开发者ID:Dawzz,项目名称:Open-Link-Directory,代码行数:27,代码来源:mysqli_innodb.php
示例8: microtime_run
function microtime_run()
{
$StartTime = empty($GLOBALS['StartTime']) ? microtime_float() : $GLOBALS['StartTime'];
$EndTime = microtime_float();
$RunTime = $EndTime - $StartTime;
return $RunTime;
}
开发者ID:noikiy,项目名称:webgame,代码行数:7,代码来源:functions.php
示例9: test
function test($ip2c, $expected, $ip)
{
global $num;
global $total;
$ips = long2ip($ip);
// echo "$ip => $ips <br/>";
$now = microtime_float();
$country = $ip2c->get_country($ips);
$t = microtime_float() - $now;
$total += $t;
$num++;
if ($expected == false && $country == false) {
return;
}
if ($expected == false && $country != false) {
die("Expected " . var_export($expected, true) . ", got " . var_export($country, true) . " ||| {$ip} {$ips}");
}
if ($expected != false && $country == false) {
die("IP ({$ip} {$ips}) Not found, Expected :<br/>" . var_export($expected, true));
}
$id2c = $expected[2];
$id3c = $expected[3];
$name = $expected[4];
$o2c = $country['id2'];
$o3c = $country['id3'];
$oname = $country['name'];
if ($id2c != $country['id2'] || $id3c != $country['id3'] || $name != $country['name']) {
die("Expected :<br/>2c = {$id2c}, 3c = {$id3c} , name = {$name}<br/>got:<br/>2c = {$o2c}, 3c = {$o3c} , name = {$oname} :<br/> ||| {$ip} {$ips}");
}
}
开发者ID:alx,项目名称:blogsfera,代码行数:30,代码来源:ip2c_test.php
示例10: check
/**
* Check a MediaFire link.
*
* @param string $url
* @return array
*/
function check($url)
{
$result = array('final_url' => $url, 'redirect_count' => 0, 'timeout' => false, 'broken' => false, 'log' => "<em>(Using MediaFire checker module)</em>\n\n", 'http_code' => 0, 'result_hash' => '');
//URLs like http://www.mediafire.com/download.php?03mj0mwmnnm are technically valid,
//but they introduce unnecessary redirects.
$url = str_replace('download.php', '', $url);
//Since MediaFire doesn't have an API, we just send a HEAD request
//and try do divine the file state from the response headers.
$start = microtime_float();
$rez = $this->head($url);
$result['request_duration'] = microtime_float() - $start;
if (is_wp_error($rez)) {
//An unexpected error.
$result['broken'] = true;
$result['log'] .= "Error : " . $rez->get_error_message();
if ($data = $rez->get_error_data()) {
$result['log'] .= "\n\nError data : " . print_r($data, true);
}
} else {
$result['http_code'] = intval($rez['response']['code']);
if ($result['http_code'] == 200) {
//200 - OK
$result['broken'] = false;
$result['log'] .= "File OK";
} elseif (isset($rez['headers']['location'])) {
//Redirect = some kind of error. Redirects to an error page with an explanatory message.
//The redirect URL is structured like this : '/error.php?errno=320'. The 'errno' argument
//contains an (undocumented) error code. The only known value is 'errno=320', which
//indicates that the file is invalid or has been deleted.
$result['broken'] = true;
if (strpos($rez['headers']['location'], 'errno=320') !== false) {
$result['status_code'] = BLC_LINK_STATUS_ERROR;
$result['status_text'] = __('Not Found', 'broken-link-checker');
$result['http_code'] = 0;
$result['log'] .= "The file is invalid or has been removed.";
} else {
if (strpos($rez['headers']['location'], 'errno=378') !== false) {
$result['status_code'] = BLC_LINK_STATUS_ERROR;
$result['status_text'] = __('Not Found', 'broken-link-checker');
$result['http_code'] = 0;
$result['log'] .= "The file has been removed due to a violation of MediaFire ToS.";
} else {
$result['status_code'] = BLC_LINK_STATUS_INFO;
$result['status_text'] = __('Unknown Error', 'broken-link-checker');
$result['log'] .= "Unknown error.\n\n";
foreach ($rez['headers'] as $name => $value) {
$result['log'] .= printf("%s: %s\n", $name, $value);
}
}
}
} else {
$result['log'] .= "Unknown error.\n\n" . implode("\n", $rez['headers']);
}
}
//Generate the result hash (used for detecting false positives)
$result['result_hash'] = implode('|', array('mediafire', $result['http_code'], $result['broken'] ? 'broken' : '0', $result['timeout'] ? 'timeout' : '0'));
return $result;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:64,代码来源:mediafire.php
示例11: stopTimer
function stopTimer($message, $forceShow = false)
{
global $timerStartTimes;
$elapsed = microtime_float() - array_pop($timerStartTimes);
if (wcaDebug() || $forceShow) {
printf("<b>%.4f seconds</b> for '{$message}'<br />", $elapsed);
}
return $elapsed;
}
开发者ID:FatBoyXPC,项目名称:worldcubeassociation.org,代码行数:9,代码来源:_timer.php
示例12: __construct
/**
*
* @param $filepath -
* @param $template -
* @param $filter CTraceFilter -
*/
function __construct($filepath, $template, CTraceFilter $filter)
{
$this->_file = new CFile($filepath);
$this->_filter = $filter;
// "[@id] [@level] [@date @time.@microtime] [@delta_time] [@mem] [@delta_mem] [@filepath] [@file:@line] [@class@func()]";
$this->_tpl_prefix = $template;
$this->_last_mem = memory_get_usage(true);
$this->_last_time = microtime_float();
}
开发者ID:KICHIRO20,项目名称:-Myproject_part1-,代码行数:15,代码来源:tracewriter.php
示例13: endEvent
function endEvent($event_name)
{
if (!DEBUG) {
return false;
}
if (isset($GLOBALS['debug']['timer']['end'][$event_name])) {
$event_name = createNewEventName($event_name, $start);
}
$GLOBALS['debug']['timer']['end'][$event_name] = microtime_float();
}
开发者ID:oliverhale,项目名称:Cream,代码行数:10,代码来源:debug.php
示例14: ArcadeVbSubmit
function ArcadeVbSubmit(&$game, $session)
{
global $scripturl, $context, $modSettings, $smcFunc;
$diff = microtime_float() - $session['end_time'];
if ($diff > 4500 || !empty($session['ping'])) {
return false;
}
$session['ping'] = true;
$cheating = CheatingCheck();
unset($_SESSION['arcade_play_vb3g'][$_POST['id']]);
return array('cheating' => $cheating, 'score' => $session['score'], 'start_time' => $session['start_time'], 'duration' => round($session['end_time'] - $session['start_time'], 0), 'end_time' => round($session['end_time'], 0));
}
开发者ID:nikop,项目名称:SMF-Arcade,代码行数:12,代码来源:Submit-v3arcade.php
示例15: mysql_execute_sql
function mysql_execute_sql($connect_id, $sql_statement, $return_single_record_or_field = 0, $return_sql_result = 0)
{
global $sql_errors, $sql_debug, $sql_test, $sql_last_query_time;
//echo $sql_statement;
if (!$sql_statement) {
return;
}
#$sql_statement = preg_replace( "/\r|\n/", " ", $sql_statement );
if (!$sql_test) {
if ($connect_id) {
$time_start = microtime_float();
$sql_result = mysql_query($sql_statement, $connect_id);
$time_end = microtime_float();
} else {
$time_start = microtime_float();
$sql_result = mysql_query($sql_statement);
$time_end = microtime_float();
}
}
$sql_last_query_time = number_format($time_end - $time_start, 4);
if ($sql_debug or $sql_test) {
mysql_show_sql_statement($sql_statement, $sql_result, mysql_error());
}
if ($return_sql_result) {
return $sql_result;
}
if ($sql_result) {
if ($sql_result == 1) {
# SQL statements that dont return results return true or false
return 1;
} else {
if (!mysql_num_rows($sql_result)) {
# Confirms that the SQL was executed correctly but no results were returned
#return 1;
return array();
}
}
$x = 0;
while ($sql_record = mysql_fetch_assoc($sql_result)) {
$x++;
$return_array[$x] = $sql_record;
}
if ($x == 1 and $return_single_record_or_field) {
if (count($return_array[1]) == 1) {
$return_array = current($return_array[1]);
} else {
$return_array = $return_array[1];
}
}
return $return_array;
}
return 0;
}
开发者ID:madhavpanda,项目名称:iou-centerms,代码行数:53,代码来源:mysql.php
示例16: finaliza_request
function finaliza_request()
{
// Fexando conex?o com o banco de dados:
global $db, $smarty, $starttime, $db_time, $db_stats;
$db->fechaConexao();
$totaltime = microtime_float() - $starttime;
$smarty->assign("total_time", $totaltime);
$smarty->assign("db_time", $db_time);
$smarty->assign("real_time", $totaltime - $db_time);
$smarty->assign("db_stats", $db_stats);
$smarty->display("esqueleto.tpl");
die;
}
开发者ID:mohamedbiniz,项目名称:qualityranking,代码行数:13,代码来源:inicio.php
示例17: SetPanelSettings
public function SetPanelSettings()
{
// Show "All prices are in [currency code]"
$currency = GetCurrencyById($GLOBALS['CurrentCurrency']);
if (is_array($currency) && $currency['currencycode']) {
$GLOBALS['AllPricesAreInCurrency'] = sprintf(GetLang('AllPricesAreInCurrency'), isc_html_escape($currency['currencyname']), isc_html_escape($currency['currencycode']));
}
if (GetConfig('DebugMode') == 1) {
$end_time = microtime_float();
$GLOBALS['ScriptTime'] = number_format($end_time - ISC_START_TIME, 4);
$GLOBALS['QueryCount'] = $GLOBALS['ISC_CLASS_DB']->NumQueries;
if (function_exists('memory_get_peak_usage')) {
$GLOBALS['MemoryPeak'] = "Memory usage peaked at " . NiceSize(memory_get_peak_usage(true));
} else {
$GLOBALS['MemoryPeak'] = '';
}
if (isset($_REQUEST['debug'])) {
$GLOBALS['QueryList'] = "<ol class='QueryList' style='font-size: 13px;'>\n";
foreach ($GLOBALS['ISC_CLASS_DB']->QueryList as $query) {
$GLOBALS['QueryList'] .= "<li style='line-height: 1.4; margin-bottom: 4px;'>" . isc_html_escape($query['Query']) . " — <em>" . number_format($query['ExecutionTime'], 4) . "seconds</em></li>\n";
}
$GLOBALS['QueryList'] .= "</ol>";
}
$GLOBALS['DebugDetails'] = "<p>Page built in " . $GLOBALS['ScriptTime'] . "s with " . $GLOBALS['QueryCount'] . " queries. " . $GLOBALS['MemoryPeak'] . "</p>";
} else {
$GLOBALS['DebugDetails'] = '';
}
// Do we have any live chat service code to show in the footer
$modules = GetConfig('LiveChatModules');
if (!empty($modules)) {
$liveChatClass = GetClass('ISC_LIVECHAT');
$GLOBALS['LiveChatFooterCode'] = $liveChatClass->GetPageTrackingCode('footer');
}
// Load our whitelabel file for the front end
require_once ISC_BASE_PATH . '/includes/whitelabel.php';
// Load the configuration file for this template
$poweredBy = 0;
require_once ISC_BASE_PATH . '/templates/' . GetConfig('template') . '/config.php';
if (isset($GLOBALS['TPL_CFG']['PoweredBy'])) {
if (!isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$GLOBALS['TPL_CFG']['PoweredBy']])) {
$GLOBALS['TPL_CFG']['PoweredBy'] = 0;
}
$poweredBy = $GLOBALS['TPL_CFG']['PoweredBy'];
}
// Showing the powered by?
$GLOBALS['PoweredBy'] = '';
if ($GLOBALS['ISC_CFG']['DisableFrontEndPoweredBy'] == false && isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy])) {
$GLOBALS['PoweredBy'] = $GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy];
}
}
开发者ID:nirvana-info,项目名称:old_bak,代码行数:50,代码来源:Footer.php
示例18: bottom
function bottom($start)
{
?>
</div>
</div>
<div id="footer"></div>
<p>Script Execution Time: <?php
echo round(microtime_float() - $start, 3);
?>
seconds</p>
</div>
</body>
</html>
<?php
}
开发者ID:Zipcore,项目名称:SSMS,代码行数:15,代码来源:functionsbackup.php
示例19: draw
function draw()
{
global $__utime_start;
global $__debug_array;
debug($this, "Execution time (until debugWidget) :" . round(microtime_float() - $__utime_start, 3) . "s");
$arr =& $__debug_array;
$out .= "<table class=\"debug\"><tr><td class=\"debug_header\">Object</td><td class=\"debug_header\">Message</td></tr>";
for ($i = 0; $i < count($arr); $i++) {
$out .= "<tr><td class=\"debug_object\"><b>" . $arr[$i]["object"] . "</b></td><td class=\"debug_message\">" . $arr[$i]["message"] . "</td></tr>";
}
$out .= "</table>";
$box = new Box("ooCommon NG Debug");
$box->addWidget(html::write($out));
return $box->draw();
}
开发者ID:Esleelkartea,项目名称:arotz,代码行数:15,代码来源:debugwidget.class.php
示例20: runBenchmark
function runBenchmark($ip2c, $ips, $len)
{
$now = microtime_float();
$progress = $len / 20;
for ($i = 0; $i < $len; $i++) {
if ($i % $progress == 0 && $i != 0) {
echo ".";
flush();
}
$ip2c->get_country($ips[$i]);
}
$t = microtime_float() - $now;
println();
println($t . " ms for {$len} searches (" . $len / $t . " searches/sec)");
}
开发者ID:hinaloe,项目名称:crazy-bone,代码行数:15,代码来源:benchmark.php
注:本文中的microtime_float函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论