MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / getProcMemory

Function getProcMemory

tensorflow/core/framework/ev_allocator_test.cc:23–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21};
22
23ProcMemory getProcMemory() {
24 ProcMemory m;
25 FILE* fp = fopen("/proc/self/statm", "r");
26 if (fp == NULL) {
27 LOG(ERROR) << "Fail to open /proc/self/statm.";
28 return m;
29 }
30
31 if (fscanf(fp, "%ld %ld %ld %ld %ld %ld %ld",
32 &m.size, &m.resident, &m.share,
33 &m.trs, &m.lrs, &m.drs, &m.dt) != 7) {
34 fclose(fp);
35 LOG(ERROR) << "Fail to fscanf /proc/self/statm.";
36 return m;
37 }
38 fclose(fp);
39
40 return m;
41}
42
43double getSize() {
44 ProcMemory m = getProcMemory();

Callers 2

getSizeFunction · 0.70
getResidentFunction · 0.70

Calls 1

fopenFunction · 0.50

Tested by

no test coverage detected