本文整理汇总了PHP中Timer::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::reset方法的具体用法?PHP Timer::reset怎么用?PHP Timer::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::reset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testReset
/**
* @covers BT\Timer::reset
*/
public function testReset()
{
$this->object->start();
$this->object->stop();
$this->assertInternalType("float", $this->object->getStart());
$this->assertInternalType("float", $this->object->getStop());
$this->object->reset();
$this->assertInternalType("float", $this->object->getStart());
$this->assertInternalType("float", $this->object->getStop());
}
示例2: test_average_calculations
public function test_average_calculations()
{
$timer = new Timer();
// This should false if the timer has not been started
$this->assertFalse($timer->average());
$timer->start();
$timer->stop();
$timer->reset();
// Should also return false if reset
$this->assertFalse($timer->average());
// Set some known values
$timer->start();
$timer->stop();
$timer->stop_time = $timer->start_time + 100;
$timer->set_total_items(100);
$timer->current_item = 4;
$this->assertEquals(25, $timer->average());
}
示例3:
}
mysql_free_result($thread_result);
if($changed)
$cindex->commit();
//Do the upload:
$term = new Zend_Search_Lucene_Index_Term($fileid, 'fileid');
$docIds = $uindex->termDocs($term);
if(count($docIds) == 0)
{
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Keyword('fileid', $fileid));
$doc->addField(Zend_Search_Lucene_Field::Unstored('filename', $filename));
$doc->addField(Zend_Search_Lucene_Field::Unstored('uploader', $uploader));
$uindex->addDocument($doc);
$uindex->commit();
}
echo "\n";
flush();
}
echo "Done.\noptimizing indices... ";
flush();
$cindex->optimize();
$uindex->optimize();
echo "Done (".number_format($timer->reset(), 5)."s)\n\nUpload index size is ".$uindex->count().", ".$uindex->numDocs()." documents.\n\nComment index size is ".$cindex->count().", ".$cindex->numDocs()." documents.\n\n";
?>
示例4: LRNDA
// Make Lex object
$Lex = $Tree->make_lex();
$Lex->dump();
echo "----------\n";
// Make Grammar object
$rawgrammar = $Tree->evaluate();
$Grammar = GrammarBuilder::make($rawgrammar);
// Load special rules
$Grammar->exclude_terminal(J_EXPR_STATEMENT, '{');
$Grammar->exclude_terminal(J_EXPR_STATEMENT, J_FUNCTION);
// trash dummy rules that we used just to get redundant terminals into the Lex
$Grammar->remove_rules(J_RESERVED);
$Grammar->remove_rules(J_IGNORE);
$Grammar->dump($Lex);
echo "----------\n";
printf("Ready to build automaton after %f milliseconds\n", $Timer->reset());
// Make Parse Table object
$NDA = new LRNDA($Grammar, 1);
printf("NDA built in %f milliseconds\n", $Timer->reset());
$Table = $NDA->export();
printf("Table exported in %f milliseconds\n", $Timer->reset());
/**
* Dump classes into files
*/
@ob_end_flush();
ob_start();
$Lex->class_export($lexname, $commentData);
file_put_contents($classdir . '/' . $lexname . '.php', "<?php\n" . ob_get_contents());
ob_clean();
$Grammar->class_export($grammarname, $commentData);
file_put_contents($classdir . '/' . $grammarname . '.php', "<?php\n" . ob_get_contents());