]> gitweb.hamatoma.de Git - crepublib/commitdiff
current rate in dirtool TCP test
authorhama <hama@siduction.net>
Sun, 22 Mar 2015 18:48:18 +0000 (19:48 +0100)
committerhama <hama@siduction.net>
Sun, 22 Mar 2015 18:48:18 +0000 (19:48 +0100)
os/ReDirTools.cpp

index 53ff136b0561bb441980f5bf845da5bf159fee74..457d25f8d005063038e31e26b653d847c64e2bf6 100644 (file)
@@ -2433,17 +2433,23 @@ void ReDirTCP::runOneThreadClient(const char* ip, int port, int rounds,
                int duration = 0;\r
                ReByteBuffer answer, data;\r
                client.setLogSendReceive(false);\r
+               int64_t sizeCurrent = 0;\r
                for (int ii = 0; ii < rounds; ii++) {\r
                        client.send(command, message.str(), message.length());\r
                        client.receive(answer, data);\r
                        size += message.length() + data.length();\r
+                       sizeCurrent += message.length() + data.length();\r
                        time_t now = time(NULL);\r
                        if (now >= lastPrint + interval) {\r
                                duration = int(now - start);\r
-                               printf("%2d: %9.3f MiByte %8.3f kiByte/sec %s\n", ii,\r
-                                   size / 1024.0 / 1024, (double) size / duration / 1024,\r
+                               int durationCurrent = int(now - lastPrint);\r
+                               printf("%2d: %9.3f MiByte %8.3f / %8.3f kiByte/sec %s\n", ii,\r
+                                   size / 1024.0 / 1024,\r
+                                   (double) sizeCurrent / durationCurrent / 1024,\r
+                                   (double) size / duration / 1024,\r
                                    upload ? "up" : "down");\r
                                lastPrint = now;\r
+                               sizeCurrent = 0;\r
                        }\r
                }\r
                duration = int(time(NULL) - start);\r