Merge pull request #7302 from taosdata/hotfix/sangshuduo/TD-5875-taosdemo-ue-improve-for-master
[TD-5875]<featur>: taosdemo show progress
This commit is contained in:
commit
f48273a067
|
@ -246,7 +246,6 @@ typedef struct SArguments_S {
|
||||||
uint32_t disorderRatio; // 0: no disorder, >0: x%
|
uint32_t disorderRatio; // 0: no disorder, >0: x%
|
||||||
int disorderRange; // ms, us or ns. accordig to database precision
|
int disorderRange; // ms, us or ns. accordig to database precision
|
||||||
uint32_t method_of_delete;
|
uint32_t method_of_delete;
|
||||||
char ** arg_list;
|
|
||||||
uint64_t totalInsertRows;
|
uint64_t totalInsertRows;
|
||||||
uint64_t totalAffectedRows;
|
uint64_t totalAffectedRows;
|
||||||
bool demo_mode; // use default column name and semi-random data
|
bool demo_mode; // use default column name and semi-random data
|
||||||
|
@ -638,7 +637,6 @@ SArguments g_args = {
|
||||||
0, // disorderRatio
|
0, // disorderRatio
|
||||||
1000, // disorderRange
|
1000, // disorderRange
|
||||||
1, // method_of_delete
|
1, // method_of_delete
|
||||||
NULL, // arg_list
|
|
||||||
0, // totalInsertRows;
|
0, // totalInsertRows;
|
||||||
0, // totalAffectedRows;
|
0, // totalAffectedRows;
|
||||||
true, // demo_mode;
|
true, // demo_mode;
|
||||||
|
@ -6402,6 +6400,9 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
bool flagSleep = true;
|
bool flagSleep = true;
|
||||||
uint64_t sleepTimeTotal = 0;
|
uint64_t sleepTimeTotal = 0;
|
||||||
|
|
||||||
|
int percentComplete = 0;
|
||||||
|
int64_t totalRows = insertRows * pThreadInfo->ntables;
|
||||||
|
|
||||||
while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) {
|
while(pThreadInfo->totalInsertRows < pThreadInfo->ntables * insertRows) {
|
||||||
if ((flagSleep) && (insert_interval)) {
|
if ((flagSleep) && (insert_interval)) {
|
||||||
st = taosGetTimestampMs();
|
st = taosGetTimestampMs();
|
||||||
|
@ -6578,6 +6579,11 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->totalAffectedRows += affectedRows;
|
pThreadInfo->totalAffectedRows += affectedRows;
|
||||||
|
|
||||||
|
int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows;
|
||||||
|
if (currentPercent > percentComplete ) {
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent);
|
||||||
|
percentComplete = currentPercent;
|
||||||
|
}
|
||||||
int64_t currentPrintTime = taosGetTimestampMs();
|
int64_t currentPrintTime = taosGetTimestampMs();
|
||||||
if (currentPrintTime - lastPrintTime > 30*1000) {
|
if (currentPrintTime - lastPrintTime > 30*1000) {
|
||||||
printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n",
|
printf("thread[%d] has currently inserted rows: %"PRIu64 ", affected rows: %"PRIu64 "\n",
|
||||||
|
@ -6599,6 +6605,8 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (percentComplete < 100)
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, percentComplete);
|
||||||
|
|
||||||
free_of_interlace:
|
free_of_interlace:
|
||||||
tmfree(pThreadInfo->buffer);
|
tmfree(pThreadInfo->buffer);
|
||||||
|
@ -6636,6 +6644,9 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->samplePos = 0;
|
pThreadInfo->samplePos = 0;
|
||||||
|
|
||||||
|
int percentComplete = 0;
|
||||||
|
int64_t totalRows = insertRows * pThreadInfo->ntables;
|
||||||
|
|
||||||
for (uint64_t tableSeq = pThreadInfo->start_table_from;
|
for (uint64_t tableSeq = pThreadInfo->start_table_from;
|
||||||
tableSeq <= pThreadInfo->end_table_to;
|
tableSeq <= pThreadInfo->end_table_to;
|
||||||
tableSeq ++) {
|
tableSeq ++) {
|
||||||
|
@ -6741,6 +6752,11 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
pThreadInfo->totalAffectedRows += affectedRows;
|
pThreadInfo->totalAffectedRows += affectedRows;
|
||||||
|
|
||||||
|
int currentPercent = pThreadInfo->totalAffectedRows * 100 / totalRows;
|
||||||
|
if (currentPercent > percentComplete ) {
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, currentPercent);
|
||||||
|
percentComplete = currentPercent;
|
||||||
|
}
|
||||||
int64_t currentPrintTime = taosGetTimestampMs();
|
int64_t currentPrintTime = taosGetTimestampMs();
|
||||||
if (currentPrintTime - lastPrintTime > 30*1000) {
|
if (currentPrintTime - lastPrintTime > 30*1000) {
|
||||||
printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n",
|
printf("thread[%d] has currently inserted rows: %"PRId64 ", affected rows: %"PRId64 "\n",
|
||||||
|
@ -6763,6 +6779,8 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
|
||||||
__func__, __LINE__, pThreadInfo->samplePos);
|
__func__, __LINE__, pThreadInfo->samplePos);
|
||||||
}
|
}
|
||||||
} // tableSeq
|
} // tableSeq
|
||||||
|
if (percentComplete < 100)
|
||||||
|
printf("[%d]:%d%%\n", pThreadInfo->threadID, percentComplete);
|
||||||
|
|
||||||
free_of_progressive:
|
free_of_progressive:
|
||||||
tmfree(pThreadInfo->buffer);
|
tmfree(pThreadInfo->buffer);
|
||||||
|
|
Loading…
Reference in New Issue