[v4,6/7] app/flow-perf: add first flow latency support

Message ID 20210314095427.10101-7-wisamm@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v4,1/7] app/flow-perf: start using more generic wrapper for cycles |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wisam Monther March 14, 2021, 9:54 a.m. UTC
  Starting from this commit the app will always
report the first flow latency.

This is useful in debugging to check the first
flow insertion before any caching effect.

Signed-off-by: Wisam Jaddo <wisamm@nvidia.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Patch

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index e32714131c..d33b00a89e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -1143,6 +1143,7 @@  insert_flows(int port_id, uint8_t core_id)
 	struct rte_flow **flows_list;
 	struct rte_flow_error error;
 	clock_t start_batch, end_batch;
+	double first_flow_latency;
 	double cpu_time_used;
 	double insertion_rate;
 	double cpu_time_per_batch[MAX_BATCHES_COUNT] = { 0 };
@@ -1201,6 +1202,16 @@  insert_flows(int port_id, uint8_t core_id)
 			encap_data, decap_data,
 			core_id, unique_data, &error);
 
+		if (!counter) {
+			first_flow_latency = (double) (rte_get_timer_cycles() - start_batch);
+			first_flow_latency /= rte_get_timer_hz();
+			/* In millisecond */
+			first_flow_latency *= 1000;
+			printf(":: First Flow Latency :: Port %d :: First flow "
+				"installed in %f milliseconds\n",
+				port_id, first_flow_latency);
+		}
+
 		if (force_quit)
 			counter = end_counter;