This commit is contained in:
parent
c890b0b5c1
commit
3fbb78a951
|
@ -43,8 +43,8 @@ int32_t taosGetTotalMemory(int64_t *totalKB);
|
||||||
int32_t taosGetProcMemory(int64_t *usedKB);
|
int32_t taosGetProcMemory(int64_t *usedKB);
|
||||||
int32_t taosGetSysMemory(int64_t *usedKB);
|
int32_t taosGetSysMemory(int64_t *usedKB);
|
||||||
int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize);
|
int32_t taosGetDiskSize(char *dataDir, SDiskSize *diskSize);
|
||||||
bool taosReadProcIO(int64_t *rchars, int64_t *wchars);
|
int32_t taosReadProcIO(int64_t *rchars, int64_t *wchars);
|
||||||
bool taosGetProcIO(float *readKB, float *writeKB);
|
int32_t taosGetProcIO(float *readKB, float *writeKB);
|
||||||
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes);
|
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes);
|
||||||
bool taosGetBandSpeed(float *bandSpeedKb);
|
bool taosGetBandSpeed(float *bandSpeedKb);
|
||||||
|
|
||||||
|
|
|
@ -491,10 +491,9 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
|
||||||
pInfo->disk_total = 4.3;
|
pInfo->disk_total = 4.3;
|
||||||
pInfo->net_in = 5.1;
|
pInfo->net_in = 5.1;
|
||||||
pInfo->net_out = 5.2;
|
pInfo->net_out = 5.2;
|
||||||
pInfo->io_read = 6.1;
|
taosGetProcIO(&pInfo->io_read, &pInfo->io_write);
|
||||||
pInfo->io_write = 6.2;
|
pInfo->io_read_disk = 0;
|
||||||
pInfo->io_read_disk = 7.1;
|
pInfo->io_write_disk = 0;
|
||||||
pInfo->io_write_disk = 7.2;
|
|
||||||
pInfo->req_select = 8;
|
pInfo->req_select = 8;
|
||||||
pInfo->req_select_rate = 8.1;
|
pInfo->req_select_rate = 8.1;
|
||||||
pInfo->req_insert = 9;
|
pInfo->req_insert = 9;
|
||||||
|
|
|
@ -124,31 +124,31 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosReadProcIO(int64_t *readbyte, int64_t *writebyte) {
|
int32_t taosReadProcIO(int64_t *readbyte, int64_t *writebyte) {
|
||||||
IO_COUNTERS io_counter;
|
IO_COUNTERS io_counter;
|
||||||
if (GetProcessIoCounters(GetCurrentProcess(), &io_counter)) {
|
if (GetProcessIoCounters(GetCurrentProcess(), &io_counter)) {
|
||||||
if (readbyte) *readbyte = io_counter.ReadTransferCount;
|
if (readbyte) *readbyte = io_counter.ReadTransferCount;
|
||||||
if (writebyte) *writebyte = io_counter.WriteTransferCount;
|
if (writebyte) *writebyte = io_counter.WriteTransferCount;
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosGetProcIO(float *readKB, float *writeKB) {
|
int32_t taosGetProcIO(float *readKB, float *writeKB) {
|
||||||
static int64_t lastReadbyte = -1;
|
static int64_t lastReadbyte = -1;
|
||||||
static int64_t lastWritebyte = -1;
|
static int64_t lastWritebyte = -1;
|
||||||
|
|
||||||
int64_t curReadbyte = 0;
|
int64_t curReadbyte = 0;
|
||||||
int64_t curWritebyte = 0;
|
int64_t curWritebyte = 0;
|
||||||
|
|
||||||
if (!taosReadProcIO(&curReadbyte, &curWritebyte)) {
|
if (taosReadProcIO(&curReadbyte, &curWritebyte) != 0) {
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastReadbyte == -1 || lastWritebyte == -1) {
|
if (lastReadbyte == -1 || lastWritebyte == -1) {
|
||||||
lastReadbyte = curReadbyte;
|
lastReadbyte = curReadbyte;
|
||||||
lastWritebyte = curWritebyte;
|
lastWritebyte = curWritebyte;
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024);
|
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024);
|
||||||
|
@ -159,7 +159,7 @@ bool taosGetProcIO(float *readKB, float *writeKB) {
|
||||||
lastReadbyte = curReadbyte;
|
lastReadbyte = curReadbyte;
|
||||||
lastWritebyte = curWritebyte;
|
lastWritebyte = curWritebyte;
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosGetSystemInfo() {
|
void taosGetSystemInfo() {
|
||||||
|
@ -259,16 +259,16 @@ void taosGetSystemInfo() {
|
||||||
tsNumOfCores = sysconf(_SC_NPROCESSORS_ONLN);
|
tsNumOfCores = sysconf(_SC_NPROCESSORS_ONLN);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
|
int32_t taosReadProcIO(int64_t *rchars, int64_t *wchars) {
|
||||||
if (rchars) *rchars = 0;
|
if (rchars) *rchars = 0;
|
||||||
if (wchars) *wchars = 0;
|
if (wchars) *wchars = 0;
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosGetProcIO(float *readKB, float *writeKB) {
|
int32_t taosGetProcIO(float *readKB, float *writeKB) {
|
||||||
*readKB = 0;
|
*readKB = 0;
|
||||||
*writeKB = 0;
|
*writeKB = 0;
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
|
bool taosGetCardInfo(int64_t *bytes, int64_t *rbytes, int64_t *tbytes) {
|
||||||
|
@ -631,12 +631,12 @@ bool taosGetBandSpeed(float *bandSpeedKb) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
|
int32_t taosReadProcIO(int64_t *rchars, int64_t *wchars) {
|
||||||
// FILE *fp = fopen(tsProcIOFile, "r");
|
// FILE *fp = fopen(tsProcIOFile, "r");
|
||||||
TdFilePtr pFile = taosOpenFile(tsProcIOFile, TD_FILE_READ | TD_FILE_STREAM);
|
TdFilePtr pFile = taosOpenFile(tsProcIOFile, TD_FILE_READ | TD_FILE_STREAM);
|
||||||
if (pFile == NULL) {
|
if (pFile == NULL) {
|
||||||
// printf("open file:%s failed", tsProcIOFile);
|
// printf("open file:%s failed", tsProcIOFile);
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t _bytes = 0;
|
ssize_t _bytes = 0;
|
||||||
|
@ -666,27 +666,27 @@ bool taosReadProcIO(int64_t *rchars, int64_t *wchars) {
|
||||||
|
|
||||||
if (readIndex < 2) {
|
if (readIndex < 2) {
|
||||||
// printf("read file:%s failed", tsProcIOFile);
|
// printf("read file:%s failed", tsProcIOFile);
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool taosGetProcIO(float *readKB, float *writeKB) {
|
int32_t taosGetProcIO(float *readKB, float *writeKB) {
|
||||||
static int64_t lastReadbyte = -1;
|
static int64_t lastReadbyte = -1;
|
||||||
static int64_t lastWritebyte = -1;
|
static int64_t lastWritebyte = -1;
|
||||||
|
|
||||||
int64_t curReadbyte = 0;
|
int64_t curReadbyte = 0;
|
||||||
int64_t curWritebyte = 0;
|
int64_t curWritebyte = 0;
|
||||||
|
|
||||||
if (!taosReadProcIO(&curReadbyte, &curWritebyte)) {
|
if (taosReadProcIO(&curReadbyte, &curWritebyte) != 0) {
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastReadbyte == -1 || lastWritebyte == -1) {
|
if (lastReadbyte == -1 || lastWritebyte == -1) {
|
||||||
lastReadbyte = curReadbyte;
|
lastReadbyte = curReadbyte;
|
||||||
lastWritebyte = curWritebyte;
|
lastWritebyte = curWritebyte;
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024);
|
*readKB = (float)((double)(curReadbyte - lastReadbyte) / 1024);
|
||||||
|
@ -697,7 +697,7 @@ bool taosGetProcIO(float *readKB, float *writeKB) {
|
||||||
lastReadbyte = curReadbyte;
|
lastReadbyte = curReadbyte;
|
||||||
lastWritebyte = curWritebyte;
|
lastWritebyte = curWritebyte;
|
||||||
|
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosGetSystemInfo() {
|
void taosGetSystemInfo() {
|
||||||
|
|
Loading…
Reference in New Issue