Add mem stats for offline node. (#493)

master
Christoph Schütte 2017-08-30 16:34:48 +02:00 committed by Wolfgang Hess
parent 7d609695cf
commit 0305ac67d8
1 changed files with 7 additions and 0 deletions

View File

@ -14,6 +14,10 @@
* limitations under the License.
*/
#include <errno.h>
#include <string.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <time.h>
#include <chrono>
#include <sstream>
@ -231,6 +235,9 @@ void Run(const std::vector<string>& 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()) {