src/utility/MemoryConsumption.cpp
raw| 1 | #include <pbcopper/utility/MemoryConsumption.h> |
| 2 | |
| 3 | #include <sys/resource.h> |
| 4 | |
| 5 | namespace PacBio { |
| 6 | namespace Utility { |
| 7 | |
| 8 | int64_t MemoryConsumption::PeakRss() |
| 9 | { |
| 10 | struct rusage r; |
| 11 | getrusage(RUSAGE_SELF, &r); |
| 12 | #ifdef __linux__ |
| 13 | return r.ru_maxrss * 1024; |
| 14 | #else |
| 15 | return r.ru_maxrss; |
| 16 | #endif |
| 17 | } |
| 18 | |
| 19 | } // namespace Utility |
| 20 | } // namespace PacBio |