From 4ff07fe4152629c5a6eedf2d9f1b6908a66255a9 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Wed, 11 Aug 2021 17:32:01 +0800 Subject: [PATCH] [TD-5838] add function of speed test --- src/kit/shell/src/shellMain.c | 2 +- src/util/src/tnettest.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/kit/shell/src/shellMain.c b/src/kit/shell/src/shellMain.c index eb6e2effc2..496dac8524 100644 --- a/src/kit/shell/src/shellMain.c +++ b/src/kit/shell/src/shellMain.c @@ -118,7 +118,7 @@ int main(int argc, char* argv[]) { printf("Failed to init taos"); exit(EXIT_FAILURE); } - taosNetTest(args.netTestRole, args.host, args.port, args.pktLen, args.pktLen, args.pktType); + taosNetTest(args.netTestRole, args.host, args.port, args.pktLen, args.pktNum, args.pktType); exit(0); } diff --git a/src/util/src/tnettest.c b/src/util/src/tnettest.c index 68a432ab79..b88ab7e6e6 100644 --- a/src/util/src/tnettest.c +++ b/src/util/src/tnettest.c @@ -552,7 +552,7 @@ static void taosNetTestSpeed(char *host, int32_t port, int32_t pkgLen, int32_t pkgNum, char *pkgType) { char spi = 0; - uInfo("check spend, host:%s port:%d pkgLen:%d pkgNum:%d pkgType:%s\\n", host, port, pkgLen, pkgNum, pkgType); + uInfo("check spend, host:%s port:%d pkgLen:%d pkgNum:%d pkgType:%s", host, port, pkgLen, pkgNum, pkgType); SRpcEpSet epSet; SRpcMsg reqMsg; @@ -579,9 +579,9 @@ static void taosNetTestSpeed(char *host, int32_t port, int32_t pkgLen, } int32_t totalSucc = 0; - int64_t startT = taosGetTimestampUs(); + uint64_t startT = taosGetTimestampUs(); for (int32_t i = 1; i <= pkgNum; i++) { - int64_t startTime = taosGetTimestampUs(); + uint64_t startTime = taosGetTimestampUs(); memset(&epSet, 0, sizeof(SRpcEpSet)); epSet.inUse = 0; @@ -609,13 +609,13 @@ static void taosNetTestSpeed(char *host, int32_t port, int32_t pkgLen, rpcFreeCont(rspMsg.pCont); - int64_t endTime = taosGetTimestampUs(); - int32_t el = endTime - startTime; - printf("progress: %5d/%d, status: %d, cost: %10d ms, speed: %10.2lf KB/s\n", i, pkgNum, code, el, pkgLen/(el/1000.0)/1024); + uint64_t endTime = taosGetTimestampUs(); + uint64_t el = endTime - startTime; + printf("progress: %5d/%d, status: %d, cost: %8" PRId64 " ms, speed: %8.2lf KB/s\n", i, pkgNum, code, el, pkgLen/(el/1000000.0)/1024); } int64_t endT = taosGetTimestampUs(); - int32_t elT = endT - startT; - printf("total: %5d/%d, cost: %10d ms, speed: %10.2lf KB/s\n", totalSucc, pkgNum, elT, pkgLen * totalSucc/(elT/1000.0)/1024); + uint64_t elT = endT - startT; + printf("total: %5d/%d, cost: %8" PRId64 " ms, speed: %8.2lf KB/s\n", totalSucc, pkgNum, elT, pkgLen * totalSucc/(elT/1000000.0)/1024); rpcClose(pRpcConn);