release/4.3a0
Varun Agrawal 2024-12-31 21:01:28 -05:00
parent 30670ab1a5
commit 6e4d1fa1cc
2 changed files with 11 additions and 11 deletions

View File

@ -107,7 +107,7 @@ void TimingOutline::print(const std::string& outline) const {
} }
/* ************************************************************************* */ /* ************************************************************************* */
void TimingOutline::print_csv_header(bool addLineBreak) const { void TimingOutline::printCsvHeader(bool addLineBreak) const {
#ifdef GTSAM_USE_BOOST_FEATURES #ifdef GTSAM_USE_BOOST_FEATURES
// Order is (CPU time, number of times, wall time, time + children in seconds, // Order is (CPU time, number of times, wall time, time + children in seconds,
// min time, max time) // min time, max time)
@ -116,14 +116,14 @@ void TimingOutline::print_csv_header(bool addLineBreak) const {
<< "," << label_ + " min time (s)" << "," << label_ + "max time(s)" << "," << label_ + " min time (s)" << "," << label_ + "max time(s)"
<< ","; << ",";
// Order children // Order children
typedef FastMap<size_t, std::shared_ptr<TimingOutline> > ChildOrder; typedef FastMap<size_t, std::shared_ptr<TimingOutline>> ChildOrder;
ChildOrder childOrder; ChildOrder childOrder;
for (const ChildMap::value_type& child : children_) { for (const ChildMap::value_type& child : children_) {
childOrder[child.second->myOrder_] = child.second; childOrder[child.second->myOrder_] = child.second;
} }
// Print children // Print children
for (const ChildOrder::value_type& order_child : childOrder) { for (const ChildOrder::value_type& order_child : childOrder) {
order_child.second->print_csv_header(); order_child.second->printCsvHeader();
} }
if (addLineBreak) { if (addLineBreak) {
std::cout << std::endl; std::cout << std::endl;
@ -133,21 +133,21 @@ void TimingOutline::print_csv_header(bool addLineBreak) const {
} }
/* ************************************************************************* */ /* ************************************************************************* */
void TimingOutline::print_csv(bool addLineBreak) const { void TimingOutline::printCsv(bool addLineBreak) const {
#ifdef GTSAM_USE_BOOST_FEATURES #ifdef GTSAM_USE_BOOST_FEATURES
// Order is (CPU time, number of times, wall time, time + children in seconds, // Order is (CPU time, number of times, wall time, time + children in seconds,
// min time, max time) // min time, max time)
std::cout << self() << "," << n_ << "," << wall() << "," << secs() << "," std::cout << self() << "," << n_ << "," << wall() << "," << secs() << ","
<< min() << "," << max() << ","; << min() << "," << max() << ",";
// Order children // Order children
typedef FastMap<size_t, std::shared_ptr<TimingOutline> > ChildOrder; typedef FastMap<size_t, std::shared_ptr<TimingOutline>> ChildOrder;
ChildOrder childOrder; ChildOrder childOrder;
for (const ChildMap::value_type& child : children_) { for (const ChildMap::value_type& child : children_) {
childOrder[child.second->myOrder_] = child.second; childOrder[child.second->myOrder_] = child.second;
} }
// Print children // Print children
for (const ChildOrder::value_type& order_child : childOrder) { for (const ChildOrder::value_type& order_child : childOrder) {
order_child.second->print_csv(false); order_child.second->printCsv(false);
} }
if (addLineBreak) { if (addLineBreak) {
std::cout << std::endl; std::cout << std::endl;

View File

@ -209,7 +209,7 @@ namespace gtsam {
* @param addLineBreak Flag indicating if a line break should be added at * @param addLineBreak Flag indicating if a line break should be added at
* the end. Only used at the top-leve. * the end. Only used at the top-leve.
*/ */
GTSAM_EXPORT void print_csv_header(bool addLineBreak = false) const; GTSAM_EXPORT void printCsvHeader(bool addLineBreak = false) const;
/** /**
* @brief Print the times recursively from parent to child in CSV format. * @brief Print the times recursively from parent to child in CSV format.
@ -220,7 +220,7 @@ namespace gtsam {
* @param addLineBreak Flag indicating if a line break should be added at * @param addLineBreak Flag indicating if a line break should be added at
* the end. Only used at the top-leve. * the end. Only used at the top-leve.
*/ */
GTSAM_EXPORT void print_csv(bool addLineBreak = false) const; GTSAM_EXPORT void printCsv(bool addLineBreak = false) const;
GTSAM_EXPORT const std::shared_ptr<TimingOutline>& GTSAM_EXPORT const std::shared_ptr<TimingOutline>&
child(size_t child, const std::string& label, const std::weak_ptr<TimingOutline>& thisPtr); child(size_t child, const std::string& label, const std::weak_ptr<TimingOutline>& thisPtr);
@ -292,11 +292,11 @@ inline void tictoc_print_() {
::gtsam::internal::gTimingRoot->print(); } ::gtsam::internal::gTimingRoot->print(); }
// print timing in CSV format // print timing in CSV format
inline void tictoc_print_csv_(bool displayHeader = false) { inline void tictoc_printCsv_(bool displayHeader = false) {
if (displayHeader) { if (displayHeader) {
::gtsam::internal::gTimingRoot->print_csv_header(true); ::gtsam::internal::gTimingRoot->printCsvHeader(true);
} }
::gtsam::internal::gTimingRoot->print_csv(true); ::gtsam::internal::gTimingRoot->printCsv(true);
} }
// print mean and standard deviation // print mean and standard deviation