本文整理汇总了PHP中Timer::startTimer方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::startTimer方法的具体用法?PHP Timer::startTimer怎么用?PHP Timer::startTimer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::startTimer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importDataFromSource
//.........这里部分代码省略.........
$o_env_reader->nextRow();
switch (sizeof($va_env_tmp)) {
case 1:
$vs_env_value = $o_env_reader->get($va_environment_item['value'], array('returnAsArray' => false));
break;
case 2:
$vn_seek = (int) $va_env_tmp[0];
$o_reader->seek($vn_seek > 0 ? $vn_seek - 1 : $vn_seek);
$o_env_reader->nextRow();
$vs_env_value = $o_env_reader->get($va_env_tmp[1], array('returnAsArray' => false));
$o_reader->seek(0);
break;
default:
$vs_env_value = $va_environment_item['value'];
break;
}
$va_environment[$va_environment_item['name']] = $vs_env_value;
}
}
//
// Run through rows
//
$vn_row = 0;
ca_data_importers::$s_num_records_processed = 0;
while ($o_reader->nextRow()) {
$va_mandatory_field_values = array();
$vs_preferred_label_for_log = null;
if ($vn_row < $vn_num_initial_rows_to_skip) {
// skip over initial header rows
$vn_row++;
continue;
}
$vn_row++;
$t->startTimer();
$o_log->logDebug(_t('Started reading row %1 at %2 seconds', $vn_row, $t->getTime(4)));
$t_subject = $o_dm->getInstanceByTableNum($vn_table_num);
if ($o_trans) {
$t_subject->setTransaction($o_trans);
}
$t_subject->setMode(ACCESS_WRITE);
// Update status display
if ($vb_use_ncurses && ca_data_importers::$s_num_records_processed) {
ncurses_mvwaddstr($r_status, 1, 2, _t("Items processed/skipped: %1/%2", ca_data_importers::$s_num_records_processed, ca_data_importers::$s_num_records_skipped) . str_repeat(" ", 5) . _t("Errors: %1 (%2)", ca_data_importers::$s_num_import_errors, sprintf("%3.1f", ca_data_importers::$s_num_import_errors / ca_data_importers::$s_num_records_processed * 100) . "%") . str_repeat(" ", 6) . _t("Mapping: %1", $ps_mapping) . str_repeat(" ", 5) . _t("Source: %1", $ps_source) . str_repeat(" ", 5) . date("Y-m-d H:i:s") . str_repeat(" ", 5));
ncurses_refresh(0);
ncurses_wrefresh($r_status);
}
//
// Get data for current row
//
$va_row = array_merge($o_reader->getRow(), $va_environment);
//
// Apply rules
//
foreach ($va_mapping_rules as $va_rule) {
if (!isset($va_rule['trigger']) || !$va_rule['trigger']) {
continue;
}
if (!isset($va_rule['actions']) || !is_array($va_rule['actions']) || !sizeof($va_rule['actions'])) {
continue;
}
$vm_ret = ExpressionParser::evaluate($va_rule['trigger'], $va_row);
if (!ExpressionParser::hadError() && (bool) $vm_ret) {
foreach ($va_rule['actions'] as $va_action) {
if (!is_array($va_action) && strtolower($va_action) == 'skip') {
$va_action = array('action' => 'skip');
}
示例2: Timer
/**
* Три... Два... Один... Запуск!
*
* @package energine
* @author pavka
* @copyright Energine 2011
*/
try {
require_once 'bootstrap.php';
if ($use_timer = E()->getConfigValue('site.useTimer')) {
class Timer extends Energine\share\gears\Primitive
{
}
$timer = new Timer();
$timer->startTimer();
}
E()->UserSession->init();
E()->getController()->run();
if ($use_timer) {
$timer->stopTimer();
E()->getResponse()->setHeader('X-Timer', $timer->getTimer());
}
E()->getResponse()->commit();
} catch (\LogicException $bootstrapException) {
//Все исключения перехваченные здесь произошли в bootstrap'e
//И ориентироваться на наличие DEBUG здесь нельзя
//Поэтому выводим как есть
header('Content-Type: text/plain; charset=utf-8');
echo $bootstrapException->getMessage();
} catch (\Exception $generalException) {