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


PHP Zend_Db_Profiler::getTotalElapsedSecs方法代码示例

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


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

示例1: collect

 public function collect(\Enlight_Controller_Action $controller)
 {
     $totalQueriesZend = $this->zendProfiler->getTotalNumQueries();
     $totalQueriesDoctrine = count($this->doctrineProfiler->queries);
     $this->executeTime = $this->zendProfiler->getTotalElapsedSecs();
     $this->getAllQuerys();
     $result = ['db' => ['totalQueries' => $totalQueriesZend + $totalQueriesDoctrine, 'queryTime' => $this->executeTime, 'sqls' => $this->executedQuerys]];
     return $result;
 }
开发者ID:shyim,项目名称:shopware-profiler,代码行数:9,代码来源:DBCollector.php

示例2: _getProfilerMarkup

 private function _getProfilerMarkup(Zend_Db_Profiler $profiler)
 {
     $totalTime = $profiler->getTotalElapsedSecs();
     $queryCount = $profiler->getTotalNumQueries();
     $longestTime = 0;
     $longestQuery = null;
     $lines = array();
     $html = "<h2>Db Profiler</h2>\n";
     $lines[] = "The following queries were executed during the request:";
     $profiles = $profiler->getQueryProfiles();
     if (!$profiles) {
         return $html;
     }
     foreach ($profiles as $query) {
         $sql = $query->getQuery();
         $elapsedSecs = $query->getElapsedSecs();
         if ($elapsedSecs > $longestTime) {
             $longestTime = $query->getElapsedSecs();
             $longestQuery = $sql;
         }
         $lines[] = "[{$elapsedSecs}] {$sql}";
     }
     $lines[] = 'Executed ' . $queryCount . ' queries in ' . $totalTime . ' seconds';
     $lines[] = 'Average query length: ' . $totalTime / $queryCount . ' seconds';
     $lines[] = 'Queries per second: ' . $queryCount / $totalTime;
     $lines[] = 'Longest query length: ' . $longestTime;
     $lines[] = "Longest query: \n" . $longestQuery;
     foreach ($lines as $line) {
         $html .= '<p>' . $line . '</p>' . "\n";
     }
     return $html;
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:32,代码来源:Debug.php

示例3: getTotalTime

 /**
  * Returns total time spend handling db queries
  *
  * @return float
  */
 public function getTotalTime()
 {
     return $this->_profiler->getTotalElapsedSecs();
 }
开发者ID:nicolas-bastien,项目名称:MagentoUnderControl,代码行数:9,代码来源:Database.php

示例4: getStats

    /**
     * Get debug information
     * @return string  - html formated results
     */
    public static function getStats($showCacheQueries = true, $showQueries = false, $showAutoloaded = false, $showInclided = false)
    {
        $str = '';
        if (self::$_scriptStartTime) {
            $str .= '<b>Time:</b> ' . number_format(microtime(true) - self::$_scriptStartTime, 5) . "sec.<br>\n";
        }
        $str .= '<b>Memory:</b> ' . number_format(memory_get_usage() / (1024 * 1024), 3) . "mb<br>\n" . '<b>Memory peak:</b> ' . number_format(memory_get_peak_usage() / (1024 * 1024), 3) . "mb<br>\n" . '<b>Includes:</b> ' . sizeof(get_included_files()) . "<br>\n" . '<b>Autoloaded:</b> ' . sizeof(self::$_loadedClasses) . "<br>\n";
        if (self::$_dbProfiler) {
            $str .= '<b>Queries:</b> ' . self::$_dbProfiler->getTotalNumQueries() . '<br>' . '<b>Queries time:</b> ' . number_format(self::$_dbProfiler->getTotalElapsedSecs(), 5) . 'sec.<br>';
            if ($showQueries) {
                $profiles = self::$_dbProfiler->getQueryProfiles();
                if (!empty($profiles)) {
                    foreach ($profiles as $queryProfile) {
                        $str .= "\n<br> " . $queryProfile->getQuery();
                    }
                }
            }
            $str .= "<br>\n";
        }
        if ($showAutoloaded) {
            $str .= "<b>Autoloaded:</b>\n<br> " . implode("\n\t <br>", self::$_loadedClasses) . '<br>';
        }
        if ($showInclided) {
            $str .= "<b>Includes:</b>\n<br> " . implode("\n\t <br>", get_included_files());
        }
        if (!empty(self::$_cacheCores) && self::$_cacheCores) {
            $body = '';
            $globalCount = array('load' => 0, 'save' => 0, 'remove' => 0, 'total' => 0);
            $globalTotal = 0;
            foreach (self::$_cacheCores as $name => $cacheCore) {
                if (!$cacheCore) {
                    continue;
                }
                $count = $cacheCore->getOperationsStat();
                $count['total'] = $count['load'] + $count['save'] + $count['remove'];
                $globalCount['load'] += $count['load'];
                $globalCount['save'] += $count['save'];
                $globalCount['remove'] += $count['remove'];
                $globalCount['total'] += $count['total'];
                $body .= '
				    <tr align="right">
				        <td align="left" >' . $name . '</td>
				    	<td>' . $count['load'] . '</td>
						<td>' . $count['save'] . '</td>
						<td>' . $count['remove'] . '</td>
						<td style="border-left:2px solid #000000;">' . $count['total'] . '</td>
				    </tr>';
            }
            $body .= '
				    <tr align="right" style="border-top:2px solid #000000;">
				        <td align="left" >Total</td>
				    	<td>' . $globalCount['load'] . '</td>
						<td>' . $globalCount['save'] . '</td>
						<td>' . $globalCount['remove'] . '</td>
						<td style="border-left:2px solid #000000;">' . $globalCount['total'] . '</td>
				    </tr>';
            $str .= '<div style=" padding:1px;"> <center><b>Cache</b></center>
				<table cellpadding="2" cellspacing="2" border="1" style="font-size:10px;">
					<tr style="background-color:#cccccc;font-weight:bold;">
						<td>Name</td>
						<td>Load</td>
						<td>Save</td>
						<td>Remove</td>
						<td style="border-left:2px solid #000000;">Total</td>
					</tr>
					' . $body . '
			 	</table>
			 </div>';
        }
        return '<div id="debugPanel" style="position:fixed;font-size:12px;left:10px;bottom:10px;overflow:auto;max-height:300px;padding:5px;background-color:#ffffff;z-index:1000;border:1px solid #cccccc;">' . $str . ' <center><a href="javascript:void(0)" onClick="document.getElementById(\'debugPanel\').style.display = \'none\'">close</a></center></div>';
    }
开发者ID:vgrish,项目名称:dvelum,代码行数:75,代码来源:Debug.php


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