From 0305ac67d8b33b1ba42c583231c7ce3082440529 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Sch=C3=BCtte?= Date: Wed, 30 Aug 2017 16:34:48 +0200 Subject: [PATCH] Add mem stats for offline node. (#493) --- cartographer_ros/cartographer_ros/offline_node_main.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cartographer_ros/cartographer_ros/offline_node_main.cc b/cartographer_ros/cartographer_ros/offline_node_main.cc index 87a039f..c4b3fdd 100644 --- a/cartographer_ros/cartographer_ros/offline_node_main.cc +++ b/cartographer_ros/cartographer_ros/offline_node_main.cc @@ -14,6 +14,10 @@ * limitations under the License. */ +#include +#include +#include +#include #include #include #include @@ -231,6 +235,9 @@ void Run(const std::vector& bag_filenames) { clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &cpu_timespec); LOG(INFO) << "Elapsed CPU time: " << (cpu_timespec.tv_sec + 1e-9 * cpu_timespec.tv_nsec) << " s"; + rusage usage; + CHECK_EQ(getrusage(RUSAGE_SELF, &usage), 0) << strerror(errno); + LOG(INFO) << "Peak memory usage: " << usage.ru_maxrss << " KiB"; #endif if (::ros::ok()) {