feat: get cpu cores from quota
This commit is contained in:
parent
66f0a69752
commit
f09429f089
|
@ -121,11 +121,11 @@ LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS exception);
|
||||||
static pid_t tsProcId;
|
static pid_t tsProcId;
|
||||||
static char tsSysNetFile[] = "/proc/net/dev";
|
static char tsSysNetFile[] = "/proc/net/dev";
|
||||||
static char tsSysCpuFile[] = "/proc/stat";
|
static char tsSysCpuFile[] = "/proc/stat";
|
||||||
|
static char tsCpuPeroidFile[] = "/sys/fs/cgroup/cpu/cpu.cfs_period_us";
|
||||||
|
static char tsCpuQuotaFile[] = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us";
|
||||||
static char tsProcCpuFile[25] = {0};
|
static char tsProcCpuFile[25] = {0};
|
||||||
static char tsProcMemFile[25] = {0};
|
static char tsProcMemFile[25] = {0};
|
||||||
static char tsProcIOFile[25] = {0};
|
static char tsProcIOFile[25] = {0};
|
||||||
static char tsCpuCfsPeroid[] = "/sys/fs/cgroup/cpu/cpu.cfs_period_us";
|
|
||||||
static char tsCpuCfsQuota[] = "/sys/fs/cgroup/cpu/cpu.cfs_quota_us";
|
|
||||||
|
|
||||||
static void taosGetProcIOnfos() {
|
static void taosGetProcIOnfos() {
|
||||||
tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024;
|
tsPageSizeKB = sysconf(_SC_PAGESIZE) / 1024;
|
||||||
|
@ -502,7 +502,7 @@ static int32_t taosCntrGetCpuCores(float *numOfCores) {
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
TdFilePtr pFile = NULL;
|
TdFilePtr pFile = NULL;
|
||||||
if (!(pFile = taosOpenFile(tsCpuCfsQuota, TD_FILE_READ | TD_FILE_STREAM))) {
|
if (!(pFile = taosOpenFile(tsCpuQuotaFile, TD_FILE_READ | TD_FILE_STREAM))) {
|
||||||
goto _sys;
|
goto _sys;
|
||||||
}
|
}
|
||||||
char qline[32] = {0};
|
char qline[32] = {0};
|
||||||
|
@ -516,7 +516,7 @@ static int32_t taosCntrGetCpuCores(float *numOfCores) {
|
||||||
goto _sys;
|
goto _sys;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pFile = taosOpenFile(tsCpuCfsPeroid, TD_FILE_READ | TD_FILE_STREAM))) {
|
if (!(pFile = taosOpenFile(tsCpuPeroidFile, TD_FILE_READ | TD_FILE_STREAM))) {
|
||||||
goto _sys;
|
goto _sys;
|
||||||
}
|
}
|
||||||
char pline[32] = {0};
|
char pline[32] = {0};
|
||||||
|
|
Loading…
Reference in New Issue