This commit is contained in:
parent
612dd71918
commit
0f86e16dcd
|
@ -191,6 +191,10 @@ extern "C" {
|
||||||
#define TD_DIRSEP "/"
|
#define TD_DIRSEP "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define TD_LOCALE_LEN 64
|
||||||
|
#define TD_CHARSET_LEN 64
|
||||||
|
#define TD_TIMEZONE_LEN 96
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -22,17 +22,13 @@ extern "C" {
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
#define TD_LOCALE_LEN 64
|
|
||||||
#define TD_CHARSET_LEN 64
|
|
||||||
#define TD_TIMEZONE_LEN 96
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t total;
|
int64_t total;
|
||||||
int64_t used;
|
int64_t used;
|
||||||
int64_t avail;
|
int64_t avail;
|
||||||
} SDiskSize;
|
} SDiskSize;
|
||||||
|
|
||||||
typedef struct SDiskSpace {
|
typedef struct {
|
||||||
int64_t reserved;
|
int64_t reserved;
|
||||||
SDiskSize size;
|
SDiskSize size;
|
||||||
} SDiskSpace;
|
} SDiskSpace;
|
||||||
|
@ -48,7 +44,6 @@ void taosGetDisk();
|
||||||
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage);
|
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage);
|
||||||
bool taosGetProcMemory(float *memoryUsedMB);
|
bool taosGetProcMemory(float *memoryUsedMB);
|
||||||
bool taosGetSysMemory(float *memoryUsedMB);
|
bool taosGetSysMemory(float *memoryUsedMB);
|
||||||
void taosPrintOsInfo();
|
|
||||||
int taosSystem(const char *cmd);
|
int taosSystem(const char *cmd);
|
||||||
void taosKillSystem();
|
void taosKillSystem();
|
||||||
int32_t taosGetSystemUUID(char *uid, int32_t uidlen);
|
int32_t taosGetSystemUUID(char *uid, int32_t uidlen);
|
||||||
|
|
|
@ -263,11 +263,26 @@ static void taosAddClientCfg(SConfig *pCfg) {
|
||||||
cfgAddInt32(pCfg, "maxNumOfOrderedRes", tsMaxNumOfOrderedResults, 128, TSDB_MAX_ALLOWED_SQL_LEN, 1);
|
cfgAddInt32(pCfg, "maxNumOfOrderedRes", tsMaxNumOfOrderedResults, 128, TSDB_MAX_ALLOWED_SQL_LEN, 1);
|
||||||
cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1);
|
cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1);
|
||||||
cfgAddInt32(pCfg, "maxBinaryDisplayWidth", tsMaxBinaryDisplayWidth, 1, 65536, 1);
|
cfgAddInt32(pCfg, "maxBinaryDisplayWidth", tsMaxBinaryDisplayWidth, 1, 65536, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void taosAddSystemInfo(SConfig *pCfg) {
|
||||||
|
SysNameInfo info = taosGetSysNameInfo();
|
||||||
|
|
||||||
cfgAddTimezone(pCfg, "timezone", tsTimezone);
|
cfgAddTimezone(pCfg, "timezone", tsTimezone);
|
||||||
cfgAddLocale(pCfg, "locale", tsLocale);
|
cfgAddLocale(pCfg, "locale", tsLocale);
|
||||||
cfgAddCharset(pCfg, "charset", tsCharset);
|
cfgAddCharset(pCfg, "charset", tsCharset);
|
||||||
cfgAddBool(pCfg, "enableCoreFile", 0, 1);
|
cfgAddBool(pCfg, "enableCoreFile", 0, 1);
|
||||||
cfgAddInt32(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1);
|
cfgAddInt32(pCfg, "numOfCores", tsNumOfCores, 1, 100000, 1);
|
||||||
|
cfgAddInt32(pCfg, "pageSize(KB)", tsPageSize, 0, INT64_MAX, 1);
|
||||||
|
cfgAddInt64(pCfg, "openMax", tsOpenMax, 0, INT64_MAX, 1);
|
||||||
|
cfgAddInt64(pCfg, "streamMax", tsStreamMax, 0, INT64_MAX, 1);
|
||||||
|
cfgAddInt32(pCfg, "totalMemory(MB)", tsTotalMemoryMB, 0, INT32_MAX, 1);
|
||||||
|
cfgAddString(pCfg, "os sysname", info.sysname, 1);
|
||||||
|
cfgAddString(pCfg, "os nodename", info.nodename, 1);
|
||||||
|
cfgAddString(pCfg, "os release", info.release, 1);
|
||||||
|
cfgAddString(pCfg, "os version", info.version, 1);
|
||||||
|
cfgAddString(pCfg, "os machine", info.machine, 1);
|
||||||
|
cfgAddString(pCfg, "os sysname", info.sysname, 1);
|
||||||
|
|
||||||
cfgAddString(pCfg, "version", version, 1);
|
cfgAddString(pCfg, "version", version, 1);
|
||||||
cfgAddString(pCfg, "compatible_version", compatible_version, 1);
|
cfgAddString(pCfg, "compatible_version", compatible_version, 1);
|
||||||
|
@ -348,7 +363,9 @@ static void taosSetClientCfg(SConfig *pCfg) {
|
||||||
tsMaxNumOfOrderedResults = cfgGetItem(pCfg, "maxNumOfOrderedRes")->i32;
|
tsMaxNumOfOrderedResults = cfgGetItem(pCfg, "maxNumOfOrderedRes")->i32;
|
||||||
tsKeepOriginalColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
|
tsKeepOriginalColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
|
||||||
tsMaxBinaryDisplayWidth = cfgGetItem(pCfg, "maxBinaryDisplayWidth")->i32;
|
tsMaxBinaryDisplayWidth = cfgGetItem(pCfg, "maxBinaryDisplayWidth")->i32;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void taosSetSystemCfg(SConfig *pCfg) {
|
||||||
SConfigItem *pItem = cfgGetItem(pCfg, "timezone");
|
SConfigItem *pItem = cfgGetItem(pCfg, "timezone");
|
||||||
osSetTimezone(pItem->str);
|
osSetTimezone(pItem->str);
|
||||||
uDebug("timezone format changed from %s to %s", pItem->str, tsTimezone);
|
uDebug("timezone format changed from %s to %s", pItem->str, tsTimezone);
|
||||||
|
@ -448,6 +465,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
|
||||||
taosAddClientCfg(tsCfg);
|
taosAddClientCfg(tsCfg);
|
||||||
taosAddServerCfg(tsCfg);
|
taosAddServerCfg(tsCfg);
|
||||||
}
|
}
|
||||||
|
taosAddSystemInfo(tsCfg);
|
||||||
|
|
||||||
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
|
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
|
||||||
uError("failed to load cfg since %s", terrstr());
|
uError("failed to load cfg since %s", terrstr());
|
||||||
|
@ -462,6 +480,7 @@ int32_t taosInitCfg(const char *cfgDir, const char *envFile, const char *apolloU
|
||||||
taosSetClientCfg(tsCfg);
|
taosSetClientCfg(tsCfg);
|
||||||
taosSetServerCfg(tsCfg);
|
taosSetServerCfg(tsCfg);
|
||||||
}
|
}
|
||||||
|
taosSetSystemCfg(tsCfg);
|
||||||
|
|
||||||
cfgDumpCfg(tsCfg, tsc, false);
|
cfgDumpCfg(tsCfg, tsc, false);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -746,21 +746,6 @@ cmp_end:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosPrintOsInfo() {
|
|
||||||
SysNameInfo info = taosGetSysNameInfo();
|
|
||||||
|
|
||||||
uInfo(" os pageSize: %" PRId64 "(KB)", tsPageSize);
|
|
||||||
uInfo(" os openMax: %" PRId64, tsOpenMax);
|
|
||||||
uInfo(" os streamMax: %" PRId64, tsStreamMax);
|
|
||||||
uInfo(" os numOfCores: %d", tsNumOfCores);
|
|
||||||
uInfo(" os totalMemory: %d(MB)", tsTotalMemoryMB);
|
|
||||||
uInfo(" os sysname: %s", info.sysname);
|
|
||||||
uInfo(" os nodename: %s", info.nodename);
|
|
||||||
uInfo(" os release: %s", info.release);
|
|
||||||
uInfo(" os version: %s", info.version);
|
|
||||||
uInfo(" os machine: %s", info.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
void taosSetAllDebugFlag(int32_t flag) {
|
void taosSetAllDebugFlag(int32_t flag) {
|
||||||
if (!(flag & DEBUG_TRACE || flag & DEBUG_DEBUG || flag & DEBUG_DUMP)) return;
|
if (!(flag & DEBUG_TRACE || flag & DEBUG_DEBUG || flag & DEBUG_DUMP)) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue