本文整理汇总了C++中Timing::AddEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::AddEvent方法的具体用法?C++ Timing::AddEvent怎么用?C++ Timing::AddEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timing
的用法示例。
在下文中一共展示了Timing::AddEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
DecPOMDPDiscreteInterface* decpomdp;
try {
ArgumentHandlers::Arguments args;
argp_parse (&ArgumentHandlers::theArgpStruc, argc, argv, 0, 0, &args);
Timing times;
times.Start("Parsing");
//DecPOMDPDiscreteInterface*
decpomdp = GetDecPOMDPDiscreteInterfaceFromArgs(args);
TransitionObservationIndependentMADPDiscrete *toi=0;
if((toi=dynamic_cast<TransitionObservationIndependentMADPDiscrete*>(decpomdp)) &&
args.qheur==eQMDP &&
!args.cache_flat_models /* otherwise
* GetDecPOMDPDiscreteInterfaceFromArgs
* already caches the flat
* models */)
{
// we don't need a centralized obs model
toi->CreateCentralizedSparseTransitionModel();
}
times.Stop("Parsing");
if(!args.dryrun)
directories::MADPCreateResultsDir("GMAA",*decpomdp);
size_t horizon;
if(args.infiniteHorizon)
horizon=MAXHORIZON;
else
horizon=args.horizon;
times.Start("Overall");
PlanningUnitMADPDiscreteParameters params;
#if 0 // Caching doesn't seem worth the trouble if we're computing
// just one thing (not to mention the memory savings)
if(Qheur==eQMDP) // don't need any of this for solving the MDP
params.SetComputeAll(false);
else
{
params.SetComputeAll(true);
params.SetUseSparseJointBeliefs(true);
}
#else
params.SetComputeAll(false);
if(args.sparse)
params.SetUseSparseJointBeliefs(true);
#endif
times.Start("PlanningUnit");
NullPlanner np(params,horizon,decpomdp);
times.Stop("PlanningUnit");
struct timeval tvStart, tvEnd;
gettimeofday (&tvStart, NULL);
QFunctionJAOHInterface* q=0;
for(int restartI = 0; restartI < args.nrRestarts; restartI++)
{
// with hybrid heuristics already some computation is done
// before Compute(), so start timing now
times.Start("ComputeQ");
q = GetQheuristicFromArgs(&np, args);
q->Compute();
times.Stop("ComputeQ");
// we want to keep the last q computed
if(restartI<(args.nrRestarts-1))
delete q;
}
gettimeofday (&tvEnd, NULL);
clock_t wallclockTime =
static_cast<clock_t>(((tvEnd.tv_sec - tvStart.tv_sec) +
static_cast<double>(tvEnd.tv_usec-tvStart.tv_usec)/1e6) * sysconf(_SC_CLK_TCK));
cout << "Wallclock: from "
<< tvStart.tv_sec << "." << tvStart.tv_usec
<< " until "
<< tvEnd.tv_sec << "." << tvEnd.tv_usec
<< " which took " << wallclockTime << " clock ticks"
<< endl;
times.AddEvent("WallclockTime", wallclockTime);
if(!args.dryrun)
{
times.Start("Save");
q->Save();
times.Stop("Save");
if(args.verbose >= 0)
cout << "Q saved to " << q->GetCacheFilename() << endl;
}
times.Stop("Overall");
if(args.verbose >= 0)
//.........这里部分代码省略.........