MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / checkCpuCount

Function checkCpuCount

libapp2sys/src/main/cpp/procutil.h:48–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46*/
47
48static int checkCpuCount() {
49 for (int i = 0; i < 128; i++) {
50 char buf[64];
51 memset(buf, 0, 64);
52 snprintf(buf, 63, "/sys/devices/system/cpu/cpu%d", i);
53
54 DIR *d = opendir(buf);
55 if (d) {
56 closedir(d);
57 } else {
58 return i;
59 }
60 }
61 return 0;
62}
63
64const static int CPU_COUNT = checkCpuCount();
65const static uint32_t STAT_USER_JIFFIES_INDEX = 13;

Callers 1

procutil.hFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected