fix: net_in/net_out
This commit is contained in:
parent
060f6d9dc0
commit
6f5689b0d6
|
@ -798,13 +798,12 @@ void taosGetProcIODelta(int64_t *rchars, int64_t *wchars, int64_t *read_bytes, i
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosGetCardInfo(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
int32_t taosGetCardInfo(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
||||||
#ifdef WINDOWS
|
|
||||||
*receive_bytes = 0;
|
*receive_bytes = 0;
|
||||||
*transmit_bytes = 0;
|
*transmit_bytes = 0;
|
||||||
|
|
||||||
|
#ifdef WINDOWS
|
||||||
return 0;
|
return 0;
|
||||||
#elif defined(_TD_DARWIN_64)
|
#elif defined(_TD_DARWIN_64)
|
||||||
*receive_bytes = 0;
|
|
||||||
*transmit_bytes = 0;
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
TdFilePtr pFile = taosOpenFile(tsSysNetFile, TD_FILE_READ | TD_FILE_STREAM);
|
TdFilePtr pFile = taosOpenFile(tsSysNetFile, TD_FILE_READ | TD_FILE_STREAM);
|
||||||
|
@ -841,8 +840,8 @@ int32_t taosGetCardInfo(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
||||||
"%s %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64
|
"%s %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64
|
||||||
" %" PRId64,
|
" %" PRId64,
|
||||||
nouse0, &o_rbytes, &rpackts, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets);
|
nouse0, &o_rbytes, &rpackts, &nouse1, &nouse2, &nouse3, &nouse4, &nouse5, &nouse6, &o_tbytes, &tpackets);
|
||||||
*receive_bytes = o_rbytes;
|
*receive_bytes += o_rbytes;
|
||||||
*transmit_bytes = o_tbytes;
|
*transmit_bytes += o_tbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosCloseFile(&pFile);
|
taosCloseFile(&pFile);
|
||||||
|
@ -854,8 +853,8 @@ int32_t taosGetCardInfo(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
||||||
void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
void taosGetCardInfoDelta(int64_t *receive_bytes, int64_t *transmit_bytes) {
|
||||||
static int64_t last_receive_bytes = 0;
|
static int64_t last_receive_bytes = 0;
|
||||||
static int64_t last_transmit_bytes = 0;
|
static int64_t last_transmit_bytes = 0;
|
||||||
static int64_t cur_receive_bytes = 0;
|
int64_t cur_receive_bytes = 0;
|
||||||
static int64_t cur_transmit_bytes = 0;
|
int64_t cur_transmit_bytes = 0;
|
||||||
if (taosGetCardInfo(&cur_receive_bytes, &cur_transmit_bytes) == 0) {
|
if (taosGetCardInfo(&cur_receive_bytes, &cur_transmit_bytes) == 0) {
|
||||||
*receive_bytes = cur_receive_bytes - last_receive_bytes;
|
*receive_bytes = cur_receive_bytes - last_receive_bytes;
|
||||||
*transmit_bytes = cur_transmit_bytes - last_transmit_bytes;
|
*transmit_bytes = cur_transmit_bytes - last_transmit_bytes;
|
||||||
|
|
Loading…
Reference in New Issue