本文整理汇总了PHP中Debug::startTimer方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::startTimer方法的具体用法?PHP Debug::startTimer怎么用?PHP Debug::startTimer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::startTimer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postcondition
public static function postcondition($callingFunction, $description, $test)
{
Debug::startTimer('postcondition');
$test = $test == true ? 'true' : 'false';
Debug::log($callingFunction, 'Postcondition test - ' . $description . ' : ' . $test);
if ($test === 'false') {
throw new PostconditionException($description . ' : ' . $test, 3);
}
Debug::stopTimer('postcondition');
}
示例2: render
public function render($tabulations)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
Debug::startTimer('render');
// m_attributes serialization
$attributes = '';
foreach ($this->m_attributes as $attribute => $value) {
$attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
}
echo $tabulations . '<link' . $attributes . '>' . "\n";
Debug::stopTimer('render');
}
示例3: explode
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
}
function endTimer() {
global $starttime;
$mtime = microtime ();
$mtime = explode (' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = round (($endtime - $starttime), 5);
return $totaltime;
}
}
$Debug = new Debug;
$Debug->startTimer();
stdhead("SOS");
begin_main_frame();
begin_frame("Velkomin á Istorrent!<a name=\"#top\" id=\"top\"></a>");
?>
Markmið okkar er að veita Íslendingum einfalda og hraða þjónustu til að deila skrám á netinu.<br>
Hér fyrir neðan verða nokkrar algengar spurningar og svör.<br>
<br>
Áður en þú heldur áfram ráðleggjum við þér að lesa <a class=altlink href=disclaimer.php?form=nei>notendaskilmálana</a>.
<?
end_frame();
$res = mysql_query("SELECT `id`, `question`, `flag` FROM `faq` WHERE `type`='categ' ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {
示例4: render
public function render($tabulations)
{
Assert::type(__METHOD__, 'is_string($tabulations)', is_string($tabulations));
Debug::startTimer('render');
$singleTags = array('input', 'br', 'hr', 'img', 'meta', 'link');
// m_attributes serialization
$attributes = '';
foreach ($this->m_attributes as $attribute => $value) {
$attributes = $attributes . ' ' . $attribute . '="' . $value . '"';
}
// <tag> type HTML tags
if (in_array($this->m_tag, $singleTags)) {
echo $tabulations . '<' . $this->m_tag . ' ' . $attributes . '>' . "\n";
} else {
echo $tabulations . '<' . $this->m_tag . $attributes . ">\n";
if ($this->m_content != '') {
echo $tabulations . ' ' . $this->m_content . "\n";
}
foreach ($this->m_components as $component) {
$component->render($tabulations . ' ');
}
echo $tabulations . '</' . $this->m_tag . ">\n";
}
Debug::stopTimer('render');
}
示例5: run
public static function run($force_run = false)
{
$di = \Phalcon\Di::getDefault();
$em = $di->get('em');
$config = $di->get('config');
// Set up Google Client.
$gclient_api_key = $config->apis->google_apis_key;
$gclient_app_name = $config->application->name;
if (empty($gclient_api_key)) {
return null;
}
$gclient = new \Google_Client();
$gclient->setApplicationName($gclient_app_name);
$gclient->setDeveloperKey($gclient_api_key);
$gcal = new \Google_Service_Calendar($gclient);
// Prevent running repeatedly in too short of a time (avoid API limits).
$last_run = Settings::getSetting('schedule_manager_last_run', 0);
if ($last_run > time() - 60 && !$force_run) {
return null;
}
$schedule_items = array();
$schedule_records = array();
$stations = $em->createQuery('SELECT s FROM Entity\\Station s WHERE (s.gcal_url IS NOT NULL AND s.gcal_url != \'\') AND s.is_active = 1')->getArrayResult();
$active_stations = Utilities::ipull($stations, 'id');
// Clear all invalid station records.
$em->createQuery('DELETE FROM Entity\\Schedule s WHERE (s.station_id IS NOT NULL) AND (s.station_id NOT IN (:station_ids))')->setParameter('station_ids', $active_stations)->execute();
foreach ($stations as $station) {
if ($station['gcal_url']) {
$schedule_items[] = array('name' => $station['name'], 'url' => $station['gcal_url'], 'type' => 'station', 'station_id' => $station['id'], 'image_url' => \DF\Url::content($station['image_url']));
}
}
Debug::startTimer('Get Calendar Records');
// Time boundaries for calendar entries.
$threshold_start = date(\DateTime::RFC3339, strtotime('-1 week'));
$threshold_end = date(\DateTime::RFC3339, strtotime('+1 year'));
foreach ($schedule_items as $item) {
// Get the "calendar_id" from the URL provided by the user.
$orig_url_parts = parse_url($item['url']);
$url_path_parts = explode('/', $orig_url_parts['path']);
$calendar_id = urldecode($url_path_parts[3]);
if (empty($calendar_id)) {
continue;
}
// Call the external Google Calendar client.
try {
$all_events = $gcal->events->listEvents($calendar_id, array('timeMin' => $threshold_start, 'timeMax' => $threshold_end, 'singleEvents' => 'true', 'orderBy' => 'startTime', 'maxResults' => '300'));
} catch (\Exception $e) {
continue;
}
// Process each individual event.
foreach ($all_events as $event_orig) {
$title = $event_orig->summary;
$body = $event_orig->description;
$location = $event_orig->location;
$web_url = $event_orig->htmlLink;
$banner_url = null;
$is_all_day = false;
$start_time_obj = $event_orig->start;
if ($start_time_obj->date) {
$is_all_day = true;
$start_time = strtotime($start_time_obj->date . ' 00:00:00');
} else {
$start_time = strtotime($start_time_obj->dateTime);
}
$end_time_obj = $event_orig->end;
if ($end_time_obj->date) {
$is_all_day = true;
$end_time = strtotime($end_time_obj->date . ' 00:00:00');
} elseif ($end_time_obj) {
$end_time = strtotime($end_time_obj->dateTime);
} else {
$end_time = $start_time;
}
// Detect URLs for link.
if ($body && !$web_url) {
preg_match('@((https?://)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\S+)?)?)*)@', $body, $urls);
if (count($urls) > 0) {
$web_url = $urls[0];
}
}
// Detect URLs for photo.
if ($location) {
preg_match('@((https?://)?([-\\w]+\\.[-\\w\\.]+)+\\w(:\\d+)?(/([-\\w/_\\.]*(\\?\\S+)?)?)*)@', $location, $urls);
if (count($urls) > 0) {
$banner_url = $urls[0];
}
}
$guid = md5(implode('|', array($event_orig->id, $start_time, $end_time, $title, $location)));
$schedule_record = array('guid' => $guid, 'type' => $item['type'], 'start_time' => $start_time, 'end_time' => $end_time, 'is_all_day' => $is_all_day, 'title' => $title, 'location' => $location, 'body' => \DF\Utilities::truncateText(strip_tags($body), 300), 'banner_url' => $banner_url, 'web_url' => $web_url);
\PVL\Debug::print_r($schedule_record);
$schedule_records[$item['station_id']][$guid] = $schedule_record;
}
}
Debug::endTimer('Get Calendar Records');
if (count($schedule_records) == 0) {
Debug::log('Error: No calendar records loaded');
return;
}
// Add/Remove all differential records.
Debug::startTimer('Sync DB Records');
//.........这里部分代码省略.........