本文整理汇总了PHP中Timer::printTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::printTime方法的具体用法?PHP Timer::printTime怎么用?PHP Timer::printTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::printTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Timer
<?php
require 'Timer.class.php';
$timer = new Timer();
$timer->start();
$timer->start('program1');
usleep(mt_rand(100000, 500000));
$timer->end('program1');
$timer->printTime('program1');
$timer->start('program2');
usleep(mt_rand(100000, 500000));
$timer->end('program2');
$timer->printTime('program2');
$timer->end();
$timer->printTime();
示例2: OsidContext
/* require_once(CONCERTO.'/tests/dbconnect.inc.php'); */
/* } */
require_once HARMONI . "errorHandler/ErrorHandler.class.php";
$errorHandler = Services::getService("ErrorHandler");
$context = new OsidContext();
$configuration = new ConfigurationProperties();
Services::startManagerAsService("DatabaseManager", $context, $configuration);
$test = new GroupTest('CourseManagementTest');
$test->addTestFile(dirname(__FILE__) . '/CanonicalCourseTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGroupTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseOfferingTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/TermTest.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseSectionTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/EnrollmentRecordTestCase.class.php');
$test->addTestFile(dirname(__FILE__) . '/CourseGradeRecordTest.class.php');
$test->attachObserver(new DoboTestHtmlDisplay());
$test->run();
$timer->end();
print "\n<br />Harmoni Load Time: " . $harmonyLoadupTimer->printTime();
print "\n<br />Overall Time: " . $timer->printTime();
$dbhandler = Services::getService("DBHandler");
printpre("NumQueries: " . $dbhandler->getTotalNumberOfQueries());
print "\n</p>";
// $num = $dbHandler->getTotalNumberOfQueries();
// debug::output("Total # of queries: ".$num,1,"DBHandler");
//debug::printAll();
// unset($dbHandler,$errorHandler, $userError);
// unset($num);
// $errorHandler->printErrors(HIGH_DETAIL);
// print "<pre>";
// print_r($errorHandler);
示例3: error_reporting
<?php
include 'dbpedia.php';
error_reporting(E_ALL);
Timer::start("main::Runtime");
// Setup the language version of Wikipedia
$language = Options::getOption('language');
$pageTitles = new AllTemplatesSqlIterator($language);
$job = new ExtractionJob(new DatabaseWikipediaCollection($language), $pageTitles);
$groupInfoboxes = new ExtractionGroup(new NullDestination());
$groupInfoboxes->addExtractor(new TemplateRedirectExtractor());
// Add the ExtractionGroups to the ExtractionJob
$job->addExtractionGroup($groupInfoboxes);
//Execute the Extraction Job
$manager = new ExtractionManager();
$manager->execute($job);
Timer::stop("main::Runtime");
Timer::printTime();
示例4: updateTable
//.........这里部分代码省略.........
if ($modificationDate->isGreaterThan(DateAndTime::fromString($result->field('datestamp'))) || $forceUpdate) {
// printpre("\tUpdating:\t".$asset->getDisplayName());
$query = $baseUpdateQuery->copy();
$query->addWhereEqual("oai_set", $repositoryId->getIdString());
$query->addWhereEqual("oai_identifier", $assetId->getIdString());
} else {
$query = null;
}
}
if ($query) {
$query->addRawValue('datestamp', 'NOW()');
}
$isCurrentlyDeleted = $result->getNumberOfRows() && $result->field('deleted') == 'true' ? true : false;
$result->free();
if (!count($authGroupIds)) {
$isVisible = true;
} else {
$isVisible = false;
try {
foreach ($authGroupIds as $id) {
if ($authorizationManager->isAuthorized($id, $viewId, $assetId)) {
$isVisible = true;
break;
}
}
} catch (UnknownIdException $e) {
$isVisible = true;
}
}
if ($query) {
//Add the data fields
// Deleted
if ($isVisible) {
$query->addValue('deleted', 'false');
} else {
$query->addValue('deleted', 'true');
}
$query->addValue('dc_title', $asset->getDisplayName());
$query->addValue('dc_description', $asset->getDescription());
$this->addDublinCoreValues($asset, $query);
$dbc->query($query, $config->getProperty('OAI_DBID'));
$updatesInRepository++;
$numUpdates++;
} else {
if ($isCurrentlyDeleted && $isVisible) {
$query = $baseUndeleteQuery->copy();
} else {
if (!$isCurrentlyDeleted && !$isVisible) {
$query = $baseDeleteQuery->copy();
} else {
$query = null;
}
}
if ($query) {
$query->addWhereEqual("oai_set", $repositoryId->getIdString());
$query->addWhereEqual("oai_identifier", $assetId->getIdString());
$dbc->query($query, $config->getProperty('OAI_DBID'));
$updatesInRepository++;
$numUpdates++;
}
}
$status->updateStatistics();
}
// Update any missing assets as deleted
$query = $baseDeleteQuery->copy();
$query->addWhereEqual("oai_set", $repositoryId->getIdString());
if (count($existingAssetIds)) {
$query->addWhereEqual("deleted", "false");
$query->addWhereNotIn("oai_identifier", $existingAssetIds);
}
$result = $dbc->query($query, $config->getProperty('OAI_DBID'));
if ($result->getNumberOfRows()) {
$updatesInRepository = $updatesInRepository + $result->getNumberOfRows();
$numUpdates = $numUpdates + $result->getNumberOfRows();
}
print OAI_UPDATE_OUTPUT_HTML ? "<pre>" : "\n";
print "Elapsed Time:\t";
$timer->end();
printf("%1.2f", $timer->printTime());
print " seconds";
print OAI_UPDATE_OUTPUT_HTML ? "</pre>" : "";
print OAI_UPDATE_OUTPUT_HTML ? "<pre>" : "\n";
print "Updates: " . $updatesInRepository;
print OAI_UPDATE_OUTPUT_HTML ? "</pre>" : "\n";
}
// Update any missing repositories as deleted
$query = $baseDeleteQuery->copy();
$query->addWhereEqual("deleted", "false");
if (count($existingRepositoryIds)) {
$query->addWhereNotIn("oai_set", $existingRepositoryIds);
}
$result = $dbc->query($query, $config->getProperty('OAI_DBID'));
if ($result->getNumberOfRows()) {
$updatesInRepository = $updatesInRepository + $result->getNumberOfRows();
$numUpdates = $numUpdates + $result->getNumberOfRows();
}
print OAI_UPDATE_OUTPUT_HTML ? "<pre>" : "\n";
print "Total Updates:\t" . $numUpdates;
print OAI_UPDATE_OUTPUT_HTML ? "</pre>" : "\n";
}
示例5: Timer
require_once MYDIR . "/main/include/setup.inc.php";
/*********************************************************
* Execute our actions
*********************************************************/
if (defined('ENABLE_TIMERS') && ENABLE_TIMERS) {
require_once HARMONI . "/utilities/Timer.class.php";
$execTimer = new Timer();
$execTimer->start();
}
require_once HARMONI . "architecture/output/CommandLineOutputHandler.class.php";
$harmoni->attachOutputHandler(new CommandLineOutputHandler());
require_once HARMONI . "architecture/request/CommandLineRequestHandler.class.php";
$harmoni->request->assignRequestHandler(new CommandLineRequestHandler($_SERVER['argv']));
try {
$harmoni->execute();
} catch (UnknownActionException $e) {
print HELP_TEXT;
} catch (HelpRequestedException $e) {
print $e->getMessage();
}
if (defined('ENABLE_TIMERS') && ENABLE_TIMERS) {
$execTimer->end();
print "\n<table>\n<tr><th align='right'>Execution Time:</th>\n<td align='right'><pre>";
printf("%1.6f", $execTimer->printTime());
print "</pre></td></tr>\n</table>";
$dbhandler = Services::getService("DBHandler");
printpre("NumQueries: " . $dbhandler->getTotalNumberOfQueries());
// printpreArrayExcept($_SESSION, array('__temporarySets'));
// debug::output(session_id());
// Debug::printAll();
}
示例6: getAZs
//.........这里部分代码省略.........
// var_dump($returnExplicitOnly);
// var_dump($searchUp);
// if this is an AZ that is implicit because of a group instead
// of because of the hierarchy, create it.
if ($row['qid'] == $qId && $row['aid'] != $aId) {
// printpre("In first clause (AuthorizationCache)");
$qualifierId = $idManager->getId($qId);
// If we are getting implicit AZs for a given agent, make sure
// that the implicit AZ has their Id.
if ($aId) {
$agentId = $idManager->getId($aId);
} else {
$agentId = $authorization->getAgentId();
}
$function = $authorization->getFunction();
$functionId = $function->getId();
$effectiveDate = $authorization->getEffectiveDate();
$expirationDate = $authorization->getExpirationDate();
$implicit = new HarmoniAuthorization(null, $agentId, $functionId, $qualifierId, false, $this, $effectiveDate, $expirationDate);
$azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $qualifierId->getIdString();
if (!in_array($azHash, $createdImplicitAZs)) {
$authorizations[] = $implicit;
$createdImplicitAZs[] = $azHash;
}
} else {
if (!$returnExplicitOnly && $qId) {
// printpre("In second clause (AuthorizationCache)");
// If we are getting implicit AZs for a given agent, make sure
// that the implicit AZ has their Id.
if ($aId) {
$agentId = $idManager->getId($aId);
} else {
$agentId = $authorization->getAgentId();
}
$function = $authorization->getFunction();
$functionId = $function->getId();
$effectiveDate = $authorization->getEffectiveDate();
$expirationDate = $authorization->getExpirationDate();
$implicitQualifierId = $idManager->getId($qId);
$implicit = new HarmoniAuthorization(null, $agentId, $functionId, $implicitQualifierId, false, $this, $effectiveDate, $expirationDate);
$azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $implicitQualifierId->getIdString();
if (!in_array($azHash, $createdImplicitAZs)) {
$authorizations[] = $implicit;
$createdImplicitAZs[] = $azHash;
}
} else {
if (!$returnExplicitOnly) {
printpre($row);
printpre("In third clause (AuthorizationCache)");
$explicitQualifier = $authorization->getQualifier();
$explicitQualifierId = $explicitQualifier->getId();
// If we are getting implicit AZs for a given agent, make sure
// that the implicit AZ has their Id.
if ($aId) {
$agentId = $idManager->getId($aId);
} else {
$agentId = $authorization->getAgentId();
}
$function = $authorization->getFunction();
$functionId = $function->getId();
$effectiveDate = $authorization->getEffectiveDate();
$expirationDate = $authorization->getExpirationDate();
// this is set 2
$authZManager = Services::getService("AuthZ");
$hierarchies = $authZManager->getQualifierHierarchies();
while ($hierarchies->hasNext()) {
$hierarchyId = $hierarchies->next();
$hierarchy = $hierarchyManager->getHierarchy($hierarchyId);
$timer = new Timer();
$timer->start();
$nodes = $hierarchy->traverse($explicitQualifierId, Hierarchy::TRAVERSE_MODE_DEPTH_FIRST, Hierarchy::TRAVERSE_DIRECTION_DOWN, Hierarchy::TRAVERSE_LEVELS_ALL);
$timer->end();
printf("LoadAZTime: %1.6f <br/>", $timer->printTime());
// now get the id of each node and store in array
$set2 = array();
// skip the first node
$nodes->next();
while ($nodes->hasNext()) {
$info = $nodes->next();
$nodeId = $info->getNodeId();
$implicit = new HarmoniAuthorization(null, $agentId, $functionId, $nodeId, false, $this, $effectiveDate, $expirationDate);
$azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $nodeId->getIdString();
// printpre($azHash);
// Weird bugs were happening, with $createdImplicitAZs
// but I can't figure out what is going on.
if (!in_array($azHash, $createdImplicitAZs)) {
$authorizations[] = $implicit;
// $createdImplicitAZs[] = $azHash;
}
}
}
}
}
}
}
$queryResult->advanceRow();
}
$queryResult->free();
return $authorizations;
}
示例7: buildContent
/**
* Build the content for this action
*
* @return void
* @access public
* @since 4/26/05
*/
function buildContent()
{
require_once HARMONI . "/utilities/Timer.class.php";
$execTimer = new Timer();
$execTimer->start();
$harmoni = Harmoni::instance();
$idManager = Services::getService("Id");
$slideshowAsset = $this->getAsset();
/*********************************************************
* First print the header, then the xml content, then exit before
* the GUI system has a chance to try to theme the output.
*********************************************************/
header("Content-Type: text/xml; charset=\"utf-8\"");
print <<<END
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE slideshow PUBLIC "- //Middlebury College//Slide-Show//EN" "http://concerto.sourceforge.net/dtds/viewer/2.0/slideshow.dtd">
<slideshow>
END;
print "\t<title>" . $slideshowAsset->getDisplayName() . "</title>\n";
print "\t<default_size>medium</default_size>\n";
$setManager = Services::getService("Sets");
$slideshowSet = $setManager->getPersistentSet($slideshowAsset->getId());
$slideIterator = $slideshowAsset->getAssets();
$orderedSlides = array();
$unorderedSlides = array();
while ($slideIterator->hasNext()) {
$slideAsset = $slideIterator->next();
$slideAssetId = $slideAsset->getId();
if ($slideshowSet->isInSet($slideAssetId)) {
$orderedSlides[$slideshowSet->getPosition($slideAssetId)] = $slideAsset;
} else {
$unorderedSlides[] = $slideAsset;
}
}
ksort($orderedSlides);
$slides = array_merge($orderedSlides, $unorderedSlides);
unset($orderedSlides, $unorderedSlides);
foreach (array_keys($slides) as $key) {
$this->printSlide($slides[$key]);
}
$execTimer->end();
print "\n\n<ExecutionTime>";
printf("%1.6f", $execTimer->printTime());
print "</ExecutionTime>\n";
$dbhandler = Services::getService("DBHandler");
print "<NumQueries>" . $dbhandler->getTotalNumberOfQueries() . "</NumQueries>\n";
print "</slideshow>\n";
exit;
}