Browse Source

fix atomic op

Murat Dogan 4 years ago
parent
commit
c8c4f8db64
1 changed files with 2 additions and 3 deletions
  1. 2 3
      examples/client-benchmark/main.cpp

+ 2 - 3
examples/client-benchmark/main.cpp

@@ -227,10 +227,9 @@ int main(int argc, char **argv) try {
 
 
 	for (int i = 1; i <= duration; ++i) {
 	for (int i = 1; i <= duration; ++i) {
 		this_thread::sleep_for(1000ms);
 		this_thread::sleep_for(1000ms);
-		cout << "#" << i << " Received: " << receivedSize.load() / 1024 << " KB/s"
-		     << "   Sent: " << sentSize.load() / 1024 << " KB/s"
+		cout << "#" << i << " Received: " << receivedSize.exchange(0) / 1024 << " KB/s"
+		     << "   Sent: " << sentSize.exchange(0) / 1024 << " KB/s"
 		     << "   BufferSize: " << dc->bufferedAmount() << endl;
 		     << "   BufferSize: " << dc->bufferedAmount() << endl;
-		receivedSize = sentSize = 0;
 		printStatCounter++;
 		printStatCounter++;
 
 
 		if (printStatCounter % 5 == 0) {
 		if (printStatCounter % 5 == 0) {