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

Function getProcMemory

tensorflow/core/kernels/embedding_variable_test.h:76–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74};
75
76ProcMemory getProcMemory() {
77 ProcMemory m;
78 FILE* fp = fopen("/proc/self/statm", "r");
79 if (fp == NULL) {
80 LOG(ERROR) << "Fail to open /proc/self/statm.";
81 return m;
82 }
83
84 if (fscanf(fp, "%ld %ld %ld %ld %ld %ld %ld",
85 &m.size, &m.resident, &m.share,
86 &m.trs, &m.lrs, &m.drs, &m.dt) != 7) {
87 fclose(fp);
88 LOG(ERROR) << "Fail to fscanf /proc/self/statm.";
89 return m;
90 }
91 fclose(fp);
92
93 return m;
94}
95
96double getSize() {
97 ProcMemory m = getProcMemory();

Callers 2

getSizeFunction · 0.70
getResidentFunction · 0.70

Calls 1

fopenFunction · 0.50

Tested by

no test coverage detected