avoid multiple std::string() calls in toc function
parent
1db3cdc780
commit
29b245d1dc
|
@ -272,20 +272,21 @@ void tic(size_t id, const char *labelC) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void toc(size_t id, const char *label) {
|
void toc(size_t id, const char *labelC) {
|
||||||
// disable anything which refers to TimingOutline as well, for good measure
|
// disable anything which refers to TimingOutline as well, for good measure
|
||||||
#ifdef GTSAM_USE_BOOST_FEATURES
|
#ifdef GTSAM_USE_BOOST_FEATURES
|
||||||
|
const std::string label(labelC);
|
||||||
std::shared_ptr<TimingOutline> current(gCurrentTimer.lock());
|
std::shared_ptr<TimingOutline> current(gCurrentTimer.lock());
|
||||||
if (id != current->id_) {
|
if (id != current->id_) {
|
||||||
gTimingRoot->print();
|
gTimingRoot->print();
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
"gtsam timing: Mismatched tic/toc: gttoc(\"" + std::string(label) +
|
"gtsam timing: Mismatched tic/toc: gttoc(\"" + label +
|
||||||
"\") called when last tic was \"" + current->label_ + "\".");
|
"\") called when last tic was \"" + current->label_ + "\".");
|
||||||
}
|
}
|
||||||
if (!current->parent_.lock()) {
|
if (!current->parent_.lock()) {
|
||||||
gTimingRoot->print();
|
gTimingRoot->print();
|
||||||
throw std::invalid_argument(
|
throw std::invalid_argument(
|
||||||
"gtsam timing: Mismatched tic/toc: extra gttoc(\"" + std::string(label) +
|
"gtsam timing: Mismatched tic/toc: extra gttoc(\"" + label +
|
||||||
"\"), already at the root");
|
"\"), already at the root");
|
||||||
}
|
}
|
||||||
current->toc();
|
current->toc();
|
||||||
|
|
Loading…
Reference in New Issue