diff mbox series

[v2,1/7] app/flow-perf: start using more generic wrapper for cycles

Message ID 20210310134858.8104-2-wisamm@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/7] app/flow-perf: start using more generic wrapper for cycles | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Wisam Jaddo March 10, 2021, 1:48 p.m. UTC
rdtsc() is x86 related, while this might fail for other archs,
so it's better to use more generic API for cycles measurement.

Signed-off-by: Wisam Jaddo <wisamm@nvidia.com>
---
 app/test-flow-perf/main.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Wisam Jaddo March 10, 2021, 1:55 p.m. UTC | #1
------
v2:
* Add first insertion flow latency calculation.
* Fix for decap data set.

v3:
* Fixes in commit message.
* Fixes the cover page.

Wisam Jaddo (7):
  app/flow-perf: start using more generic wrapper for cycles
  app/flow-perf: add new option to use unique data on the fly
  app/flow-perf: fix naming of CPU used structured data
  app/flow-perf: fix report total stats for masked ports
  app/flow-perf: fix the incremental IPv6 src set
  app/flow-perf: add first flow latency support
  app/flow-perf: fix setting decap data for decap actions

 app/test-flow-perf/actions_gen.c | 77 +++++++++++++++++---------------
 app/test-flow-perf/actions_gen.h |  3 +-
 app/test-flow-perf/config.h      |  8 +---
 app/test-flow-perf/flow_gen.c    |  4 +-
 app/test-flow-perf/flow_gen.h    |  1 +
 app/test-flow-perf/items_gen.c   | 13 +++---
 app/test-flow-perf/main.c        | 67 +++++++++++++++++----------
 doc/guides/tools/flow-perf.rst   |  5 +++
 8 files changed, 102 insertions(+), 76 deletions(-)
Alexander Kozyrev March 10, 2021, 9:54 p.m. UTC | #2
> -----Original Message-----
> From: Wisam Monther <wisamm@nvidia.com>
> Sent: Wednesday, March 10, 2021 8:56
> To: arybchenko@solarflare.com; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Alexander Kozyrev <akozyrev@nvidia.com>;
> Raslan Darawsheh <rasland@nvidia.com>; dev@dpdk.org
> Subject: [PATCH v3 0/7] Enhancements and fixes for flow-perf
> 
> ------
> v2:
> * Add first insertion flow latency calculation.
> * Fix for decap data set.
> 
> v3:
> * Fixes in commit message.
> * Fixes the cover page.
> 
> Wisam Jaddo (7):
>   app/flow-perf: start using more generic wrapper for cycles
>   app/flow-perf: add new option to use unique data on the fly
>   app/flow-perf: fix naming of CPU used structured data
>   app/flow-perf: fix report total stats for masked ports
>   app/flow-perf: fix the incremental IPv6 src set
>   app/flow-perf: add first flow latency support
>   app/flow-perf: fix setting decap data for decap actions
> 
>  app/test-flow-perf/actions_gen.c | 77 +++++++++++++++++---------------
>  app/test-flow-perf/actions_gen.h |  3 +-
>  app/test-flow-perf/config.h      |  8 +---
>  app/test-flow-perf/flow_gen.c    |  4 +-
>  app/test-flow-perf/flow_gen.h    |  1 +
>  app/test-flow-perf/items_gen.c   | 13 +++---
>  app/test-flow-perf/main.c        | 67 +++++++++++++++++----------
>  doc/guides/tools/flow-perf.rst   |  5 +++
>  8 files changed, 102 insertions(+), 76 deletions(-)
> 
> --
> 2.17.1

Please add some summary to the cover letter and
fix the warning in patch 6/7. Other than that:
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
diff mbox series

Patch

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 99d0463456..8b5a11c15e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -969,7 +969,7 @@  meters_handler(int port_id, uint8_t core_id, uint8_t ops)
 	end_counter = (core_id + 1) * rules_count_per_core;
 
 	cpu_time_used = 0;
-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (counter = start_counter; counter < end_counter; counter++) {
 		if (ops == METER_CREATE)
 			create_meter_rule(port_id, counter);
@@ -984,10 +984,10 @@  meters_handler(int port_id, uint8_t core_id, uint8_t ops)
 		if (!((counter + 1) % rules_batch)) {
 			rules_batch_idx = ((counter + 1) / rules_batch) - 1;
 			cpu_time_per_batch[rules_batch_idx] =
-				((double)(rte_rdtsc() - start_batch))
-				/ rte_get_tsc_hz();
+				((double)(rte_get_timer_cycles() - start_batch))
+				/ rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}
 
@@ -1089,7 +1089,7 @@  destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 	if (flow_group > 0 && core_id == 0)
 		rules_count_per_core++;
 
-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (i = 0; i < (uint32_t) rules_count_per_core; i++) {
 		if (flows_list[i] == 0)
 			break;
@@ -1107,12 +1107,12 @@  destroy_flows(int port_id, uint8_t core_id, struct rte_flow **flows_list)
 		 * for this batch.
 		 */
 		if (!((i + 1) % rules_batch)) {
-			end_batch = rte_rdtsc();
+			end_batch = rte_get_timer_cycles();
 			delta = (double) (end_batch - start_batch);
 			rules_batch_idx = ((i + 1) / rules_batch) - 1;
-			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz();
+			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}
 
@@ -1185,7 +1185,7 @@  insert_flows(int port_id, uint8_t core_id)
 		flows_list[flow_index++] = flow;
 	}
 
-	start_batch = rte_rdtsc();
+	start_batch = rte_get_timer_cycles();
 	for (counter = start_counter; counter < end_counter; counter++) {
 		flow = generate_flow(port_id, flow_group,
 			flow_attrs, flow_items, flow_actions,
@@ -1211,12 +1211,12 @@  insert_flows(int port_id, uint8_t core_id)
 		 * for this batch.
 		 */
 		if (!((counter + 1) % rules_batch)) {
-			end_batch = rte_rdtsc();
+			end_batch = rte_get_timer_cycles();
 			delta = (double) (end_batch - start_batch);
 			rules_batch_idx = ((counter + 1) / rules_batch) - 1;
-			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_tsc_hz();
+			cpu_time_per_batch[rules_batch_idx] = delta / rte_get_timer_hz();
 			cpu_time_used += cpu_time_per_batch[rules_batch_idx];
-			start_batch = rte_rdtsc();
+			start_batch = rte_get_timer_cycles();
 		}
 	}