chore: code optimize
This commit is contained in:
parent
3cfa49066a
commit
d597ba8e71
|
@ -18,8 +18,7 @@
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
// #include <linux/unistd.h> /* for _syscallX macros/related stuff */
|
|
||||||
// #include <linux/kernel.h> /* for struct sysinfo */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -26,7 +26,6 @@ static void *dmStatusThreadFp(void *param) {
|
||||||
int32_t trimCount = 0;
|
int32_t trimCount = 0;
|
||||||
int32_t upTimeCount = 0;
|
int32_t upTimeCount = 0;
|
||||||
int64_t upTime = 0;
|
int64_t upTime = 0;
|
||||||
int64_t thrdTime = 0;
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
taosMsleep(200);
|
taosMsleep(200);
|
||||||
|
@ -44,17 +43,11 @@ static void *dmStatusThreadFp(void *param) {
|
||||||
taosMemoryTrim(0);
|
taosMemoryTrim(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((upTimeCount = (++upTimeCount & 7)) == 0) {
|
if ((upTimeCount = (++upTimeCount & 63)) == 0) {
|
||||||
upTime = (taosGetOsUptime() - tsDndStartOsUptime) * 1000;
|
upTime = (taosGetOsUptime() - tsDndStartOsUptime) * 1000;
|
||||||
|
tsDndUpTime = TMAX(tsDndUpTime, upTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
thrdTime += 200;
|
|
||||||
cost = taosGetTimestampMs() - curTime;
|
|
||||||
if (cost > 0) thrdTime += cost;
|
|
||||||
tsDndUpTime = upTime > thrdTime ? upTime : thrdTime;
|
|
||||||
printf("upTime:%" PRIi64 " thrdTime:%" PRIi64 " tsDndUpTime:%" PRIi64 " delta:%" PRIi64 "\n", upTime, thrdTime,
|
|
||||||
tsDndUpTime, upTime - thrdTime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -963,16 +963,14 @@ char *taosGetCmdlineByPID(int pid) {
|
||||||
|
|
||||||
int64_t taosGetOsUptime() {
|
int64_t taosGetOsUptime() {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return 0;
|
#elif defined(_TD_DARWIN_64)
|
||||||
// #else
|
|
||||||
// #elif defined(_TD_DARWIN_64)
|
|
||||||
// return 0;
|
|
||||||
#else
|
#else
|
||||||
struct sysinfo info;
|
struct sysinfo info;
|
||||||
if (0 == sysinfo(&info)) {
|
if (0 == sysinfo(&info)) {
|
||||||
return info.uptime;
|
return info.uptime;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosSetCoreDump(bool enable) {
|
void taosSetCoreDump(bool enable) {
|
||||||
|
|
Loading…
Reference in New Issue