| 46 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
| 47 | |
| 48 | const Foam::memInfo& Foam::memInfo::update() |
| 49 | { |
| 50 | // reset to invalid values first |
| 51 | peak_ = size_ = rss_ = -1; |
| 52 | IFstream is("/proc/" + name(pid()) + "/status"); |
| 53 | |
| 54 | while (is.good()) |
| 55 | { |
| 56 | string line; |
| 57 | is.getLine(line); |
| 58 | char tag[32]; |
| 59 | int value; |
| 60 | |
| 61 | if (sscanf(line.c_str(), "%30s %d", tag, &value) == 2) |
| 62 | { |
| 63 | if (!strcmp(tag, "VmPeak:")) |
| 64 | { |
| 65 | peak_ = value; |
| 66 | } |
| 67 | else if (!strcmp(tag, "VmSize:")) |
| 68 | { |
| 69 | size_ = value; |
| 70 | } |
| 71 | else if (!strcmp(tag, "VmRSS:")) |
| 72 | { |
| 73 | rss_ = value; |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | return *this; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | bool Foam::memInfo::valid() const |
no test coverage detected