Skip to content

Commit

Permalink
Merge pull request #752 from taosdata/revert-751-feat/TD-30267
Browse files Browse the repository at this point in the history
Revert "Feat/td 30267" taosGetTotalMemory not found
  • Loading branch information
DuanKuanJun committed Jun 11, 2024
2 parents c2b8f6d + 47ff803 commit 8bd1646
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
1 change: 0 additions & 1 deletion inc/toolsdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ int32_t toolsCloseDir(TdDirPtr *ppDir);

int64_t atomic_add_fetch_64(int64_t volatile* ptr, int64_t val);
int32_t toolsGetNumberOfCores();
int32_t toolsGetPhysicalMemory();

int64_t toolsGetTimestamp(int32_t precision);
void toolsMsleep(int32_t mseconds);
Expand Down
30 changes: 1 addition & 29 deletions src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,34 +493,6 @@ int32_t getVgroupsOfDb(SBenchConn *conn, SDataBase *database) {
}
#endif // TD_VER_COMPATIBLE_3_0_0_0

// export from taos osSysinfo.c
int32_t taosGetTotalMemory(int64_t *totalKB);

int32_t toolsGetDefaultVGroups() {
int32_t cores = toolsGetNumberOfCores();
if (cores < 3 ) {
return 1;
}

int64_t MemKB = 0;
taosGetTotalMemory(&MemKB);

infoPrint("check local machine CPU: %d Memory:%d MB \n", cores, (int32_t)(MemKB/1024));
if (MemKB <= 2*1024*1024) { // 2G
return 1;
} else if (MemKB <= 4*1024*1024) { // 4G
return 2;
} else if (MemKB <= 8*1024*1024) { // 8G
return 3;
} else if (MemKB <= 16*1024*1024) { // 16G
return 4;
} else if (MemKB <= 32*1024*1024) { // 32G
return 5;
} else {
return cores / 2;
}
}

int geneDbCreateCmd(SDataBase *database, char *command, int remainVnodes) {
int dataLen = 0;
int n;
Expand All @@ -533,7 +505,7 @@ int geneDbCreateCmd(SDataBase *database, char *command, int remainVnodes) {
database->dbName,
(-1 != g_arguments->inputted_vgroups)?
g_arguments->inputted_vgroups:
min(remainVnodes, toolsGetDefaultVGroups()));
min(remainVnodes, toolsGetNumberOfCores()));
} else {
n = snprintf(command + dataLen, SHORT_1K_SQL_BUFF_LEN - dataLen,
g_arguments->escape_character
Expand Down

0 comments on commit 8bd1646

Please sign in to comment.