本文整理汇总了C++中TTimer类的典型用法代码示例。如果您正苦于以下问题:C++ TTimer类的具体用法?C++ TTimer怎么用?C++ TTimer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTimer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VetoThres2
void VetoThres2(Int_t Lo, Int_t Hi)
{
TCanvas* Window;
TTimer* Refresh;
TH1F* Energy;
Char_t Buff[256];
Char_t* Keyb;
Double_t Pos[438];
Window = new TCanvas();
Window->SetCrosshair();
Window->ToggleEventStatus();
Refresh = new TTimer("Flush()", 50, kFALSE);
for(Int_t ch=Lo; ch<Hi+1; ch++)
{
sprintf(Buff, "Veto_Energy%d", ch);
Energy = (TH1F*)gROOT->FindObject(Buff);
Energy->GetXaxis()->SetRange(0, 250);
Energy->Draw();
Window->Update();
sprintf(Buff, "Threshold for %d: ", ch);
Refresh->TurnOn();
Refresh->Reset();
Keyb = Getline(Buff);
Refresh->TurnOff();
Pos[ch] = atof(Keyb);
}
for(Int_t ch=Lo; ch<Hi+1; ch++)
printf("%5.1f\n", Pos[ch]);
}
示例2: deactivate
void TTimer::enableTimer()
{
if( canBeUnlocked( 0 ) )
{
if( activate() )
{
if( mScript.size() > 0 )
{
mpTimer->start();
}
}
else
{
deactivate();
mpTimer->stop();
}
}
if( ! isOffsetTimer() )
{
typedef list<TTimer *>::const_iterator I;
for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
{
TTimer * pChild = *it;
if( ! pChild->isOffsetTimer() ) pChild->enableTimer();
}
}
}
示例3: KBucketIndex
void RoutingTable::TouchKBucket(const KadID &node_id) {
int index = KBucketIndex(node_id);
if (index < 0)
return;
TTimer timer;
k_buckets_[index]->set_last_accessed(static_cast<unsigned int>(timer.current()));
}
示例4: reenableAllTriggers
void TimerUnit::reenableAllTriggers()
{
for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
pChild->enableTimer( pChild->getID() );
}
}
示例5: reenableAllTriggers
void TimerUnit::reenableAllTriggers()
{
typedef list<TTimer *>::const_iterator I;
for( I it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
pChild->enableTimer( pChild->getID() );
}
}
示例6: main
int main(int argc, char** argv) {
size_t iter = 1;
int q = 1009;
int n = 2000;
std::string file = "";
Argument as[] = {
{ 'q', "-q Q", "Set the field characteristic (-1 for random).", TYPE_INT , &q },
{ 'n', "-n N", "Set the dimension of the matrix.", TYPE_INT , &n },
{ 'i', "-i R", "Set number of repetitions.", TYPE_INT , &iter },
{ 'f', "-f FILE", "Set the input file (empty for random).", TYPE_STR , &file },
END_OF_ARGUMENTS
};
FFLAS::parseArguments(argc,argv,as);
typedef Givaro::Modular<double> Field;
typedef Field::Element Element;
Field F(q);
Element * A;
TTimer chrono;
double time=0.0;
Field::RandIter G(F);
for (size_t i=0;i<iter;++i){
if (!file.empty()){
A = read_field (F, file.c_str(), &n, &n);
} else {
A = FFLAS::fflas_new<Element>(n*n);
for (size_t j=0; j<(size_t) n*n; ++j)
G.random(*(A+j));
}
for (size_t k=0;k<(size_t)n;++k)
while (F.isZero( G.random(*(A+k*(n+1)))));
chrono.clear();
chrono.start();
clapack_dtrtri(CblasRowMajor,CblasUpper, CblasNonUnit,n,A,n);
chrono.stop();
time+=chrono.usertime();
FFLAS::fflas_delete( A);
}
// -----------
// Standard output for benchmark - Alexis Breust 2014/11/14
std::cout << "Time: " << time / double(iter)
<< " Gflops: " << (2.*double(n)/1000.*double(n)/1000.*double(n)/1000.0) / time * double(iter) / 3.;
FFLAS::writeCommandString(std::cout, as) << std::endl;
return 0;
}
示例7: GetRefreshList
void RoutingTable::GetRefreshList(const unsigned short int &start_kbucket,
const bool &force, std::vector<KadID> *ids) {
TTimer timer ;
unsigned int curr_time = static_cast<unsigned int> (timer.system_time());
for (size_t i = start_kbucket; i < k_buckets_.size(); ++i)
if (force || curr_time-k_buckets_[i]->last_accessed() > KRefreshTime) {
ids->push_back(KadID(k_buckets_[i]->range_min(),
k_buckets_[i]->range_max()));
}
}
示例8: compileAll
void TimerUnit::compileAll()
{
for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
if( pChild->isActive() )
{
pChild->mNeedsToBeCompiled = true;
}
}
}
示例9: compileAll
void TimerUnit::compileAll()
{
typedef list<TTimer *>::const_iterator I;
for( I it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
if( pChild->isActive() )
{
pChild->mNeedsToBeCompiled = true;
}
}
}
示例10: _assembleReport
void TimerUnit::_assembleReport( TTimer * pChild )
{
list<TTimer*> * childrenList = pChild->mpMyChildrenList;
for(auto it2 = childrenList->begin(); it2 != childrenList->end(); it2++)
{
TTimer * pT = *it2;
_assembleReport( pT );
if( pT->isActive() ) statsActiveTriggers++;
if( pT->isTempTimer() ) statsTempTriggers++;
statsTriggerTotal++;
}
}
示例11: wait
/************ wait funtion !! ***************************************************************
*********************************************************************************************/
void wait(){
TTimer *timer = new TTimer("gSystem->ProcessEvents();", 50, kFALSE);
char *input;
Bool_t done = kFALSE;
do{
timer->TurnOn();
timer->Reset();
input=Getline("Type <return> to continue : ");
timer->TurnOff();
if(input){ done =kTRUE; }
}while(!done);
}
示例12: removeAllTempTimers
void TimerUnit::removeAllTempTimers()
{
mCleanupList.clear();
for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
if( pChild->isTempTimer() )
{
pChild->killTimer();
pChild->mOK_code = false; //important to not crash on stale Lua function args
markCleanup( pChild );
}
}
}
示例13: getTimerPrivate
void TimerUnit::reParentTimer( int childID, int oldParentID, int newParentID, int parentPosition, int childPosition )
{
TTimer * pOldParent = getTimerPrivate( oldParentID );
TTimer * pNewParent = getTimerPrivate( newParentID );
TTimer * pChild = getTimerPrivate( childID );
if( ! pChild )
{
return;
}
pChild->disableTimer( childID );
if( pOldParent )
{
pOldParent->popChild( pChild );
}
if( ! pOldParent )
{
mTimerRootNodeList.remove( pChild );
}
if( pNewParent )
{
pNewParent->addChild( pChild, parentPosition, childPosition );
if( pChild ) pChild->setParent( pNewParent );
}
else
{
pChild->Tree<TTimer>::setParent( 0 );
addTimerRootNode( pChild, parentPosition, childPosition );
}
pChild->enableTimer( childID );
}
示例14: compileAll
void TTimer::compileAll()
{
mNeedsToBeCompiled = true;
if( ! compileScript() )
{
if( mudlet::debugMode ) {TDebug(QColor(Qt::white),QColor(Qt::red))<<"ERROR: Lua compile error. compiling script of timer:"<<mName<<"\n">>0;}
mOK_code = false;
}
typedef list<TTimer *>::const_iterator I;
for( I it = mpMyChildrenList->begin(); it != mpMyChildrenList->end(); it++)
{
TTimer * pChild = *it;
pChild->compileAll();
}
}
示例15: killTimer
bool TimerUnit::killTimer(const QString & name )
{
for(auto it = mTimerRootNodeList.begin(); it != mTimerRootNodeList.end(); it++)
{
TTimer * pChild = *it;
if( pChild->getName() == name )
{
// only temporary timers can be killed
if( ! pChild->isTempTimer() ) return false;
pChild->killTimer();
markCleanup( pChild );
return true;
}
}
return false;
}