1#ifndef OSMIUM_UTIL_MEMORY_HPP
2#define OSMIUM_UTIL_MEMORY_HPP
51 const auto f = line.find_first_of(
"0123456789");
52 const auto l = line.find_last_of(
"0123456789");
53 return osmium::detail::str_to_int<int64_t>(line.substr(f, l - f + 1).c_str());
68 static const char* filename =
"/proc/self/status";
69 std::ifstream status_file(filename);
71 if (status_file.is_open()) {
73 while (!status_file.eof()) {
74 std::getline(status_file, line);
75 if (line.substr(0, 6) ==
"VmPeak") {
78 if (line.substr(0, 6) ==
"VmSize") {
88 return static_cast<int>(
m_current / 1024);
93 return static_cast<int>(
m_peak / 1024);
Definition: memory.hpp:44
MemoryUsage()
Definition: memory.hpp:66
int64_t m_peak
Definition: memory.hpp:47
int64_t m_current
Definition: memory.hpp:46
int peak() const
Return peak memory usage in MBytes.
Definition: memory.hpp:92
static int64_t parse_number(const std::string &line)
Definition: memory.hpp:50
int current() const
Return current memory usage in MBytes.
Definition: memory.hpp:87
Namespace for everything in the Osmium library.
Definition: assembler.hpp:53