未验证 提交 933e7674 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Hotfix/sangshuduo/td 5872 taosdemo stmt improve (#8008)

* [TD-5872]<fix>: taosdemo stmt improve.

* refactor stmt functions.

* [TD-5872]<fix>: taosdemo stmt csv perf improve.

* rand func back to early impl.

* fix windows/mac compile error.

* fix empty tag sample.

* [TD-5873]<test>add stmt’performance taosdemo testcase

* add data_type enum and stmt_batch framework.

* use data type enum and fix test case limit/offset.

* revert thread number.

* rename MAX_SAMPLES_ONCE_FROM_FILE to reflect reality.

* split func for stmt interlace.

* fix bug that get build path.

* stmt batch interlace works.

* fix start time issue.

* few cleanup.
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
Co-authored-by: haoranc's avatartomchon <haoran920c@163.com>
上级 46f5a490
......@@ -8232,80 +8232,63 @@ static int execStbBindParamBatch(
case TSDB_DATA_TYPE_INT:
case TSDB_DATA_TYPE_UINT:
param->buffer_length = sizeof(int32_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int32_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_UTINYINT:
param->buffer_length = sizeof(int8_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(
stbInfo->sampleBindBatchArray
+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen*(*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(
g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int8_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen*(*pSamplePos));
break;
case TSDB_DATA_TYPE_SMALLINT:
case TSDB_DATA_TYPE_USMALLINT:
param->buffer_length = sizeof(int16_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int16_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_UBIGINT:
param->buffer_length = sizeof(int64_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int64_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_BOOL:
param->buffer_length = sizeof(int8_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int8_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_FLOAT:
param->buffer_length = sizeof(float);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(float)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_DOUBLE:
param->buffer_length = sizeof(double);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(double)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
case TSDB_DATA_TYPE_TIMESTAMP:
param->buffer_length = sizeof(int64_t);
param->buffer = (stbInfo)?
param->buffer =
(void *)((uintptr_t)*(uintptr_t*)(stbInfo->sampleBindBatchArray+sizeof(char*)*(c-1))
+ stbInfo->columns[c-1].dataLen * (*pSamplePos)):
(void *)((uintptr_t)*(uintptr_t*)(g_sampleBindBatchArray+sizeof(char*)*(c-1))
+ sizeof(int64_t)*(*pSamplePos));
+ stbInfo->columns[c-1].dataLen * (*pSamplePos));
break;
default:
......@@ -8326,7 +8309,7 @@ static int execStbBindParamBatch(
if (param->buffer_type == TSDB_DATA_TYPE_NCHAR) {
param->length[b] = strlen(
(char *)param->buffer + b *
((stbInfo)?stbInfo->columns[c].dataLen:g_args.binwidth)
stbInfo->columns[c].dataLen
);
} else {
param->length[b] = param->buffer_length;
......@@ -10569,15 +10552,18 @@ static void startMultiThreadInsertData(int threads, char* db_name,
}
}
fprintf(stderr, "insert delay, avg: %10.2fms, max: %10.2fms, min: %10.2fms\n\n",
(double)avgDelay/1000.0,
(double)maxDelay/1000.0,
(double)minDelay/1000.0);
if (g_fpOfInsertResult) {
fprintf(g_fpOfInsertResult, "insert delay, avg:%10.2fms, max: %10.2fms, min: %10.2fms\n\n",
(double)avgDelay/1000.0,
(double)maxDelay/1000.0,
(double)minDelay/1000.0);
if (minDelay != UINT64_MAX) {
fprintf(stderr, "insert delay, avg: %10.2fms, max: %10.2fms, min: %10.2fms\n\n",
(double)avgDelay/1000.0,
(double)maxDelay/1000.0,
(double)minDelay/1000.0);
if (g_fpOfInsertResult) {
fprintf(g_fpOfInsertResult, "insert delay, avg:%10.2fms, max: %10.2fms, min: %10.2fms\n\n",
(double)avgDelay/1000.0,
(double)maxDelay/1000.0,
(double)minDelay/1000.0);
}
}
//taos_close(taos);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册