MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Stat

Method Stat

phxqueue/comm/utils/memory_util.cpp:28–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27
28bool MemStat::Stat(pid_t pid) {
29 char fileName[256];
30 if (pid == 0) {
31 strcpy(fileName, "/proc/self/statm");
32 } else {
33 snprintf(fileName, sizeof(fileName), "/proc/%d/statm", pid);
34 }
35
36 FILE *file = fopen(fileName, "r");
37 if (file) {
38 if (0 == fscanf(file, "%lu %lu %lu %lu %lu %lu %lu", &size, &resident, &share, &text, &lib, &data, &dt)) {
39 ;
40 }
41 fclose(file);
42 return true;
43 }
44 return false;
45}
46
47
48} // namespace utils

Callers 1

CheckMemMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected