提交 6fb7ff87 编写于 作者: S shenglian zhou

modify sqlsml to sqlperf

上级 700bd8f2
...@@ -7,8 +7,8 @@ IF (TD_LINUX) ...@@ -7,8 +7,8 @@ IF (TD_LINUX)
TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread ) TARGET_LINK_LIBRARIES(demo taos_static trpc tutil pthread )
ADD_EXECUTABLE(sml schemaless.c) ADD_EXECUTABLE(sml schemaless.c)
TARGET_LINK_LIBRARIES(sml taos_static trpc tutil pthread ) TARGET_LINK_LIBRARIES(sml taos_static trpc tutil pthread )
ADD_EXECUTABLE(sqlsml sqlsml.c) ADD_EXECUTABLE(sqlperf sqlperf.c)
TARGET_LINK_LIBRARIES(sqlsml taos_static trpc tutil pthread ) TARGET_LINK_LIBRARIES(sqlperf taos_static trpc tutil pthread )
ADD_EXECUTABLE(subscribe subscribe.c) ADD_EXECUTABLE(subscribe subscribe.c)
TARGET_LINK_LIBRARIES(subscribe taos_static trpc tutil pthread ) TARGET_LINK_LIBRARIES(subscribe taos_static trpc tutil pthread )
ADD_EXECUTABLE(epoll epoll.c) ADD_EXECUTABLE(epoll epoll.c)
......
...@@ -81,24 +81,32 @@ int main(int argc, char *argv[]) { ...@@ -81,24 +81,32 @@ int main(int argc, char *argv[]) {
int numSTables = 20000; int numSTables = 20000;
int numThreads = 32; int numThreads = 32;
// connect to server int opt;
if (argc > 1) { while ((opt = getopt(argc, argv, "s:t:fvh")) != -1) {
numSTables = atoi(argv[1]); switch (opt) {
} case 's':
numSTables = atoi(optarg);
if (argc > 2) { break;
numThreads = atoi(argv[2]); case 't':
} numThreads = atoi(optarg);
break;
if (argc > 3) { case 'f':
describeTableFirst = atoi(argv[3]) ? true : false; describeTableFirst = true;
} break;
case 'v':
if (argc > 4) { verbose = true;
verbose = atoi(argv[4]) ? true : false; break;
case 'h':
fprintf(stderr, "Usage: %s -s supertable -t thread -FirstDescribeSTable -Verbose\n", argv[0]);
exit(0);
default:
fprintf(stderr, "Usage: %s -s supertable -t thread -FirstDescribeSTable -Verbose\n", argv[0]);
exit(-1);
}
} }
// connect to server
TAOS *taos = taos_connect(NULL, "root", "taosdata", NULL, 0); TAOS *taos = taos_connect(NULL, "root", "taosdata", NULL, 0);
if (taos == NULL) { if (taos == NULL) {
printf("failed to connect to server, reason:%s\n", "null taos" /*taos_errstr(taos)*/); printf("failed to connect to server, reason:%s\n", "null taos" /*taos_errstr(taos)*/);
...@@ -124,10 +132,10 @@ int main(int argc, char *argv[]) { ...@@ -124,10 +132,10 @@ int main(int argc, char *argv[]) {
pthread_join(tids[i], NULL); pthread_join(tids[i], NULL);
} }
int64_t end = taosGetTimestampUs(); int64_t end = taosGetTimestampUs();
printf("TIME: %ld\n", end-begin); printf("TIME: %d(ms)\n", (int)((end-begin)/1000));
printf("THROUGHPUT: %d\n", (int)((numSTables * 1e6) / (end-begin))); printf("THROUGHPUT: %d\n", (int)((numSTables * 1e6) / (end-begin)));
free(threadArgs); free(threadArgs);
free(tids); free(tids);
taos_close(taos); taos_close(taos);
taos_cleanup(); taos_cleanup();
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册