本文整理汇总了PHP中timer_stop函数的典型用法代码示例。如果您正苦于以下问题:PHP timer_stop函数的具体用法?PHP timer_stop怎么用?PHP timer_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timer_stop函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: memory
function memory()
{
if (current_user_can('level_10')) {
global $wpdb;
echo '<span style="text-align:center;display:block;">';
$timer = timer_stop();
echo round(memory_get_peak_usage() / 1048576, 2) . 'M ' . get_num_queries() . ' queries in ' . $timer . ' Seconds.</span>';
}
}
开发者ID:ryanurban,项目名称:Orbit,代码行数:9,代码来源:debog.php
示例2: regenerate_thumbnail
/**
* From regenerate thumbnails plugin
*/
public function regenerate_thumbnail()
{
@error_reporting(0);
// Don't break the JSON result
header('Content-type: application/json');
$id = (int) $_REQUEST['id'];
$image = get_post($id);
if (!$image || 'attachment' != $image->post_type || 'image/' != substr($image->post_mime_type, 0, 6)) {
die(json_encode(array('error' => sprintf(__('Failed resize: %s is an invalid image ID.', 'wc_csv_import'), esc_html($_REQUEST['id'])))));
}
if (!current_user_can('manage_woocommerce')) {
$this->die_json_error_msg($image->ID, __("Your user account doesn't have permission to resize images", 'wc_csv_import'));
}
$fullsizepath = get_attached_file($image->ID);
if (false === $fullsizepath || !file_exists($fullsizepath)) {
$this->die_json_error_msg($image->ID, sprintf(__('The originally uploaded image file cannot be found at %s', 'wc_csv_import'), '<code>' . esc_html($fullsizepath) . '</code>'));
}
@set_time_limit(900);
// 5 minutes per image should be PLENTY
$metadata = wp_generate_attachment_metadata($image->ID, $fullsizepath);
if (is_wp_error($metadata)) {
$this->die_json_error_msg($image->ID, $metadata->get_error_message());
}
if (empty($metadata)) {
$this->die_json_error_msg($image->ID, __('Unknown failure reason.', 'wc_csv_import'));
}
// If this fails, then it just means that nothing was changed (old value == new value)
wp_update_attachment_metadata($image->ID, $metadata);
die(json_encode(array('success' => sprintf(__('"%1$s" (ID %2$s) was successfully resized in %3$s seconds.', 'wc_csv_import'), esc_html(get_the_title($image->ID)), $image->ID, timer_stop()))));
}
开发者ID:hikaram,项目名称:wee,代码行数:33,代码来源:class-wc-pcsvis-ajax-handler.php
示例3: wb_do
function wb_do()
{
printf(__('SQL requests:%d. Generation time:%s sec. Memory consumption:', WB_CHANGE_EMAIL_SLUG), get_num_queries(), timer_stop(0, 3));
if (function_exists('memory_get_usage')) {
echo round(memory_get_usage() / 1024 / 1024, 2) . ' mb ';
}
}
开发者ID:vapvarun,项目名称:custom-email-options,代码行数:7,代码来源:tweak.php
示例4: lt_store_timer_data
function lt_store_timer_data()
{
global $wpdb;
$table_name = lt_get_table_name();
$lt_data = array('longdatetime' => date('Y-m-d H:i:s', time()), 'qcount' => get_num_queries(), 'qtime' => timer_stop(0, 3), 'qpage' => "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'useragent' => $_SERVER['HTTP_USER_AGENT']);
$wpdb->insert($table_name, $lt_data);
}
开发者ID:hewu,项目名称:blogwp,代码行数:7,代码来源:latency.tracker.php
示例5: spdebug_stats
function spdebug_stats()
{
global $wpdb, $spdebug_stats, $spdebug_queries;
if (defined('SP_DEVFLAG') && SP_DEVFLAG == true && isset($spdebug_stats)) {
$out = "\n\n<div class='spdebug'>\n";
$out .= "\t<table>\n";
if (isset($spdebug_stats['total_time'])) {
$out .= "\t\t<tr>\n";
$out .= "\t\t\t<td>Target section</td>\n";
$out .= "\t\t\t<td>" . $spdebug_stats['total_query'] . " queries</td>\n";
$out .= "\t\t\t<td>" . number_format($spdebug_stats['total_time'], 3) . " seconds</td>\n";
$out .= "\t\t</tr>\n";
}
$out .= "\t\t<tr>\n";
$out .= "\t\t\t<td>Total page</td>\n";
$out .= "\t\t\t<td>" . (get_num_queries() - $spdebug_queries) . " queries</td>\n";
$out .= "\t\t\t<td>" . timer_stop(0) . " seconds</td>\n";
$out .= "\t\t</tr>\n";
$out .= "\t</table>\n";
$out .= "</div>\n\n";
echo $out;
show_log();
show_control();
}
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:25,代码来源:sp-load-debug.php
示例6: addStatistics
/**
*
* Adds a piece of commented out code to the source code of each webpage that shows many queries occur, time taken and memory used
*
* @since 4.1.1
*
* @param type $var statisitcs.
* @param array $args {
* @type type $var statistics : var to store the the queries and echo it out to the page
* }
*/
function addStatistics()
{
$statistics = sprintf('%d queries in %.3f seconds, using %.2fMB memory', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024);
if (current_user_can('manage_options')) {
echo "<!-- {$statistics} -->";
}
}
开发者ID:Hal93,项目名称:Wordpress-Music-Theme---Plugin,代码行数:18,代码来源:functions.php
示例7: info_unqprfx_code
function info_unqprfx_code($atts, $content = null)
{
// add info to source code
$useful_info = sprintf('%d q; %.2f sec; %.2f MB;', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024);
echo "\n" . '<!-- info plugin v.2.3 wordpress.org/plugins/info/ -->' . "\n";
echo '<!-- ========== ' . $useful_info . ' ========== -->' . "\n";
}
开发者ID:dauidus,项目名称:woof,代码行数:7,代码来源:info.php
示例8: gdptStats
function gdptStats()
{
if (function_exists("memory_get_usage")) {
$this->memory = gdFunctionsGDPT::size_format(memory_get_usage());
}
$this->queries = get_num_queries();
$this->timer = timer_stop(1);
}
开发者ID:hewu,项目名称:blogwp,代码行数:8,代码来源:classes.php
示例9: panel_template
private function panel_template()
{
/**
* action 'redux/{opt_name}/panel/before'
*/
do_action("redux/{$this->parent->args['opt_name']}/panel/before");
echo '<div class="wrap"><h2></h2></div>';
// Stupid hack for Wordpress alerts and warnings
echo '<div class="clear"></div>';
echo '<div class="wrap">';
// Do we support JS?
echo '<noscript><div class="no-js">' . __('Warning- This options panel will not work properly without javascript!', 'redux-framework') . '</div></noscript>';
// Security is vital!
echo '<input type="hidden" id="ajaxsecurity" name="security" value="' . wp_create_nonce('redux_ajax_nonce') . '" />';
/**
* action 'redux-page-before-form-{opt_name}'
*
* @deprecated
*/
do_action("redux-page-before-form-{$this->parent->args['opt_name']}");
// Remove
/**
* action 'redux/page/{opt_name}/form/before'
*
* @param object $this ReduxFramework
*/
do_action("redux/page/{$this->parent->args['opt_name']}/form/before", $this);
$this->get_template('layout.tpl.php');
/**
* action 'redux-page-after-form-{opt_name}'
*
* @deprecated
*/
do_action("redux-page-after-form-{$this->parent->args['opt_name']}");
// REMOVE
/**
* action 'redux/page/{opt_name}/form/after'
*
* @param object $this ReduxFramework
*/
do_action("redux/page/{$this->parent->args['opt_name']}/form/after", $this);
echo '<div class="clear"></div>';
echo '</div><!--wrap-->';
if ($this->parent->args['dev_mode'] == true) {
if (current_user_can('administrator')) {
global $wpdb;
echo "<br /><pre>";
print_r($wpdb->queries);
echo "</pre>";
}
echo '<br /><div class="redux-timer">' . get_num_queries() . ' queries in ' . timer_stop(0) . ' seconds<br/>Redux is currently set to developer mode.</div>';
}
/**
* action 'redux/{opt_name}/panel/after'
*/
do_action("redux/{$this->parent->args['opt_name']}/panel/after");
}
开发者ID:mertyildiran,项目名称:grandinsaat,代码行数:57,代码来源:panel.php
示例10: basic_performance
function basic_performance()
{
global $pl_start_time, $pl_start_mem, $pl_perform;
$pl_perform['memory'] = array('num' => round((memory_get_usage() - $pl_start_mem) / (1024 * 1024), 3), 'label' => 'MB', 'title' => __('Editor Memory', 'pagelines'), 'info' => __('Amount of memory used by the DMS editor in MB during this page load.', 'pagelines'));
$pl_perform['queries'] = array('num' => get_num_queries(), 'label' => __('Queries', 'pagelines'), 'title' => __('Total Queries', 'pagelines'), 'info' => __('The number of database queries during the WordPress/Editor execution.', 'pagelines'));
$pl_perform['total_time'] = array('num' => timer_stop(0), 'label' => __('Seconds', 'pagelines'), 'title' => __('Total Time', 'pagelines'), 'info' => __('Total time to render this page including WordPress and DMS editor.', 'pagelines'));
$pl_perform['time'] = array('num' => round(microtime(TRUE) - $pl_start_time, 3), 'label' => __('Seconds', 'pagelines'), 'title' => __('Editor Time', 'pagelines'), 'info' => __('Amount of time it took to load this page once DMS had started.', 'pagelines'));
return $pl_perform;
}
开发者ID:benpeck,项目名称:experticity-fools,代码行数:9,代码来源:editor.developer.php
示例11: performance
function performance()
{
$visible = false;
if (current_user_can('manage_options')) {
$visible = true;
}
$stat = sprintf('%d queries in %.3f seconds, using %.2fMB memory', get_num_queries(), timer_stop(0, 3), memory_get_peak_usage() / 1024 / 1024);
echo $visible ? '<div id="performance">' . $stat . '</div>' : "<!-- {$stat} -->";
}
开发者ID:wsander3,项目名称:Pipe-Dream,代码行数:9,代码来源:performance.php
示例12: _getPageLoadStats
private function _getPageLoadStats()
{
$_nSeconds = timer_stop(0);
$_nQueryCount = get_num_queries();
$_nMemoryUsage = round($this->_convertBytesToHR(memory_get_usage()), 2);
$_nMemoryPeakUsage = round($this->_convertBytesToHR(memory_get_peak_usage()), 2);
$_nMemoryLimit = round($this->_convertBytesToHR($this->_convertToNumber(WP_MEMORY_LIMIT)), 2);
$_sInitialMemoryUsage = round($this->_convertBytesToHR($this->_nInitialMemoryUsage), 2);
return "<div id='admin-page-framework-page-load-stats'>" . "<ul>" . "<li>" . sprintf($this->oMsg->get('queries_in_seconds'), $_nQueryCount, $_nSeconds) . "</li>" . "<li>" . sprintf($this->oMsg->get('out_of_x_memory_used'), $_nMemoryUsage, $_nMemoryLimit, round($_nMemoryUsage / $_nMemoryLimit, 2) * 100 . '%') . "</li>" . "<li>" . sprintf($this->oMsg->get('peak_memory_usage'), $_nMemoryPeakUsage) . "</li>" . "<li>" . sprintf($this->oMsg->get('initial_memory_usage'), $_sInitialMemoryUsage) . "</li>" . "</ul>" . "</div>";
}
开发者ID:michaeluno,项目名称:admin-page-framework,代码行数:10,代码来源:AdminPageFramework_PageLoadInfo_Base.php
示例13: collect
public function collect()
{
foreach ($GLOBALS['timers'] as $name => &$timer) {
if (isset($timer['start'])) {
timer_stop($name);
}
foreach ($timer['measures'] as $measure) {
call_user_func_array(array($this, 'addMeasure'), $measure);
}
}
return parent::collect();
}
开发者ID:drufony,项目名称:debugbar-module,代码行数:12,代码来源:DrupalTimeDataCollector.php
示例14: endRequest
function endRequest()
{
if (is_page() || is_single() || is_category() || is_home() || is_archive()) {
$url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$requestName = $this->getRequestName();
$startTime = $_SERVER["REQUEST_TIME"];
$duration = timer_stop(0, 3) * 1000;
$this->_telemetryClient->trackRequest($requestName, $url, $startTime, $duration);
// Flush all telemetry items
$this->_telemetryClient->flush();
}
}
开发者ID:nagyistoce,项目名称:ApplicationInsights-WordPress,代码行数:12,代码来源:Server_Instrumentation.php
示例15: inicializador
public function inicializador($phase)
{
static $phases = array(SITEBILDER_CONFIGURATION, SITEBILDER_LANGUAGE, SITEBILDER_ACCESS, SITEBILDER_PERFIL, SITEBILDER_SESSION, SITEBILDER_PAGE, SITEBILDER_SAJAX, SITEBILDER_FULL), $phase_index = 0;
$this->unset_globals();
timer_start('index.php');
/* inicia as fazes de configuração. */
while ($phase >= $phase_index && isset($phases[$phase_index])) {
$current_phase = $phases[$phase_index];
unset($phases[$phase_index++]);
$this->sitebilder_inicializador($current_phase);
}
$this->debug['index.php'] = timer_stop('index.php');
}
开发者ID:renatoinnocenti,项目名称:ModulosZend,代码行数:13,代码来源:lib.StartSite.php
示例16: mark
/**
*
* @staticvar string $item
* @param type $text
* @return string
*/
public static function mark($text)
{
static $item = '';
if ($text === TRUE) {
return $item;
}
static $last_time = 0;
$current_time = timer_stop();
$time_taken = $last_time > 0 ? $current_time - $last_time : 0;
$time_taken = number_format($time_taken, 3);
$last_time = $current_time;
$item .= self::addAdminBarItem($current_time . ' (+' . $time_taken . ') - ' . $text);
}
开发者ID:fritzdenim,项目名称:pangMoves,代码行数:19,代码来源:profiler.php
示例17: _replyToGetPageLoadInfo
public function _replyToGetPageLoadInfo($sFooterHTML)
{
if (self::$_bLoadedPageLoadInfo) {
return;
}
self::$_bLoadedPageLoadInfo = true;
$_nSeconds = timer_stop(0);
$_nQueryCount = get_num_queries();
$_nMemoryUsage = round($this->_convertBytesToHR(memory_get_usage()), 2);
$_nMemoryPeakUsage = round($this->_convertBytesToHR(memory_get_peak_usage()), 2);
$_nMemoryLimit = round($this->_convertBytesToHR($this->_convertToNumber(WP_MEMORY_LIMIT)), 2);
$_sInitialMemoryUsage = round($this->_convertBytesToHR($this->_nInitialMemoryUsage), 2);
return $sFooterHTML . "<div id='admin-page-framework-page-load-stats'>" . "<ul>" . "<li>" . sprintf($this->oMsg->get('queries_in_seconds'), $_nQueryCount, $_nSeconds) . "</li>" . "<li>" . sprintf($this->oMsg->get('out_of_x_memory_used'), $_nMemoryUsage, $_nMemoryLimit, round($_nMemoryUsage / $_nMemoryLimit, 2) * 100 . '%') . "</li>" . "<li>" . sprintf($this->oMsg->get('peak_memory_usage'), $_nMemoryPeakUsage) . "</li>" . "<li>" . sprintf($this->oMsg->get('initial_memory_usage'), $_sInitialMemoryUsage) . "</li>" . "</ul>" . "</div>";
}
开发者ID:benallfree,项目名称:wp-lesser,代码行数:14,代码来源:AdminPageFramework_PageLoadInfo_Base.php
示例18: bp_core_print_generation_time
/**
* Print the generation time in the footer of the site.
*
* @since 1.0.0
* @deprecated 2.6.0
*/
function bp_core_print_generation_time()
{
?>
<!-- Generated in <?php
timer_stop(1);
?>
seconds. (<?php
echo get_num_queries();
?>
q) -->
<?php
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:20,代码来源:2.6.php
示例19: aitDisplayLoadTime
function aitDisplayLoadTime()
{
if (!(defined('DOING_AJAX') && DOING_AJAX)) {
?>
<div style="position:fixed;bottom:0;right:0;padding:0.2em;background:#fff;border:1px solid #ccc;border-radius:4px;"><?php
timer_stop(1);
echo " | ";
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
$size = memory_get_usage(true);
echo @round($size / pow(1024, $i = floor(log($size, 1024))), 2) . ' ' . $unit[$i];
?>
</div><?php
}
}
开发者ID:simeont9,项目名称:stoneopen,代码行数:14,代码来源:dev-tools.php
示例20: rv_debuginfo
function rv_debuginfo($post) {
global $post;
global $current_user;
$rv_ref = @$_SERVER['HTTP_REFERER'];
print "<!-- \n\n";
print " RV DEBUG INFO \n\n";
print " Database: ".get_num_queries()." queries, ".timer_stop()." seconds\n";
if ($rv_ref) {
print " Referrer: ".$rv_ref."\n";
}
if ($current_user->user_login) {
print " Logged in as: ".$current_user->user_login."\n";
}
print "\n";
print " -->\n";
}
开发者ID:roelven,项目名称:rv-extras,代码行数:16,代码来源:functions.php
注:本文中的timer_stop函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论