MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / update

Function update

src/OSspecific/POSIX/memInfo/memInfo.C:48–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
47
48const 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
82bool Foam::memInfo::valid() const

Callers 3

memInfo.CFile · 0.70
updateCellMethod · 0.50
updateFaceMethod · 0.50

Calls 3

pidFunction · 0.85
nameFunction · 0.50
goodMethod · 0.45

Tested by

no test coverage detected