提交 0f86e16d 编写于 作者: S Shengliang Guan

os

上级 612dd719
......@@ -191,6 +191,10 @@ extern "C" {
#define TD_DIRSEP "/"
#endif
#define TD_LOCALE_LEN 64
#define TD_CHARSET_LEN 64
#define TD_TIMEZONE_LEN 96
#ifdef __cplusplus
}
#endif
......
......@@ -22,17 +22,13 @@ extern "C" {
#include "os.h"
#define TD_LOCALE_LEN 64
#define TD_CHARSET_LEN 64
#define TD_TIMEZONE_LEN 96
typedef struct {
int64_t total;
int64_t used;
int64_t avail;
} SDiskSize;
typedef struct SDiskSpace {
typedef struct {
int64_t reserved;
SDiskSize size;
} SDiskSpace;
......@@ -48,7 +44,6 @@ void taosGetDisk();
bool taosGetCpuUsage(float *sysCpuUsage, float *procCpuUsage);
bool taosGetProcMemory(float *memoryUsedMB);
bool taosGetSysMemory(float *memoryUsedMB);
void taosPrintOsInfo();
int taosSystem(const char *cmd);
void taosKillSystem();
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);
cfgAddBool(pCfg, "keepColumnName", tsKeepOriginalColumnName, 1);
cfgAddInt32(pCfg, "maxBinaryDisplayWidth", tsMaxBinaryDisplayWidth, 1, 65536, 1);
}
static void taosAddSystemInfo(SConfig *pCfg) {
SysNameInfo info = taosGetSysNameInfo();
cfgAddTimezone(pCfg, "timezone", tsTimezone);
cfgAddLocale(pCfg, "locale", tsLocale);
cfgAddCharset(pCfg, "charset", tsCharset);
cfgAddBool(pCfg, "enableCoreFile", 0, 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, "compatible_version", compatible_version, 1);
......@@ -348,7 +363,9 @@ static void taosSetClientCfg(SConfig *pCfg) {
tsMaxNumOfOrderedResults = cfgGetItem(pCfg, "maxNumOfOrderedRes")->i32;
tsKeepOriginalColumnName = cfgGetItem(pCfg, "keepColumnName")->bval;
tsMaxBinaryDisplayWidth = cfgGetItem(pCfg, "maxBinaryDisplayWidth")->i32;
}
static void taosSetSystemCfg(SConfig *pCfg) {
SConfigItem *pItem = cfgGetItem(pCfg, "timezone");
osSetTimezone(pItem->str);
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);
taosAddServerCfg(tsCfg);
}
taosAddSystemInfo(tsCfg);
if (taosLoadCfg(tsCfg, cfgDir, envFile, apolloUrl) != 0) {
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);
taosSetServerCfg(tsCfg);
}
taosSetSystemCfg(tsCfg);
cfgDumpCfg(tsCfg, tsc, false);
return 0;
......
......@@ -746,21 +746,6 @@ cmp_end:
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) {
if (!(flag & DEBUG_TRACE || flag & DEBUG_DEBUG || flag & DEBUG_DUMP)) return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册