From 18ed6751dbc5105e787cf068e9a5c0d31cbf63d3 Mon Sep 17 00:00:00 2001
From: jtluka <jtluka@redhat.com>
Date: Wed, 16 Dec 2020 02:54:05 +0100
Subject: [PATCH] iperf_server_api: start calculating CPU utilization right
 before TEST_START (#1077)

Fixes issue 1076.

Signed-off-by: Jan Tluka <jtluka@redhat.com>
---
 src/iperf_server_api.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c
index 83b91ecd9..da91ee250 100644
--- a/src/iperf_server_api.c
+++ b/src/iperf_server_api.c
@@ -447,9 +447,6 @@ iperf_run_server(struct iperf_test *test)
         return -2;
     }
 
-    // Begin calculating CPU utilization
-    cpu_util(NULL);
-
     test->state = IPERF_START;
     send_streams_accepted = 0;
     rec_streams_accepted = 0;
@@ -634,6 +631,9 @@ iperf_run_server(struct iperf_test *test)
 			return -1;
 		    }
 
+		    // Begin calculating CPU utilization
+		    cpu_util(NULL);
+
 		    if (iperf_set_send_state(test, TEST_START) != 0) {
 			cleanup_server(test);
                         return -1;