• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_num_queries函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_num_queries函数的典型用法代码示例。如果您正苦于以下问题:PHP get_num_queries函数的具体用法?PHP get_num_queries怎么用?PHP get_num_queries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_num_queries函数的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: 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


示例3: 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


示例4: 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


示例5: 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


示例6: ajax

 public function ajax()
 {
     $apiArgs = isset($_GET["apiArgs"]) ? $_GET["apiArgs"] : array();
     if (!$apiArgs) {
         wp_send_json_error(array("error" => "MISSING_APIARGS"));
         exit;
     }
     if (empty($apiArgs["since_id"]) || !is_numeric($apiArgs["since_id"])) {
         wp_send_json_error(array("error" => "MISSING_SINCE_ID"));
         exit;
     }
     // $since_id = isset( $_GET["since_id"] ) ? absint($_GET["since_id"]) : null;
     $logQueryArgs = $apiArgs;
     $logQuery = new SimpleHistoryLogQuery();
     $answer = $logQuery->query($logQueryArgs);
     // Use our own repsonse array instead of $answer to keep size down
     $json_data = array();
     $numNewRows = isset($answer["total_row_count"]) ? $answer["total_row_count"] : 0;
     $json_data["num_new_rows"] = $numNewRows;
     $json_data["num_mysql_queries"] = get_num_queries();
     if ($numNewRows) {
         // We have new rows
         // Append strings
         $textRowsFound = sprintf(_n('1 new event', '%d new events', $numNewRows, 'simple-history'), $numNewRows);
         $json_data["strings"] = array("newRowsFound" => $textRowsFound);
     }
     wp_send_json_success($json_data);
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:28,代码来源:SimpleHistoryNewRowsNotifier.php


示例7: 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


示例8: 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


示例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: _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


示例12: spdebug_end_stats

function spdebug_end_stats()
{
    global $spdebug_stats, $spdebug_queries;
    $mtime = explode(' ', microtime());
    $time_end = $mtime[1] + $mtime[0];
    $spdebug_stats['end_time'] = $time_end;
    $spdebug_stats['total_time'] = $spdebug_stats['end_time'] - $spdebug_stats['start_time'];
    $spdebug_stats['end_query'] = get_num_queries();
    $spdebug_stats['total_query'] = $spdebug_stats['end_query'] - $spdebug_stats['start_query'];
    $spdebug_queries = false;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:11,代码来源:sp-load-debug.php


示例13: AfterExecute

 protected function AfterExecute()
 {
     $this->exec_info['Time'] = microtime(true) - $this->exec_info['_Time'];
     $this->exec_info['Mem'] = memory_get_usage() - $this->exec_info['_Mem'];
     if ($this->exec_info['Time'] < 0.001) {
         $this->exec_info['Time'] = number_format($this->exec_info['Time'] * 1000, 3) . 'ms';
     } else {
         $this->exec_info['Time'] = number_format($this->exec_info['Time'], 3) . 's';
     }
     $this->exec_info['Mem'] = size_format($this->exec_info['Mem']);
     $this->exec_info['Queries'] = get_num_queries();
 }
开发者ID:klebercarvalho,项目名称:demo,代码行数:12,代码来源:Sandbox.php


示例14: _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


示例15: 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


示例16: 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


示例17: display

    /**
     * display function.
     */
    public function display()
    {
        // Get values we're displaying
        $timer_stop = timer_stop(0);
        $query_count = get_num_queries();
        $memory_usage = round(size_format(memory_get_usage()), 2);
        $memory_peak_usage = round(size_format(memory_get_peak_usage()), 2);
        $memory_limit = round(size_format($this->let_to_num(WP_MEMORY_LIMIT)), 2);
        $load_times = array_filter((array) get_option($this->average_option, array()));
        $load_times[] = $timer_stop;
        // Update load times
        update_option($this->average_option, $load_times);
        // Get average
        if (sizeof($load_times) > 0) {
            $average_load_time = round(array_sum($load_times) / sizeof($load_times), 4);
        }
        // Display the info
        ?>
		<div id="wp_pls">
			<ul>
				<li><?php 
        printf(__('%s queries in %s seconds.', 'wp-page-load-stats'), $query_count, $timer_stop);
        ?>
</li>
				<li><?php 
        printf(__('Average load time of %s (%s runs).', 'wp-page-load-stats'), $average_load_time, sizeof($load_times));
        ?>
</li>
				<li><?php 
        printf(__('%s out of %s MB (%s) memory used.', 'wp-page-load-stats'), $memory_usage, $memory_limit, round($memory_usage / $memory_limit, 2) * 100 . '%');
        ?>
</li>
				<li><?php 
        printf(__('Peak memory usage %s MB.', 'wp-page-load-stats'), $memory_peak_usage);
        ?>
</li>
			</ul>
			<div class="actions">
				<a onclick="wp_pls_hide()" href="javascript:void(0);">&times;</a>
				<a class="reset" href="<?php 
        echo add_query_arg('reset_wp_pls_stats', 1);
        ?>
">-</a>
			</div>
		</div>
		<?php 
    }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:50,代码来源:wp-page-load-stats.php


示例18: add_stop

/**
 * add_stop()
 *
 * @param mixed $in
 * @param string $where
 * @return mixed $in
 **/
function add_stop($in = null, $where = null)
{
    global $sem_stops;
    global $wp_object_cache;
    $queries = get_num_queries();
    $milliseconds = timer_stop() * 1000;
    $out = "{$queries} queries - {$milliseconds}ms";
    if (function_exists('memory_get_usage')) {
        $memory = number_format(memory_get_usage() / (1024 * 1024), 1);
        $out .= " - {$memory}MB";
    }
    $out .= " - {$wp_object_cache->cache_hits} cache hits / " . ($wp_object_cache->cache_hits + $wp_object_cache->cache_misses);
    if ($where) {
        $sem_stops[$where] = $out;
    } else {
        dump($out);
    }
    return $in;
}
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:26,代码来源:WpBoojDebug.php


示例19: wprm_show_result

function wprm_show_result()
{
    echo '<div style="min-height:200px; border:5px solid #CCCCCC;"><div style="font-size:25px; text-align:center; background:#CCCCCC; font-weight:bold; padding:2px;">Resource Monitor</div>';
    echo '<div style="padding:10px;">';
    global $wprm_num_exicuted_queries, $wprm_exicuted_queries;
    echo '<table width="100%" border="1">';
    echo '<tr><td width="150">Execution Time: </td><td><strong>';
    timer_stop(1);
    echo "</strong> Second</td></tr>";
    echo "<tr><td>Total MySQL Query: </td><td><strong>" . get_num_queries();
    echo "</strong> queries ( <strong>" . $wprm_num_exicuted_queries . "</strong> queries are counted using wp query filter )</td></tr>";
    if (isset($_GET['show_query']) && $_GET['show_query'] == 'yes') {
        echo '<tr><td colspan="2">MySQL Queries:';
        echo '<table>';
        $i = 1;
        foreach ($wprm_exicuted_queries as $qur) {
            echo '<tr><td>' . $i . '</td><td style="background:#efefef; border-bottom: 1px solid #dddddd"><code>' . $qur . '</code></td></tr>';
            $i++;
        }
        echo '<table>';
        echo "</td></tr>";
    }
    #IF YOU NEED TO SEE MY SQL PORCESS LIST THEN UNCOMMENT FOLLOWING BLOCK OF CODE
    /*
    echo '<tr><td colspan="2">PROCESS LIST'; 
    	$pro=@mysql_query("SHOW FULL PROCESSLIST");
    	while($process=mysql_fetch_assoc($pro))
    	{
    	echo "<pre>"; print_r($process); echo "</pre>";
    	}
    echo "</td></tr>"; 
    */
    echo '</table>';
    echo '</div>';
    echo '</div>';
}
开发者ID:onetarek,项目名称:wp-resource-monitor,代码行数:36,代码来源:wp-resource-monitor.php


示例20: bloginfo

		<div class="clear"></div>
		<div id="footer">
			<!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
			<!--
			<p><?php 
bloginfo('name');
?>
 is valid <a href="http://validator.w3.org/check/referer">xHTML</a>, <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> and proudly powered by <a href="http://wordpress.org/">WordPress</a><br/>
			-->
<a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/2.0/uk/88x31.png" /></a><br />
<font size='-2'>
<span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">FuzzierLogic</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://blog.fuzzierlogic.com/" property="cc:attributionName" rel="cc:attributionURL">Simon J. Cockell</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.0/uk/">Creative Commons Attribution 2.0 UK: England &amp; Wales License</a>.
</font>
		<!-- Original theme by <a href="http://awhitebox.com">Ali B.</a>, ported by <a href="http://joolz.nl">Jo0Lz</a>.<br /> -->
			<!-- <?php 
echo get_num_queries();
?>
 queries. <?php 
timer_stop(1);
?>
 seconds. -->
			</p>
		</div><!-- end "footer" -->
		<div class="clear"></div>
	</div><!-- end "wrapper-bottom"-->
</div><!-- end "page-bottom" -->
		<?php 
wp_footer();
?>
</body>
</html>
开发者ID:sjcockell,项目名称:fuzzierlogic.blog,代码行数:31,代码来源:footer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_number_of_attendees_reg_limit函数代码示例发布时间:2022-05-15
下一篇:
PHP get_num_new_messages函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap