本文整理匯總了PHP中dm::getStartTime方法的典型用法代碼示例。如果您正苦於以下問題:PHP dm::getStartTime方法的具體用法?PHP dm::getStartTime怎麽用?PHP dm::getStartTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dm
的用法示例。
在下文中一共展示了dm::getStartTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: configure
public function configure(array $data)
{
$isXhr = $data['context']->getRequest()->isXmlHttpRequest();
$uri = $this->cleanUri(dmArray::get($data['server'], 'PATH_INFO', $data['server']['REQUEST_URI']));
$milliseconds = (microtime(true) - dm::getStartTime()) * 1000;
$this->data = array('time' => (string) $data['server']['REQUEST_TIME'], 'uri' => dmString::truncate($uri, 500), 'code' => (string) $data['context']->getResponse()->getStatusCode(), 'app' => (string) sfConfig::get('sf_app'), 'env' => (string) sfConfig::get('sf_environment'), 'ip' => (string) $data['server']['REMOTE_ADDR'], 'user_id' => (string) $data['context']->getUser()->getUserId(), 'user_agent' => dmString::truncate($isXhr ? '' : isset($data['server']['HTTP_USER_AGENT']) ? $data['server']['HTTP_USER_AGENT'] : '', 500), 'xhr' => (int) $isXhr, 'mem' => (string) memory_get_peak_usage(true), 'timer' => (string) sprintf('%.0f', $milliseconds), 'cache' => sfConfig::get('dm_internal_page_cached'));
}
示例2: getPerformanceInfos
public static function getPerformanceInfos()
{
return array(
'usage' => memory_get_usage(true) / (1024*1024),
'peak' => memory_get_peak_usage(true) / (1024*1024),
'max' => ini_get('memory_limit'),
'time' => round(1000*(microtime(true) - dm::getStartTime()))
);
}
示例3: getTimeFromStart
/**
* How many time elapsed since request ?
*/
public static function getTimeFromStart()
{
return sprintf('%.0f', (microtime(true) - dm::getStartTime()) * 1000);
}