Improved timing statements

release/4.3a0
Richard Roberts 2011-02-04 22:31:12 +00:00
parent 8bec3821df
commit ea2f0e10e1
3 changed files with 13 additions and 2 deletions

View File

@ -225,11 +225,12 @@ void choleskyPartial(MatrixColMajor& ABC, size_t nFrontal) {
}
toc(1, "dpotrf");
} else {
tic(1, "choleskyCareful");
bool fullRank = choleskyCareful(ABC, nFrontal).second;
if(!fullRank)
throw invalid_argument("Rank-deficient");
toc(1, "choleskyCareful");
}
toc(1, "dpotrf");
#ifndef NDEBUG
// Check for non-finite values

View File

@ -188,7 +188,13 @@ inline void toc_(size_t id) {
}
inline void toc_(size_t id, const std::string& label) {
assert(label == timingCurrent.lock()->label_);
#ifndef NDEBUG
if(label != timingCurrent.lock()->label_) {
std::cerr << "gtsam timing: toc called with id=" << id << ", label=\"" << label << "\", but expecting \"" << timingCurrent.lock()->label_ << "\"" << std::endl;
timingRoot->print();
exit(1);
}
#endif
toc_(id);
}

View File

@ -38,6 +38,7 @@ namespace gtsam {
/* ************************************************************************* */
template <class FG>
void JunctionTree<FG>::construct(const FG& fg, const VariableIndex& variableIndex) {
tic(1, "JT Constructor");
tic(1, "JT symbolic ET");
const typename EliminationTree<IndexFactor>::shared_ptr symETree(EliminationTree<IndexFactor>::Create(fg, variableIndex));
toc(1, "JT symbolic ET");
@ -52,6 +53,7 @@ namespace gtsam {
tic(4, "distributeFactors");
this->root_ = distributeFactors(fg, sbt.root());
toc(4, "distributeFactors");
toc(1, "JT Constructor");
}
/* ************************************************************************* */
@ -191,9 +193,11 @@ namespace gtsam {
template <class FG>
typename JunctionTree<FG>::BayesTree::sharedClique JunctionTree<FG>::eliminate(bool cache) const {
if(this->root()) {
tic(2,"JT eliminate");
pair<typename BayesTree::sharedClique, typename FG::sharedFactor> ret = this->eliminateOneClique(this->root(), cache);
if (ret.second->size() != 0)
throw runtime_error("JuntionTree::eliminate: elimination failed because of factors left over!");
toc(2,"JT eliminate");
return ret.first;
} else
return typename BayesTree::sharedClique();