Skip to contentSkip to conversation

graph: add optional profiling stats

PATCH Superseded Morten Brørup 6 participants 34 messages Jun 19 – Oct 15 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
 config/rte_config.h                 |  1 +
 lib/graph/graph_debug.c             | 29 ++++++++++++++++++++++++++++-
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 23 ++++++++++++++++++++---
 4 files changed, 51 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
lib/graph/graph_debug.c +28 -1
index e3b8cccdc1..883e37707c 100644
@@ -92,7 +92,34 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 			fprintf(f, "       total_sched_fail=%" PRId64 "\n",
 				n->dispatch.total_sched_fail);
 		}
-		fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+		fprintf(f, "       total_calls=%" PRIu64 "\n", n->total_calls);
+		fprintf(f, "       total_cycles=%" PRIu64 "\n", n->total_cycles);
+#ifdef RTE_GRAPH_PROFILE
+		uint64_t calls_2_or_more = n->total_calls -
+				(n->usage_stats[0].calls + n->usage_stats[1].calls);
+		double avg_objs_2_or_more = calls_2_or_more == 0 ? (double)2 :
+				(double)(n->total_objs - n->usage_stats[1].calls) /
+				(double)calls_2_or_more;
+		fprintf(f, "       calls_0=%" PRIu64 ", _1=%" PRIu64 ", _%.1f=%" PRIu64 "\n",
+				n->usage_stats[0].calls,
+				n->usage_stats[1].calls,
+				avg_objs_2_or_more,
+				calls_2_or_more);
+		fprintf(f, "       cycles_0=%" PRIu64 ", _1=%" PRIu64 ", _%.1f=%" PRIu64 "\n",
+				n->usage_stats[0].cycles,
+				n->usage_stats[1].cycles,
+				avg_objs_2_or_more,
+				n->total_cycles -
+				(n->usage_stats[0].cycles + n->usage_stats[1].cycles));
+		fprintf(f, "       cycles_per_call_1=%.1f, _%.1f=%.1f\n",
+				n->usage_stats[1].calls == 0 ? (double)0 :
+				(double)n->usage_stats[1].cycles / (double)n->usage_stats[1].calls,
+				avg_objs_2_or_more,
+				calls_2_or_more == 0 ? (double)0 :
+				(double)(n->total_cycles -
+				(n->usage_stats[0].cycles + n->usage_stats[1].cycles)) /
+                (double)calls_2_or_more);
+#endif
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +20 -3
index 4ab53a533e..43ce23765b 100644
@@ -144,12 +144,22 @@ struct __rte_cache_aligned rte_node {
 			rte_node_process_t process; /**< Process function. */
 			uint64_t process_u64;
 		};
+		/** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+		struct {
+			uint64_t calls;
+			uint64_t cycles;
+		} usage_stats[2];	/**< Usage when this node processed 0 or 1 objects. */
+		/** Fast path area cache line 4. */
+#endif
 		alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< Next nodes. */
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,18 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 1/1 graph: add optional profiling stats

graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fix indentation.

---
 config/rte_config.h                 |  1 +
 lib/graph/graph_debug.c             | 29 ++++++++++++++++++++++++++++-
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 23 ++++++++++++++++++++---
 4 files changed, 51 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
lib/graph/graph_debug.c +28 -1
index e3b8cccdc1..1110b43c6a 100644
@@ -92,7 +92,34 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 			fprintf(f, "       total_sched_fail=%" PRId64 "\n",
 				n->dispatch.total_sched_fail);
 		}
-		fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+		fprintf(f, "       total_calls=%" PRIu64 "\n", n->total_calls);
+		fprintf(f, "       total_cycles=%" PRIu64 "\n", n->total_cycles);
+#ifdef RTE_GRAPH_PROFILE
+		uint64_t calls_2_or_more = n->total_calls -
+				(n->usage_stats[0].calls + n->usage_stats[1].calls);
+		double avg_objs_2_or_more = calls_2_or_more == 0 ? (double)2 :
+				(double)(n->total_objs - n->usage_stats[1].calls) /
+				(double)calls_2_or_more;
+		fprintf(f, "       calls_0=%" PRIu64 ", _1=%" PRIu64 ", _%.1f=%" PRIu64 "\n",
+				n->usage_stats[0].calls,
+				n->usage_stats[1].calls,
+				avg_objs_2_or_more,
+				calls_2_or_more);
+		fprintf(f, "       cycles_0=%" PRIu64 ", _1=%" PRIu64 ", _%.1f=%" PRIu64 "\n",
+				n->usage_stats[0].cycles,
+				n->usage_stats[1].cycles,
+				avg_objs_2_or_more,
+				n->total_cycles -
+				(n->usage_stats[0].cycles + n->usage_stats[1].cycles));
+		fprintf(f, "       cycles_per_obj_1=%.1f, _%.1f=%.1f\n",
+				n->usage_stats[1].calls == 0 ? (double)0 :
+				(double)n->usage_stats[1].cycles / (double)n->usage_stats[1].calls,
+				avg_objs_2_or_more,
+				calls_2_or_more == 0 ? (double)0 :
+				(double)(n->total_cycles -
+				(n->usage_stats[0].cycles + n->usage_stats[1].cycles)) /
+				(double)calls_2_or_more / avg_objs_2_or_more);
+#endif
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +20 -3
index 4ab53a533e..43ce23765b 100644
@@ -144,12 +144,22 @@ struct __rte_cache_aligned rte_node {
 			rte_node_process_t process; /**< Process function. */
 			uint64_t process_u64;
 		};
+		/** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+		struct {
+			uint64_t calls;
+			uint64_t cycles;
+		} usage_stats[2];	/**< Usage when this node processed 0 or 1 objects. */
+		/** Fast path area cache line 4. */
+#endif
 		alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< Next nodes. */
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,18 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#2 lore raw

PATCH v4 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                 |  1 +
 doc/guides/prog_guide/graph_lib.rst |  1 +
 lib/graph/graph_debug.c             | 39 ++++++++++++++++++++++++++++-
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 23 ++++++++++++++---
 5 files changed, 62 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +1 -0
index 8dd49c19d2..bc36042296 100644
@@ -49,6 +49,7 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +38 -1
index e3b8cccdc1..2aa1e4d22f 100644
@@ -92,7 +92,44 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 			fprintf(f, "       total_sched_fail=%" PRId64 "\n",
 				n->dispatch.total_sched_fail);
 		}
-		fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+		fprintf(f, "       total_calls=%" PRIu64 "\n", n->total_calls);
+		if (rte_graph_has_stats_feature()) {
+			fprintf(f, "       total_cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+					n->total_cycles,
+					n->total_calls == 0 ? (double)0 :
+					(double)n->total_cycles / (double)n->total_calls);
+		}
+#ifdef RTE_GRAPH_PROFILE
+		uint64_t calls = n->usage_stats[0].calls;
+		fprintf(f, "       objs[0]\n");
+		fprintf(f, "         calls=%" PRIu64 ", cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+				calls,
+				n->usage_stats[0].cycles,
+				calls == 0 ? 0.0 :
+				(double)n->usage_stats[0].cycles / (double)calls);
+		calls = n->usage_stats[1].calls;
+		fprintf(f, "       objs[1]\n");
+		fprintf(f, "         calls=%" PRIu64 ", cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+				calls,
+				n->usage_stats[1].cycles,
+				calls == 0 ? 0.0 :
+				(double)n->usage_stats[1].cycles / (double)calls);
+		calls = RTE_MAX(INT64_C(0), (int64_t)(n->total_calls -
+				(n->usage_stats[0].calls + n->usage_stats[1].calls)));
+		uint64_t cycles = RTE_MAX(INT64_C(0), (int64_t)(n->total_cycles -
+				(n->usage_stats[0].cycles + n->usage_stats[1].cycles)));
+		uint64_t objs = RTE_MAX(INT64_C(0), (int64_t)(n->total_objs -
+				n->usage_stats[1].calls));
+		double objs_per_call = calls == 0 ? 0.0 : (double)objs / (double)calls;
+		fprintf(f, "       objs[more], avg objs/call=%.1f\n", objs_per_call);
+		fprintf(f, "         calls=%" PRIu64 ", cycles=%" PRIu64 ", avg cycles/call=%.1f"
+				", avg cycles/obj=%.1f\n",
+				calls,
+				cycles,
+				calls == 0 ? 0.0 : (double)cycles / (double)calls,
+				calls == 0 || objs_per_call == 0.0 ? 0.0 :
+				(double)cycles / (double)calls / objs_per_call);
+#endif
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +20 -3
index 4ab53a533e..10a52a540b 100644
@@ -144,12 +144,22 @@ struct __rte_cache_aligned rte_node {
 			rte_node_process_t process; /**< Process function. */
 			uint64_t process_u64;
 		};
+		/** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+		struct {
+			uint64_t calls;     /**< Calls processing resp. 0 or 1 objects. */
+			uint64_t cycles;    /**< Cycles spent processing resp. 0 or 1 objects. */
+		} usage_stats[2];       /**< Usage when this node processed 0 or 1 objects. */
+		/** Fast path area cache line 4. */
+#endif
 		alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< Next nodes. */
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,18 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#3 lore raw

PATCH v5 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                 |  1 +
 doc/guides/prog_guide/graph_lib.rst |  1 +
 lib/graph/graph_debug.c             | 57 ++++++++++++++++++++++++++++-
 lib/graph/node.c                    |  2 +
 lib/graph/rte_graph_worker_common.h | 33 +++++++++++++++--
 5 files changed, 90 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +1 -0
index 8dd49c19d2..bc36042296 100644
@@ -49,6 +49,7 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +56 -1

63 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +30 -3
index 4ab53a533e..0d8039575d 100644
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
 			rte_node_process_t process; /**< Process function. */
 			uint64_t process_u64;
 		};
+		/** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+		struct {
+			uint64_t calls;     /**< Calls processing resp. 0 or 1 objects. */
+			uint64_t cycles;    /**< Cycles spent processing resp. 0 or 1 objects. */
+		} usage_stats[2];       /**< Usage when this node processed 0 or 1 objects. */
+		uint64_t full_burst_calls;  /**< Calls processing a full burst of objects. */
+		uint64_t full_burst_cycles; /**< Cycles spent processing a full burst of objects. */
+		uint64_t half_burst_calls;  /**< Calls processing a half burst of objects. */
+		uint64_t half_burst_cycles; /**< Cycles spent processing a half burst of objects. */
+		/** Fast path area cache line 4. */
+#endif
 		alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< Next nodes. */
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +211,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +220,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->full_burst_calls++;
+			node->full_burst_cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE / 2) {
+			node->half_burst_calls++;
+			node->half_burst_cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

RE: |WARNING| [v5] graph: add optional profiling stats

Quoted 22 lines

From: [email protected] [mailto:[email protected]]
Sent: Sunday, 21 June 2026 22.18

Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/165897

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-06-21

# DPDK Patch Review

## Summary

This patch adds optional profiling statistics to the graph library. The code is generally well-structured, but there are several issues that need to be addressed.

---

Quoted 8 lines

## Errors

### 1. Integer signedness mismatch in RTE_MAX call (Correctness)

**File:** lib/graph/graph_debug.c

**Issue:** RTE_MAX is used with INT64_C(0) (signed) and unsigned integer arithmetic results.

Rubbish.
The second parameter passed to RTE_MAX() is explicitly cast to signed integer (int64_t).

Quoted 13 lines

This can cause incorrect comparisons when
the unsigned result is large enough to be interpreted as negative when cast to signed.

```c
calls = RTE_MAX(INT64_C(0), (int64_t)(n->total_calls -
        (n->usage_stats[0].calls + n->usage_stats[1].calls)));
uint64_t cycles = RTE_MAX(INT64_C(0), (int64_t)(n->total_cycles -
        (n->usage_stats[0].cycles + n->usage_stats[1].cycles)));
uint64_t objs = RTE_MAX(INT64_C(0), (int64_t)(n->total_objs -
        n->usage_stats[1].calls));
```
Quoted 6 lines

**Why it matters:** If the subtraction underflows (e.g., due to uninitialized stats or race conditions), casting a large unsigned value to int64_t produces a negative number, which RTE_MAX correctly clamps to 0. However, the result is then assigned back to uint64_t, where -1 would become UINT64_MAX. While the current code happens to work, mixing signed and unsigned types in this way is fragile.

Rubbish.
When clamping to 0, it cannot be -1.

Quoted 22 lines

**Suggested fix:** Either use unsigned saturating subtraction or add a comment explaining the intentional signed clamping:

```c
/* Clamp to 0 if stats haven't been fully initialized */
calls = (uint64_t)RTE_MAX(INT64_C(0), (int64_t)(n->total_calls -
        (n->usage_stats[0].calls + n->usage_stats[1].calls)));
```

Or use a more explicit pattern:

```c
uint64_t sum_calls = n->usage_stats[0].calls + n->usage_stats[1].calls;
calls = (n->total_calls > sum_calls) ? (n->total_calls - sum_calls) :
0;
```

---

### 2. Missing release notes entry

Quoted 7 lines

**Issue:** This patch adds a new build-time configuration option (RTE_GRAPH_PROFILE) and new profiling features, but does not update the release notes.

**Why it matters:** DPDK contribution guidelines require release notes for significant changes, especially new features and configuration options.

Disagree.
IMHO, this option is not significant enough to mention in the release notes. The overall profiling details are already shown.
This option only adds profiling details for a few specific burst sizes.

Quoted 19 lines

**Suggested fix:** Add an entry to doc/guides/rel_notes/release_26_07.rst (or the appropriate release notes file) documenting:
- The new RTE_GRAPH_PROFILE configuration option
- What profiling statistics it enables
- Performance impact when enabled

---

### 3. RTE_GRAPH_PROFILE not defined as commented-out in rte_config.h

**File:** config/rte_config.h

**Issue:** The patch adds a comment /* RTE_GRAPH_PROFILE is not set */, but for consistency with other disabled options in DPDK (and to support build system detection), it should be defined to 0 or use #undef.

Quoted 7 lines
```c
/* RTE_GRAPH_PROFILE is not set */
```

**Why it matters:** DPDK coding standards (per AGENTS.md) specify that disabled config options should use // XXX is not set format or be explicitly set to 0 for clarity.

Rubbish.
It follows the existing coding style in that file.

Quoted 31 lines

**Suggested fix:**

```c
// RTE_GRAPH_PROFILE is not set
```

Or define it explicitly:

```c
/* #define RTE_GRAPH_PROFILE 1 */
```

---

## Warnings

### 1. Inconsistent format specifier for total_calls

**File:** lib/graph/graph_debug.c

**Before:**

```c
fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
```

**After:**

```c
fprintf(f, "       total_calls=%" PRIu64 "\n", n->total_calls);
```
Quoted 7 lines

**Issue:** This change from PRId64 to PRIu64 is correct (since total_calls is unsigned), but it's technically unrelated to the profiling feature addition. Consider splitting this bugfix into a separate preparatory patch.

**Suggested action:** Either mention this fix in the commit message or split it into a separate bugfix patch with a Fixes: tag.

Disagree.
IMO, such minor drive-by changes like this should not be mentioned. Mentioning them would be noise, and take focus from the actual changes.

Quoted 28 lines

---

### 2. Potential cache line alignment impact not documented

**File:** lib/graph/rte_graph_worker_common.h

**Issue:** When RTE_GRAPH_PROFILE is enabled, the rte_node structure grows significantly (adds ~64 bytes for profiling stats). The patch removes the compile-time assertion checking that node metadata fits in one cache line.

```c
#ifndef RTE_GRAPH_PROFILE
/* Limit Node specific metadata to one cacheline on 64B CL machine */
RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
          offsetof(struct rte_node, ctx)) !=
         RTE_CACHE_LINE_MIN_SIZE);
#endif
```

**Why it matters:** This increases memory footprint and potentially impacts cache performance. The documentation update mentions enabling profiling but doesn't warn about the performance cost.

**Suggested fix:** Add a note in the documentation (prog_guide/graph_lib.rst) about the cache line impact:

Quoted 6 lines
```rst
- Enable the ``RTE_GRAPH_PROFILE`` config option for detailed profiling
statistics.
  Note: This increases the ``rte_node`` structure size and may impact
cache performance.
```

Disagree.
The memory footprint increase is completely insignificant.
Yes, there's a potential performance cost; but not mainly from the increased structure size. Any added instrumentation comes with a performance cost, which I consider too obvious to mention.

Quoted 14 lines

---

### 3. Division by zero checks use ternary instead of explicit if

**File:** lib/graph/graph_debug.c

**Issue:** Multiple instances use ternary operators for division-by- zero protection:

```c
calls == 0 ? 0.0 : (double)cycles / (double)calls
```
Quoted 8 lines

**Why it matters:** While correct, explicit if statements are generally more readable for complex calculations, especially when the expression appears multiple times.

**Suggested fix:** This is acceptable as-is for simple cases, but consider extracting repeated calculations to helper functions if this pattern becomes more complex in the future.

Disagree.
It's a matter of taste.
In this case, I think the ternary is easier to read.

Quoted 17 lines

---

## Info

### 1. Consider helper macro for safe division

**Observation:** The pattern calls == 0 ? 0.0 : (double)cycles / (double)calls appears many times.

**Suggestion:** Consider defining a helper macro at the top of the file:

```c
#define SAFE_DIV(num, den) ((den) == 0 ? 0.0 : (double)(num) /
(double)(den))
```
Quoted 4 lines

Then use: SAFE_DIV(cycles, calls)

This would reduce code duplication and make the division-by-zero protection more obvious.

Disagree.
Again, it's a matter of taste.
In this case, I think the ternary is easier to read.

Quoted 8 lines

---

### 2. Profiling statistics initialization

**Observation:** The new profiling fields in rte_node are not explicitly initialized in the patch.

Quoted 6 lines

**Question:** Are these fields zeroed during node creation? If they rely on rte_zmalloc() or similar, this should be verified. If nodes are allocated differently, explicit initialization may be needed.

**Suggested verification:** Confirm that node allocation zero- initializes the structure, or add explicit initialization in node.c.

The node is allocated with calloc() in node.c.
No need for further initialization.

Quoted 8 lines

---

### 3. Half-burst tracking precision

**Observation:** The code tracks exactly RTE_GRAPH_BURST_SIZE / 2 and RTE_GRAPH_BURST_SIZE but not other common burst sizes.

Quoted 8 lines

**Suggestion:** Consider if tracking ranges (e.g., [2..BURST_SIZE/2- 1], [BURST_SIZE/2+1..BURST_SIZE-1]) would provide more complete profiling data. The current approach gives precise data for three specific cases (0, 1, half, full) and aggregates everything else into "more."

This is not a defect, just a design consideration for future enhancement.

Tracking ranges does not provide more information.
Tracking specific burst sizes provide relevant information.
Larger burst sizes approximately fit into: cycles = A + B * nb_objs.
Burst sizes of 0 and 1 are frequent instances; they usually don't fit on the linear approximation for larger burst sizes, so tracking them separately provides relevant information.

Quoted 8 lines

---

## Conclusion

The patch is well-implemented overall with good documentation and appropriate use of conditional compilation. The main issues are:

Quoted 8 lines

1. **Error:** Mixed signed/unsigned integer comparison needs clarification or refactoring
2. **Error:** Missing release notes entry
3. **Error:** Config file comment format should follow DPDK convention
4. **Warning:** Performance impact of cache line expansion should be documented

After addressing these issues, the patch will be ready for integration.

My conclusion:
No changes required. The patch is ready for integration as is.

#6 lore raw
In reply to Morten Brørup
Quoted 18 lines · Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

Quoted 6 lines
---
 config/rte_config.h                 |  1 +
 doc/guides/prog_guide/graph_lib.rst |  1 +
 lib/graph/graph_debug.c             | 57 ++++++++++++++++++++++++++++-
 lib/graph/node.c                    |  2 +
 lib/graph/rte_graph_worker_common.h | 33 +++++++++++++++--

Please update app/test/test_graph.c to validate this featue.

Quoted 33 lines
 5 files changed, 90 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +1 -0
index 8dd49c19d2..bc36042296 100644
@@ -49,6 +49,7 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +0 -0
index e3b8cccdc1..7c97e23748 100644
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
                        fprintf(f, "       total_sched_fail=%" PRId64 "\n",
                                n->dispatch.total_sched_fail);

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 10 lines
lib/graph/graph_debug.c +8 -1
                }
-               fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+               fprintf(f, "       total_calls=%" PRIu64 "\n", n->total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+                                       n->total_cycles,
+                                       n->total_calls == 0 ? (double)0 :
+                                       (double)n->total_cycles / (double)n->total_calls);
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as possible.

Quoted 16 lines
lib/graph/graph_debug.c +4 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ", cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+                               calls,
 
 
lib/graph/rte_graph_worker_common.h +2 -0
index 4ab53a533e..0d8039575d 100644
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**< Process function. */
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 10 lines
lib/graph/rte_graph_worker_common.h +10 -0
+               struct {
+                       uint64_t calls;     /**< Calls processing resp. 0 or 1 objects. */
+                       uint64_t cycles;    /**< Cycles spent processing resp. 0 or 1 objects. */
+               } usage_stats[2];       /**< Usage when this node processed 0 or 1 objects. */
+               uint64_t full_burst_calls;  /**< Calls processing a full burst of objects. */
+               uint64_t full_burst_cycles; /**< Cycles spent processing a full burst of objects. */
+               uint64_t half_burst_calls;  /**< Calls processing a half burst of objects. */
+               uint64_t half_burst_cycles; /**< Cycles spent processing a half burst of objects. */
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

Quoted 4 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node *nodes[]; /**< Next nodes. */
        };
 };
 
#7 lore raw
Quoted 6 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 07.13

Quoted 1 line · Morten Brørup
Quoted 6 lines
Quoted 4 lines

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

Please update app/test/test_graph.c to validate this featue.

Ack.

Quoted 16 lines

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g,

Quoted 1 line
(quoted diff) +0 -0
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g,

bool all)

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 92

Quoted 1 line
(quoted diff) +0 -0
                        fprintf(f, "       total_sched_fail=%" PRId64

"\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 99

Quoted 8 lines
(quoted diff) +3 -1
                                n->dispatch.total_sched_fail);
                }
-               fprintf(f, "       total_calls=%" PRId64 "\n", n-
 total_calls);
+               fprintf(f, "       total_calls=%" PRIu64 "\n", n-
 total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%" PRIu64 ",

avg cycles/call=%.1f\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 101

Quoted 2 lines
(quoted diff) +2 -0
+                                       n->total_cycles,
+                                       n->total_calls == 0 ?

(double)0 :

Quoted 8 lines

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 102

Quoted 1 line
(quoted diff) +1 -0
+                                       (double)n->total_cycles /

(double)n->total_calls);

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 2 lines
lib/graph/graph_debug.c +2 -0
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as possible.

Disagree, see below.

Quoted 31 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)

Quoted 4 lines
lib/graph/graph_debug.c +3 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ", cycles=%"

PRIu64 ", avg cycles/call=%.1f\n",

Review

Quoted 4 lines
(quoted diff) +1 -0
+                               calls,
 
(quoted diff) +0 -0

b/lib/graph/rte_graph_worker_common.h

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 144

Quoted 5 lines

index 4ab53a533e..0d8039575d 100644

lib/graph/rte_graph_worker_common.h +0 -0
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**< Process

function. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +4 -0
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls processing

resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 151

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+                       uint64_t cycles;    /**< Cycles spent

processing resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 152

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               } usage_stats[2];       /**< Usage when this node

processed 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 153

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_calls;  /**< Calls processing a

full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 154

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 8 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 155

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_calls;  /**< Calls processing a

half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 156

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

No. The modifications are enclosed in #ifdef, and disabled by default.
It is generally required that when rte_config.h options are modified, both the application and DPDK itself are built together; and then API/ABI breakage becomes irrelevant.

IMO, we should keep our structures lean in release builds. This means that fields used for detailed profiling, advanced debugging, cookie validation, etc. should use the #ifdef pattern rather than the rte_lib_has_some_feature() pattern; especially if they affect the size of a structure. And when those fields are not present, any code accessing them cannot use the rte_lib_has_some_feature() pattern. The mbuf and mempool libraries also use #ifdef pattern for similar features.

Quoted 6 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 159

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node

*nodes[]; /**< Next nodes. */

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
        };
 };
 
#8 lore raw
Quoted 77 lines · Morten Brørup
Quoted 7 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 07.13

Quoted 1 line · Morten Brørup
Quoted 6 lines
Quoted 4 lines

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

Please update app/test/test_graph.c to validate this featue.

Ack.

Quoted 16 lines

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g,

Quoted 1 line
(quoted diff) +0 -0
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g,

bool all)

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 92

Quoted 1 line
(quoted diff) +0 -0
                        fprintf(f, "       total_sched_fail=%" PRId64

"\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 99

Quoted 8 lines
(quoted diff) +3 -1
                                n->dispatch.total_sched_fail);
                }
-               fprintf(f, "       total_calls=%" PRId64 "\n", n-
 total_calls);
+               fprintf(f, "       total_calls=%" PRIu64 "\n", n-
 total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%" PRIu64 ",

avg cycles/call=%.1f\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 101

Quoted 2 lines
(quoted diff) +2 -0
+                                       n->total_cycles,
+                                       n->total_calls == 0 ?

(double)0 :

Quoted 8 lines

Review rte_graph_obj_dump(FILE *f, struct rte_graph *g, · line 102

Quoted 1 line
(quoted diff) +1 -0
+                                       (double)n->total_cycles /

(double)n->total_calls);

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 2 lines
lib/graph/graph_debug.c +2 -0
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as possible.

Disagree, see below.

Quoted 34 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)

Quoted 4 lines
lib/graph/graph_debug.c +3 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ", cycles=%"

PRIu64 ", avg cycles/call=%.1f\n",

Review

Quoted 4 lines
(quoted diff) +1 -0
+                               calls,
 
(quoted diff) +0 -0

b/lib/graph/rte_graph_worker_common.h

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 144

Quoted 5 lines

index 4ab53a533e..0d8039575d 100644

lib/graph/rte_graph_worker_common.h +0 -0
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**< Process

function. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +4 -0
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls processing

resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 151

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+                       uint64_t cycles;    /**< Cycles spent

processing resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 152

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               } usage_stats[2];       /**< Usage when this node

processed 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 153

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_calls;  /**< Calls processing a

full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 154

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 155

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_calls;  /**< Calls processing a

half burst of objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_cycles; /**< Cycles spent
Quoted 8 lines
Quoted 5 lines

processing a half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

No. The modifications are enclosed in #ifdef, and disabled by default.
It is generally required that when rte_config.h options are modified, both the application and DPDK itself are built together; and then API/ABI breakage becomes irrelevant.

Yes. I don't know the current policy for this. Adding @Thomas Monjalon @David Marchand

Quoted 3 lines

IMO, we should keep our structures lean in release builds. This means that fields used for detailed profiling, advanced debugging, cookie validation, etc. should use the #ifdef pattern rather than the rte_lib_has_some_feature() pattern; especially if they affect the size of a structure. And when those fields are not present, any code accessing them cannot use the rte_lib_has_some_feature() pattern. The mbuf and mempool libraries also use #ifdef pattern for similar features.

Yes for the structure inclusion we can use #ifdef. But inside the function we can use rte_lib_has_some_feature() scheme. Reasons are :
1)It will remove the ifdef cultter
2)Detect the compilation issue even if the feature is disabled. This will make sure reduce the build options to enable build sanity
3) Compiler is smart enough to understand to disable the block if the feature is not enabled.(Just like #ifdef)

Quoted 7 lines
Quoted 7 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 159

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node

*nodes[]; /**< Next nodes. */

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
        };
 };
 
#9 lore raw

+Thomas Monjalon & +David Marchand, as intended by Jerin

Quoted 115 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 08.57

Quoted 8 lines · Morten Brørup
Quoted 8 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 07.13

Quoted 2 lines · Morten Brørup

Added graph node profiling stats, build time configurable by

enabling

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

RTE_GRAPH_PROFILE in rte_config.h.

Please update app/test/test_graph.c to validate this featue.

Ack.

Quoted 1 line

Review rte_graph_obj_dump(FILE *f, struct rte_graph

Quoted 1 line
(quoted diff) +0 -0
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct rte_graph

*g,

Quoted 2 lines
Quoted 2 lines

bool all)

Quoted 1 line
(quoted diff) +0 -0
                        fprintf(f, "       total_sched_fail=%"

PRId64

Quoted 9 lines
Quoted 9 lines

"\n",

Quoted 8 lines
(quoted diff) +3 -1
                                n->dispatch.total_sched_fail);
                }
-               fprintf(f, "       total_calls=%" PRId64 "\n", n-
 total_calls);
+               fprintf(f, "       total_calls=%" PRIu64 "\n", n-
 total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%" PRIu64

",

Quoted 6 lines
Quoted 6 lines

avg cycles/call=%.1f\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph · line 101

Quoted 2 lines
(quoted diff) +2 -0
+                                       n->total_cycles,
+                                       n->total_calls == 0 ?

(double)0 :

Review rte_graph_obj_dump(FILE *f, struct rte_graph · line 102

Quoted 1 line
(quoted diff) +1 -0
+                                       (double)n->total_cycles /

(double)n->total_calls);

Quoted 37 lines
Quoted 6 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 2 lines
lib/graph/graph_debug.c +2 -0
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as possible.

Disagree, see below.

Quoted 28 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)

Quoted 4 lines
lib/graph/graph_debug.c +3 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ", cycles=%"

PRIu64 ", avg cycles/call=%.1f\n",

Review

Quoted 4 lines
(quoted diff) +1 -0
+                               calls,
 
(quoted diff) +0 -0

b/lib/graph/rte_graph_worker_common.h

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 144

Quoted 5 lines

index 4ab53a533e..0d8039575d 100644

lib/graph/rte_graph_worker_common.h +0 -0
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**< Process

function. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +4 -0
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls processing

resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 151

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+                       uint64_t cycles;    /**< Cycles spent

processing resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 152

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               } usage_stats[2];       /**< Usage when this node

processed 0 or 1 objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_calls;  /**< Calls processing

a

Quoted 4 lines
Quoted 4 lines

full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 154

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_calls;  /**< Calls processing

a

Quoted 9 lines
Quoted 7 lines

half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 156

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

No. The modifications are enclosed in #ifdef, and disabled by

default.

Quoted 1 line

It is generally required that when rte_config.h options are modified,

both the application and DPDK itself are built together; and then API/ABI breakage becomes irrelevant.

Yes. I don't know the current policy for this. Adding @Thomas Monjalon @David Marchand

Quoted 2 lines

IMO, we should keep our structures lean in release builds. This means

that fields used for detailed profiling, advanced debugging, cookie validation, etc. should use the #ifdef pattern rather than the rte_lib_has_some_feature() pattern; especially if they affect the size of a structure. And when those fields are not present, any code accessing them cannot use the rte_lib_has_some_feature() pattern.

Quoted 1 line

The mbuf and mempool libraries also use #ifdef pattern for similar

features.

Quoted 7 lines

Yes for the structure inclusion we can use #ifdef. But inside the function we can use rte_lib_has_some_feature() scheme. Reasons are :
1)It will remove the ifdef cultter
2)Detect the compilation issue even if the feature is disabled. This will make sure reduce the build options to enable build sanity
3) Compiler is smart enough to understand to disable the block if the feature is not enabled.(Just like #ifdef)

I agree with these advantages.
But a function using rte_lib_has_some_feature() cannot access non-existing fields:
https://godbolt.org/z/s3nKx45Ms

So sometimes #ifdef is required in the code too.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 159

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node

*nodes[]; /**< Next nodes. */

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
        };
 };
 
#10 lore raw
Quoted 126 lines · Morten Brørup

+Thomas Monjalon & +David Marchand, as intended by Jerin

Quoted 115 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 08.57

Quoted 8 lines · Morten Brørup
Quoted 8 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 07.13

Quoted 2 lines · Morten Brørup

Added graph node profiling stats, build time configurable by

enabling

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

RTE_GRAPH_PROFILE in rte_config.h.

Please update app/test/test_graph.c to validate this featue.

Ack.

Quoted 1 line

Review rte_graph_obj_dump(FILE *f, struct rte_graph

Quoted 1 line
(quoted diff) +0 -0
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct rte_graph

*g,

Quoted 2 lines
Quoted 2 lines

bool all)

Quoted 1 line
(quoted diff) +0 -0
                        fprintf(f, "       total_sched_fail=%"

PRId64

Quoted 9 lines
Quoted 9 lines

"\n",

Quoted 8 lines
(quoted diff) +3 -1
                                n->dispatch.total_sched_fail);
                }
-               fprintf(f, "       total_calls=%" PRId64 "\n", n-
 total_calls);
+               fprintf(f, "       total_calls=%" PRIu64 "\n", n-
 total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%" PRIu64

",

Quoted 6 lines
Quoted 6 lines

avg cycles/call=%.1f\n",

Review rte_graph_obj_dump(FILE *f, struct rte_graph · line 101

Quoted 2 lines
(quoted diff) +2 -0
+                                       n->total_cycles,
+                                       n->total_calls == 0 ?

(double)0 :

Review rte_graph_obj_dump(FILE *f, struct rte_graph · line 102

Quoted 1 line
(quoted diff) +1 -0
+                                       (double)n->total_cycles /

(double)n->total_calls);

Quoted 37 lines
Quoted 6 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 2 lines
lib/graph/graph_debug.c +2 -0
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as possible.

Disagree, see below.

Quoted 28 lines

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)

Quoted 4 lines
lib/graph/graph_debug.c +3 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ", cycles=%"

PRIu64 ", avg cycles/call=%.1f\n",

Review

Quoted 4 lines
(quoted diff) +1 -0
+                               calls,
 
(quoted diff) +0 -0

b/lib/graph/rte_graph_worker_common.h

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 144

Quoted 5 lines

index 4ab53a533e..0d8039575d 100644

lib/graph/rte_graph_worker_common.h +0 -0
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**< Process

function. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +4 -0
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls processing

resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 151

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+                       uint64_t cycles;    /**< Cycles spent

processing resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 152

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               } usage_stats[2];       /**< Usage when this node

processed 0 or 1 objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_calls;  /**< Calls processing

a

Quoted 4 lines
Quoted 4 lines

full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 154

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_calls;  /**< Calls processing

a

Quoted 9 lines
Quoted 7 lines

half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 156

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

No. The modifications are enclosed in #ifdef, and disabled by

default.

Quoted 1 line

It is generally required that when rte_config.h options are modified,

both the application and DPDK itself are built together; and then API/ABI breakage becomes irrelevant.

Yes. I don't know the current policy for this. Adding @Thomas Monjalon @David Marchand

Quoted 2 lines

IMO, we should keep our structures lean in release builds. This means

that fields used for detailed profiling, advanced debugging, cookie validation, etc. should use the #ifdef pattern rather than the rte_lib_has_some_feature() pattern; especially if they affect the size of a structure. And when those fields are not present, any code accessing them cannot use the rte_lib_has_some_feature() pattern.

Quoted 1 line

The mbuf and mempool libraries also use #ifdef pattern for similar

features.

Quoted 7 lines

Yes for the structure inclusion we can use #ifdef. But inside the function we can use rte_lib_has_some_feature() scheme. Reasons are :
1)It will remove the ifdef cultter
2)Detect the compilation issue even if the feature is disabled. This will make sure reduce the build options to enable build sanity
3) Compiler is smart enough to understand to disable the block if the feature is not enabled.(Just like #ifdef)

Quoted 3 lines

I agree with these advantages.
But a function using rte_lib_has_some_feature() cannot access non-existing fields:
https://godbolt.org/z/s3nKx45Ms

I missed that.

You can add these new struct updates in the slowpath area of rte_node. Above offsetof(struct rte_node, ctx)

Use RTE_NEXT_ABI, Get around off, ABI breakge issue.

Quoted 13 lines

So sometimes #ifdef is required in the code too.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 159

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node

*nodes[]; /**< Next nodes. */

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
        };
 };
 
#11 lore raw

Jerin, Saeed,

Quoted 159 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 11.09

Quoted 19 lines · Morten Brørup

+Thomas Monjalon & +David Marchand, as intended by Jerin

Quoted 16 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 08.57

Quoted 8 lines · Morten Brørup
Quoted 8 lines

From: Jerin Jacob [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 07.13

Quoted 2 lines · Morten Brørup

Added graph node profiling stats, build time configurable by

enabling

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

RTE_GRAPH_PROFILE in rte_config.h.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Please update app/test/test_graph.c to validate this featue.

Ack.

Quoted 1 line

Review rte_graph_obj_dump(FILE *f, struct

Quoted 1 line
(quoted diff) +0 -0
@@ -92,7 +92,62 @@ rte_graph_obj_dump(FILE *f, struct

rte_graph

Quoted 3 lines
Quoted 3 lines

*g,

Quoted 2 lines
Quoted 2 lines

bool all)

Quoted 1 line
(quoted diff) +0 -0
                        fprintf(f, "

total_sched_fail=%"

Quoted 6 lines
Quoted 3 lines

PRId64

Quoted 2 lines
Quoted 2 lines

"\n",

Quoted 1 line
(quoted diff) +0 -0
                                n-

dispatch.total_sched_fail);

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0 -1
                }
-               fprintf(f, "       total_calls=%" PRId64

"\n", n-

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Review rte_graph_obj_dump(FILE *f, struct · line 96

Quoted 2 lines
(quoted diff) +1 -0
 total_calls);
+               fprintf(f, "       total_calls=%" PRIu64

"\n", n-

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Review rte_graph_obj_dump(FILE *f, struct · line 99

Quoted 3 lines
(quoted diff) +2 -0
 total_calls);
+               if (rte_graph_has_stats_feature()) {
+                       fprintf(f, "       total_cycles=%"

PRIu64

Quoted 14 lines
Quoted 6 lines

",

Quoted 5 lines
Quoted 5 lines

avg cycles/call=%.1f\n",

Review rte_graph_obj_dump(FILE *f, struct · line 101

Quoted 2 lines
(quoted diff) +2 -0
+                                       n->total_cycles,
+                                       n->total_calls == 0 ?

(double)0 :

Quoted 1 line
(quoted diff) +1 -0
+                                       (double)n-

total_cycles /

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

(double)n->total_calls);

lib/graph/graph_debug.c rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) · line 102

Quoted 2 lines
lib/graph/graph_debug.c +2 -0
+               }
+#ifdef RTE_GRAPH_PROFILE

Please introduce rte_graph_has_profile_featue() similar to rte_graph_has_stats_feature() to reduce if def clutter as

possible.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Disagree, see below.

Quoted 4 lines
Quoted 4 lines
lib/graph/graph_debug.c +3 -0
+               uint64_t calls = n->usage_stats[0].calls;
+               fprintf(f, "       objs[0]\n");
+               fprintf(f, "         calls=%" PRIu64 ",

cycles=%"

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

PRIu64 ", avg cycles/call=%.1f\n",

Review

Quoted 4 lines
(quoted diff) +1 -0
+                               calls,
 
(quoted diff) +0 -0

b/lib/graph/rte_graph_worker_common.h

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 144

Quoted 5 lines

index 4ab53a533e..0d8039575d 100644

lib/graph/rte_graph_worker_common.h +0 -0
@@ -144,12 +144,26 @@ struct __rte_cache_aligned rte_node {
                        rte_node_process_t process; /**<

Process

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

function. */

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +4 -0
                        uint64_t process_u64;
                };
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls

processing

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

resp. 0 or 1 objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 151

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+                       uint64_t cycles;    /**< Cycles spent

processing resp. 0 or 1 objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               } usage_stats[2];       /**< Usage when this

node

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

processed 0 or 1 objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_calls;  /**< Calls

processing

Quoted 5 lines
Quoted 5 lines

a

Quoted 4 lines
Quoted 4 lines

full burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 154

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_calls;  /**< Calls

processing

Quoted 4 lines
Quoted 4 lines

a

Quoted 3 lines
Quoted 3 lines

half burst of objects. */

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 156

Quoted 1 line
lib/graph/rte_graph_worker_common.h +1 -0
+               uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node { · line 158

Quoted 2 lines
lib/graph/rte_graph_worker_common.h +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

No. The modifications are enclosed in #ifdef, and disabled by

default.

Quoted 1 line

It is generally required that when rte_config.h options are

modified,

Quoted 5 lines
Quoted 5 lines

both the application and DPDK itself are built together; and then API/ABI breakage becomes irrelevant.

Yes. I don't know the current policy for this. Adding @Thomas

Monjalon

Quoted 5 lines
Quoted 5 lines

@David Marchand

Quoted 2 lines

IMO, we should keep our structures lean in release builds. This

means

Quoted 3 lines
Quoted 3 lines

that fields used for detailed profiling, advanced debugging, cookie validation, etc. should use the #ifdef pattern rather than the rte_lib_has_some_feature() pattern; especially if they affect the

size

Quoted 3 lines
Quoted 3 lines

of a structure. And when those fields are not present, any code accessing them cannot use the rte_lib_has_some_feature() pattern.

Quoted 1 line

The mbuf and mempool libraries also use #ifdef pattern for

similar

Quoted 4 lines
Quoted 4 lines

features.

Yes for the structure inclusion we can use #ifdef. But inside the function we can use rte_lib_has_some_feature() scheme. Reasons are

:

Quoted 2 lines
Quoted 2 lines

1)It will remove the ifdef cultter
2)Detect the compilation issue even if the feature is disabled.

This

Quoted 2 lines
Quoted 2 lines

will make sure reduce the build options to enable build sanity
3) Compiler is smart enough to understand to disable the block if

the

Quoted 4 lines
Quoted 1 line

feature is not enabled.(Just like #ifdef)

I agree with these advantages.
But a function using rte_lib_has_some_feature() cannot access non-

existing fields:

Quoted 1 line

https://godbolt.org/z/s3nKx45Ms

Quoted 6 lines

I missed that.

You can add these new struct updates in the slowpath area of rte_node. Above offsetof(struct rte_node, ctx)

Use RTE_NEXT_ABI, Get around off, ABI breakge issue.

Please review [v9], and I will submit a rebased version for DPDK 26.11.

[v9]: https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

Quoted 16 lines
Quoted 11 lines

So sometimes #ifdef is required in the code too.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
lib/graph/rte_graph_worker_common.h +0 -0
                alignas(RTE_CACHE_LINE_MIN_SIZE) struct

rte_node

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

*nodes[]; /**< Next nodes. */

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +0 -0
        };
 };
 
#12 lore raw
In reply to Jerin Jacob
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 4 lines
lib/graph/rte_graph_worker_common.h +4 -0
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls processing

resp. 0 or 1 objects. */

Quoted 1 line

+ uint64_t cycles; /**< Cycles spent

processing resp. 0 or 1 objects. */

Quoted 1 line

+ } usage_stats[2]; /**< Usage when this node

processed 0 or 1 objects. */

Quoted 1 line

+ uint64_t full_burst_calls; /**< Calls processing a

full burst of objects. */

Quoted 1 line

+ uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

+ uint64_t half_burst_calls; /**< Calls processing a

half burst of objects. */

Quoted 1 line

+ uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

Review

Quoted 2 lines
(quoted diff) +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

Can you consider one array for all cases?
also, instead of adding cacheline for this profiling data, can we share with line 1 that used solely for xstats?

#13 lore raw
Quoted 21 lines

From: saeed bishara [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 10.34

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

lib/graph/rte_graph_worker_common.h struct __rte_cache_aligned rte_node {

Quoted 4 lines
lib/graph/rte_graph_worker_common.h +4 -0
+               /** Fast path area cache line 3. */
+#ifdef RTE_GRAPH_PROFILE
+               struct {
+                       uint64_t calls;     /**< Calls

processing

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

resp. 0 or 1 objects. */

Quoted 1 line

+ uint64_t cycles; /**< Cycles spent

processing resp. 0 or 1 objects. */

Quoted 1 line

+ } usage_stats[2]; /**< Usage when this

node

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

processed 0 or 1 objects. */

Quoted 1 line

+ uint64_t full_burst_calls; /**< Calls

processing a

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

full burst of objects. */

Quoted 1 line

+ uint64_t full_burst_cycles; /**< Cycles spent

processing a full burst of objects. */

Quoted 1 line

+ uint64_t half_burst_calls; /**< Calls

processing a

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

half burst of objects. */

Quoted 1 line

+ uint64_t half_burst_cycles; /**< Cycles spent

processing a half burst of objects. */

Review

Quoted 2 lines
(quoted diff) +2 -0
+               /** Fast path area cache line 4. */
+#endif

Is it an ABI breakage?

Can you consider one array for all cases?

Ack.

Quoted 2 lines

also, instead of adding cacheline for this profiling data, can we share with line 1 that used solely for xstats?

This profiling data is 4 indexes * 2 values * 8-byte fields, so one cache line in itself.

#14 lore raw
Quoted 4 lines
Quoted 2 lines

also, instead of adding cacheline for this profiling data, can we share with line 1 that used solely for xstats?

This profiling data is 4 indexes * 2 values * 8-byte fields, so one cache line in itself.

make sense.
btw, the default value of RTE_GRAPH_BURST_SIZE is 256, I suspect that real applications will enforce smaller burst when pulling from input devices (e.g. 32). Do you expect such cases to change RTE_GRAPH_BURST_SIZE?

#15 lore raw

+Pavan Nikhilesh, +Stephen Hemminger, +Wathsala Vithanage, +Bruce Richardson, +Thomas Monjalon

Quoted 6 lines

From: saeed bishara [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 16.11

Quoted 3 lines
Quoted 2 lines

also, instead of adding cacheline for this profiling data, can we share with line 1 that used solely for xstats?

Quoted 7 lines
Quoted 1 line

This profiling data is 4 indexes * 2 values * 8-byte fields, so one

cache line in itself.
make sense.
btw, the default value of RTE_GRAPH_BURST_SIZE is 256, I suspect that real applications will enforce smaller burst when pulling from input devices (e.g. 32). Do you expect such cases to change RTE_GRAPH_BURST_SIZE?

Excellent question! I don't know.
They should. E.g. an application optimized for latency should certainly not process bursts of 256 objects.

IMO, the root problem is the lack of a unified burst size across DPDK, which causes every library to be designed with its own optimal burst size. E.g. the Mbuf library uses 64 (for rte_pktmbuf_free_bulk()), and the Graph library uses 256.

There has been an attempt at introducing a unified burst size [1] for DPDK, but it met a lot of resistance, so it still needs to be refined before we can reach a conclusion.
The drivers supposedly can report an "optimal" burst size at run-time, which the application can then use. But the application is unable to configure its internal burst sizes if one driver reports 64 and another reports 32. I'm strongly in favor of a build time constant, used across DPDK. The default value should work reasonably well across drivers and libraries.
And if an application wants to optimize for performance (either throughput or latency), the developer should experiment to find the optimal value.
Furthermore, designing for a build time constant max burst size throughout DPDK might provide performance benefits in itself, as the compiler can optimize for this.

[1]: https://inbox.dpdk.org/dev/[email protected]/

Now, back to your question...
As a workaround, I can sample Graph node performance data for 32 objects, instead of sampling for RTE_GRAPH_BURST_SIZE / 2.

#16 lore raw
Quoted 29 lines · Morten Brørup

+Pavan Nikhilesh, +Stephen Hemminger, +Wathsala Vithanage, +Bruce Richardson, +Thomas Monjalon

Quoted 6 lines

From: saeed bishara [mailto:[email protected]]
Sent: Tuesday, 23 June 2026 16.11

Quoted 3 lines
Quoted 2 lines

also, instead of adding cacheline for this profiling data, can we share with line 1 that used solely for xstats?

Quoted 7 lines
Quoted 1 line

This profiling data is 4 indexes * 2 values * 8-byte fields, so one

cache line in itself.
make sense.
btw, the default value of RTE_GRAPH_BURST_SIZE is 256, I suspect that real applications will enforce smaller burst when pulling from input devices (e.g. 32). Do you expect such cases to change RTE_GRAPH_BURST_SIZE?

Excellent question! I don't know.
They should. E.g. an application optimized for latency should certainly not process bursts of 256 objects.

IMO, the root problem is the lack of a unified burst size across DPDK, which causes every library to be designed with its own optimal burst size. E.g. the Mbuf library uses 64 (for rte_pktmbuf_free_bulk()), and the Graph library uses 256.

There has been an attempt at introducing a unified burst size [1] for DPDK, but it met a lot of resistance, so it still needs to be refined before we can reach a conclusion.
The drivers supposedly can report an "optimal" burst size at run-time, which the application can then use. But the application is unable to configure its internal burst sizes if one driver reports 64 and another reports 32. I'm strongly in favor of a build time constant, used across DPDK. The default value should work reasonably well across drivers and libraries.
And if an application wants to optimize for performance (either throughput or latency), the developer should experiment to find the optimal value.
Furthermore, designing for a build time constant max burst size throughout DPDK might provide performance benefits in itself, as the compiler can optimize for this.

Quoted 4 lines

[1]: https://inbox.dpdk.org/dev/[email protected]/

Now, back to your question...
As a workaround, I can sample Graph node performance data for 32 objects, instead of sampling for RTE_GRAPH_BURST_SIZE / 2.

I see, so there is no simple static parameter here. what about tracking max burst, then report the calls/cycles for that case, the user will also find what was that max burst, and how often it occured.

saeed

#17 lore raw

PATCH v6 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of RTE_GRAPH_BURST_SIZE/2. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                 |  1 +
 doc/guides/prog_guide/graph_lib.rst |  1 +
 lib/graph/graph_debug.c             | 47 +++++++++++++++++++++++++++++
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 29 ++++++++++++++++--
 5 files changed, 77 insertions(+), 3 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..f5eff3d6dc 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+// RTE_GRAPH_PROFILE is not set
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +1 -0
index 8dd49c19d2..bc36042296 100644
@@ -49,6 +49,7 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +47 -0

53 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +26 -3
index 4ab53a533e..bac0fc534e 100644
@@ -121,6 +121,14 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/** Usage when this node processed 0, 1, 32 or a full burst of objects. */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +156,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == 32) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#18 lore raw

PATCH v7 1/1 graph: add optional profiling stats

In reply to Morten Brørup

graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                 |  1 +
 doc/guides/prog_guide/graph_lib.rst |  1 +
 lib/graph/graph_debug.c             | 48 +++++++++++++++++++++++++++++
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 29 +++++++++++++++--
 5 files changed, 78 insertions(+), 3 deletions(-)
config/rte_config.h +1 -0
index 0447cdf2ad..1942c1b1ec 100644
@@ -106,6 +106,7 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +1 -0
index 8dd49c19d2..bc36042296 100644
@@ -49,6 +49,7 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +48 -0

54 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +26 -3
index 4ab53a533e..bac0fc534e 100644
@@ -121,6 +121,14 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/** Usage when this node processed 0, 1, 32 or a full burst of objects. */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +156,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == 32) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#19 lore raw

PATCH v8 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                 |  2 ++
 doc/guides/prog_guide/graph_lib.rst |  3 ++
 lib/graph/graph_debug.c             | 51 +++++++++++++++++++++++++++++
 lib/graph/node.c                    |  2 ++
 lib/graph/rte_graph_worker_common.h | 29 ++++++++++++++--
 5 files changed, 84 insertions(+), 3 deletions(-)
config/rte_config.h +2 -0
index 0447cdf2ad..7703a6325b 100644
@@ -106,6 +106,8 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SIZE 32
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +3 -0
index 8dd49c19d2..4311c37cc2 100644
@@ -49,6 +49,9 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SIZE`` config option to sample a specific
+  burst size.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
lib/graph/graph_debug.c +51 -0

57 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +26 -3
index 4ab53a533e..c40b63111f 100644
@@ -121,6 +121,14 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/** Usage when this node processed 0, 1, 32 or a full burst of objects. */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +156,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +207,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +216,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_PROFILE_BURST_SIZE) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#20 lore raw

PATCH v9 1/1 graph: add optional profiling stats

In reply to Morten Brørup

graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  2 ++
 doc/guides/prog_guide/graph_lib.rst    |  3 ++
 doc/guides/rel_notes/release_26_07.rst |  7 ++++
 lib/graph/graph_debug.c                | 50 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 ++
 lib/graph/rte_graph_worker_common.h    | 32 +++++++++++++++--
 6 files changed, 93 insertions(+), 3 deletions(-)
config/rte_config.h +2 -0
index 0447cdf2ad..7703a6325b 100644
@@ -106,6 +106,8 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SIZE 32
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +3 -0
index 8dd49c19d2..4311c37cc2 100644
@@ -49,6 +49,9 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SIZE`` config option to sample a specific
+  burst size.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_07.rst +7 -0
index 8b1bdada1a..cb7d48eeac 100644
@@ -83,6 +83,13 @@ New Features
   * The size of the ``struct rte_mempool_cache`` was kept
     for API/ABI compatibility purposes.
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h``. When enabled, tracks cycles
+  spent processing bursts of 0, 1, ``RTE_GRAPH_PROFILE_BURST_SIZE``,
+  and ``RTE_GRAPH_BURST_SIZE`` objects per node.
+
 * **Added RISC-V vector paths.**
 
   * Increased the default SIMD bitwidth to allow using the vector extension.
lib/graph/graph_debug.c +50 -0

56 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +29 -3
index 4ab53a533e..00e8f5859d 100644
@@ -121,6 +121,17 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/**
+	 * Usage when this node processed 0, 1, RTE_GRAPH_PROFILE_BURST_SIZE,
+	 * or RTE_GRAPH_BURST_SIZE objects.
+	 */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +159,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +210,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +219,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_PROFILE_BURST_SIZE) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 1 line
2.43.0
#21 lore raw

PING for review.

(And obviously, the release notes needs to be for 26.11, not 26.07.)

Quoted 278 lines

-----Original Message-----
From: Morten Brørup [mailto:[email protected]]
Sent: Friday, 3 July 2026 17.44

graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly
into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  2 ++
 doc/guides/prog_guide/graph_lib.rst    |  3 ++
 doc/guides/rel_notes/release_26_07.rst |  7 ++++
 lib/graph/graph_debug.c                | 50 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 ++
 lib/graph/rte_graph_worker_common.h    | 32 +++++++++++++++--
 6 files changed, 93 insertions(+), 3 deletions(-)
config/rte_config.h +2 -0
index 0447cdf2ad..7703a6325b 100644
@@ -106,6 +106,8 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SIZE 32
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +0 -0
index 8dd49c19d2..4311c37cc2 100644
@@ -49,6 +49,9 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256

burst
size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+ Set the ``RTE_GRAPH_PROFILE_BURST_SIZE`` config option to sample a specific
+ burst size.
- Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config
option)
if not needed.

doc/guides/rel_notes/release_26_07.rst +4 -0
index 8b1bdada1a..cb7d48eeac 100644
@@ -83,6 +83,13 @@ New Features
   * The size of the ``struct rte_mempool_cache`` was kept
     for API/ABI compatibility purposes.
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h``. When enabled, tracks

cycles

doc/guides/rel_notes/release_26_07.rst +3 -0
+  spent processing bursts of 0, 1, ``RTE_GRAPH_PROFILE_BURST_SIZE``,
+  and ``RTE_GRAPH_BURST_SIZE`` objects per node.
+
 * **Added RISC-V vector paths.**
 
   * Increased the default SIMD bitwidth to allow using the vector

extension.

lib/graph/graph_debug.c +5 -0
index e3b8cccdc1..b999fa4140 100644
@@ -93,6 +93,56 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g,
 bool all)
 				n->dispatch.total_sched_fail);
 		}
 		fprintf(f, "       total_calls=%" PRId64 "\n", n-
 >total_calls);
+		if (rte_graph_has_stats_feature())
+			fprintf(f, "       total_cycles=%" PRIu64 ", avg
 cycles/call=%.1f\n",
+					n->total_cycles,
+					n->total_calls == 0 ? 0.0 :
+					(double)n->total_cycles / (double)n-
Quoted 1 line

total_calls);

lib/graph/graph_debug.c +3 -0
+#ifdef RTE_GRAPH_PROFILE
+		static const uint16_t profile_sample_sizes[] = {
+				0, 1, RTE_GRAPH_PROFILE_BURST_SIZE,

RTE_GRAPH_BURST_SIZE};

lib/graph/graph_debug.c +1 -0
+		static_assert(RTE_DIM(profile_sample_sizes) == RTE_DIM(n-
Quoted 1 line

usage_stats),

lib/graph/graph_debug.c +5 -0
+				"usage_stats array size mismatch");
+		int64_t calls_other = n->total_calls;
+		int64_t cycles_other = n->total_cycles;
+		int64_t objs_other = n->total_objs;
+		for (int idx = 0; idx < RTE_DIM(n->usage_stats) + 1; idx++)

{

lib/graph/graph_debug.c +15 -0
+			uint64_t calls;
+			uint64_t cycles;
+			double objs_per_call;
+			if (idx < RTE_DIM(n->usage_stats)) {
+				uint16_t idx_objs = profile_sample_sizes[idx];
+				fprintf(f, "       objs[%u]\n", idx_objs);
+				calls = n->usage_stats[idx].calls;
+				cycles = n->usage_stats[idx].cycles;
+				objs_per_call = (double)idx_objs;
+				calls_other -= calls;
+				cycles_other -= cycles;
+				objs_other -= idx_objs * calls;
+			} else {
+				fprintf(f, "       objs[other]\n");
+				if (calls_other > 0 && cycles_other > 0 &&

objs_other > 0) {

lib/graph/graph_debug.c +3 -0
+					calls = calls_other;
+					cycles = cycles_other;
+					objs_per_call = (double)objs_other /

(double)calls_other;

lib/graph/graph_debug.c +1 -0
+					fprintf(f, "         avg

objs/call=%.1f\n", objs_per_call);

lib/graph/graph_debug.c +9 -0
+				} else {
+					calls = 0;
+					cycles = 0;
+					objs_per_call = 0.0;
+				}
+			}
+			fprintf(f, "         calls=%" PRIu64, calls);
+			if (calls != 0)
+				fprintf(f, ", cycles=%" PRIu64 ", avg

cycles/call=%.1f",

lib/graph/graph_debug.c +5 -0
+						cycles,
+						(double)cycles / (double)calls);
+			if (calls != 0 && objs_per_call != 0.0)
+				fprintf(f, ", avg cycles/obj=%.1f",
+						(double)cycles / (double)calls /

objs_per_call);

lib/graph/graph_debug.c +3 -0
+			fprintf(f, "\n");
+		}
+#endif
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +1 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct
 rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL

machine */

lib/graph/node.c +1 -0
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
lib/graph/rte_graph_worker_common.h +11 -0
index 4ab53a533e..00e8f5859d 100644
@@ -121,6 +121,17 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/**
+	 * Usage when this node processed 0, 1,
 RTE_GRAPH_PROFILE_BURST_SIZE,
+	 * or RTE_GRAPH_BURST_SIZE objects.
+	 */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
lib/graph/rte_graph_worker_common.h +2 -0
 		union {
@@ -148,8 +159,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct
 rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in
 64 bytes");
+#endif
 

/**
* @internal

lib/graph/rte_graph_worker_common.h +16 -3
@@ -197,7 +210,7 @@ void __rte_node_stream_alloc_size(struct rte_graph
 *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
@@ -206,11 +219,24 @@ __rte_node_process(struct rte_graph *graph,
 struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_PROFILE_BURST_SIZE) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);

}
--
2.43.0

#22 lore raw
In reply to Morten Brørup

Hey Morten,

I have some concerns with the "histogram" implementation. There are holes in the data. You will only capture specific batch sizes.

NB: did you notice we already have a burst size histogram exported in the grout metrics:

https://github.com/DPDK/grout/blob/v0.17.1/modules/infra/api/stats.c#L313-L336

Morten Brørup, Jul 03, 2026 at 17:43:

Quoted 216 lines

graph: add optional profiling stats

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  2 ++
 doc/guides/prog_guide/graph_lib.rst    |  3 ++
 doc/guides/rel_notes/release_26_07.rst |  7 ++++
 lib/graph/graph_debug.c                | 50 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 ++
 lib/graph/rte_graph_worker_common.h    | 32 +++++++++++++++--
 6 files changed, 93 insertions(+), 3 deletions(-)
config/rte_config.h +2 -0
index 0447cdf2ad..7703a6325b 100644
@@ -106,6 +106,8 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SIZE 32
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +3 -0
index 8dd49c19d2..4311c37cc2 100644
@@ -49,6 +49,9 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SIZE`` config option to sample a specific
+  burst size.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_07.rst +7 -0
index 8b1bdada1a..cb7d48eeac 100644
@@ -83,6 +83,13 @@ New Features
   * The size of the ``struct rte_mempool_cache`` was kept
     for API/ABI compatibility purposes.
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h``. When enabled, tracks cycles
+  spent processing bursts of 0, 1, ``RTE_GRAPH_PROFILE_BURST_SIZE``,
+  and ``RTE_GRAPH_BURST_SIZE`` objects per node.
+
 * **Added RISC-V vector paths.**
 
   * Increased the default SIMD bitwidth to allow using the vector extension.
lib/graph/graph_debug.c +50 -0
index e3b8cccdc1..b999fa4140 100644
@@ -93,6 +93,56 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 				n->dispatch.total_sched_fail);
 		}
 		fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+		if (rte_graph_has_stats_feature())
+			fprintf(f, "       total_cycles=%" PRIu64 ", avg cycles/call=%.1f\n",
+					n->total_cycles,
+					n->total_calls == 0 ? 0.0 :
+					(double)n->total_cycles / (double)n->total_calls);
+#ifdef RTE_GRAPH_PROFILE
+		static const uint16_t profile_sample_sizes[] = {
+				0, 1, RTE_GRAPH_PROFILE_BURST_SIZE, RTE_GRAPH_BURST_SIZE};
+		static_assert(RTE_DIM(profile_sample_sizes) == RTE_DIM(n->usage_stats),
+				"usage_stats array size mismatch");
+		int64_t calls_other = n->total_calls;
+		int64_t cycles_other = n->total_cycles;
+		int64_t objs_other = n->total_objs;
+		for (int idx = 0; idx < RTE_DIM(n->usage_stats) + 1; idx++) {
+			uint64_t calls;
+			uint64_t cycles;
+			double objs_per_call;
+			if (idx < RTE_DIM(n->usage_stats)) {
+				uint16_t idx_objs = profile_sample_sizes[idx];
+				fprintf(f, "       objs[%u]\n", idx_objs);
+				calls = n->usage_stats[idx].calls;
+				cycles = n->usage_stats[idx].cycles;
+				objs_per_call = (double)idx_objs;
+				calls_other -= calls;
+				cycles_other -= cycles;
+				objs_other -= idx_objs * calls;
+			} else {
+				fprintf(f, "       objs[other]\n");
+				if (calls_other > 0 && cycles_other > 0 && objs_other > 0) {
+					calls = calls_other;
+					cycles = cycles_other;
+					objs_per_call = (double)objs_other / (double)calls_other;
+					fprintf(f, "         avg objs/call=%.1f\n", objs_per_call);
+				} else {
+					calls = 0;
+					cycles = 0;
+					objs_per_call = 0.0;
+				}
+			}
+			fprintf(f, "         calls=%" PRIu64, calls);
+			if (calls != 0)
+				fprintf(f, ", cycles=%" PRIu64 ", avg cycles/call=%.1f",
+						cycles,
+						(double)cycles / (double)calls);
+			if (calls != 0 && objs_per_call != 0.0)
+				fprintf(f, ", avg cycles/obj=%.1f",
+						(double)cycles / (double)calls / objs_per_call);
+			fprintf(f, "\n");
+		}
+#endif
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +14 -1
index 4ab53a533e..00e8f5859d 100644
@@ -121,6 +121,17 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/**
+	 * Usage when this node processed 0, 1, RTE_GRAPH_PROFILE_BURST_SIZE,
+	 * or RTE_GRAPH_BURST_SIZE objects.
+	 */
+	struct __rte_cache_aligned {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats[4];
+	/** Fast path area cache line 3. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +159,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +210,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 

lib/graph/rte_graph_worker_common.h __rte_node_process(struct rte_graph *graph, struct rte_node *node) · line 222

Quoted 5 lines
lib/graph/rte_graph_worker_common.h +1 -1
@@ -206,11 +219,24 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();

I presume this works but it feels confusing taking a "negative" value of an unsigned integer.

Quoted 6 lines
lib/graph/rte_graph_worker_common.h +2 -1
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;

lib/graph/rte_graph_worker_common.h __rte_node_process(struct rte_graph *graph, struct rte_node *node) · line 237

Quoted 10 lines
lib/graph/rte_graph_worker_common.h +10 -0
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_PROFILE_BURST_SIZE) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;

If you want a reliable histogram, you would need to change these tests to the following:

		id (rc >= RTE_GRAPH_BURST_SIZE) {
			node->usage_stats[3].calls++;
			node->usage_stats[3].cycles += cycles;
		} else if (rc >= RTE_GRAPH_PROFILE_BURST_SIZE) {
			node->usage_stats[2].calls++;
			node->usage_stats[2].cycles += cycles;
		} else if (rc != 0) {
			node->usage_stats[1].calls++;
			node->usage_stats[1].cycles += cycles;
		} else {
			node->usage_stats[0].calls++;
			node->usage_stats[0].cycles += cycles;
		}

Otherwise, you will miss lots of odd-sized batches in your histogram data.

Quoted 5 lines
lib/graph/rte_graph_worker_common.h +2 -0
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
Signature · 3 lines
Robin

# Not a flying toy.
#23 lore raw
Quoted 5 lines

From: Robin Jarry [mailto:[email protected]]
Sent: Saturday, 22 August 2026 11.53

Hey Morten,

Quoted 8 lines

I have some concerns with the "histogram" implementation. There are holes in the data. You will only capture specific batch sizes.

NB: did you notice we already have a burst size histogram exported in the grout metrics:

https://github.com/DPDK/grout/blob/v0.17.1/modules/infra/api/stats.c#L3
13-L336

Thanks for the pointer.
The existing histogram only covers packet burst size.
I want to capture performance data for development (optimization) purposes.

I'll take a look at it, to see if something similar could be relevant for the data I'm aiming to collect.

Quoted 2 lines

Morten Brørup, Jul 03, 2026 at 17:43:

[...]

Quoted 6 lines

lib/graph/rte_graph_worker_common.h __rte_node_process(struct rte_graph *graph, struct rte_node *node) · line 222

Quoted 3 lines
lib/graph/rte_graph_worker_common.h +1 -1
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = -rte_rdtsc();

I presume this works but it feels confusing taking a "negative" value of an unsigned integer.

Maybe this is more readable:
cycles = rte_rdtsc();
rc = node->process(graph, node, objs, node->idx);
cycles = rte_rdtsc() - cycles;

Quoted 35 lines
Quoted 7 lines
lib/graph/rte_graph_worker_common.h +2 -1
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles += rte_rdtsc();
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;

lib/graph/rte_graph_worker_common.h __rte_node_process(struct rte_graph *graph, struct rte_node *node) · line 237

Quoted 10 lines
lib/graph/rte_graph_worker_common.h +10 -0
+#ifdef RTE_GRAPH_PROFILE
+		if (rc <= 1) {
+			node->usage_stats[rc].calls++;
+			node->usage_stats[rc].cycles += cycles;
+		} else if (rc == RTE_GRAPH_PROFILE_BURST_SIZE) {
+			node->usage_stats[2].calls++;
+			node->usage_stats[2].cycles += cycles;
+		} else if (rc == RTE_GRAPH_BURST_SIZE) {
+			node->usage_stats[3].calls++;
+			node->usage_stats[3].cycles += cycles;

If you want a reliable histogram, you would need to change these tests to the following:

		id (rc >= RTE_GRAPH_BURST_SIZE) {
			node->usage_stats[3].calls++;
			node->usage_stats[3].cycles += cycles;
		} else if (rc >= RTE_GRAPH_PROFILE_BURST_SIZE) {
			node->usage_stats[2].calls++;
			node->usage_stats[2].cycles += cycles;
		} else if (rc != 0) {
			node->usage_stats[1].calls++;
			node->usage_stats[1].cycles += cycles;
		} else {
			node->usage_stats[0].calls++;
			node->usage_stats[0].cycles += cycles;
		}
Quoted 2 lines

Otherwise, you will miss lots of odd-sized batches in your histogram data.

Correct.
However, I only need a few representative snapshots to help identify what to optimize. Zero and one object processed are quite frequently, so I want to know how frequent they occur. BTW, the cycles/object for processing one object is substantially higher than when processing a burst.

For bursts, I want to be able to calculate the cycles/object. I also want to be able to see how frequent they occur.

I wanted the data to stay within one cache line, so I compromised.
Since I don't need to stay within one cache line, I can improve it with better coverage.

Quoted 13 lines

lib/graph/rte_graph_worker_common.h __rte_node_process(struct rte_graph *graph, struct rte_node *node) · line 242

Quoted 7 lines
lib/graph/rte_graph_worker_common.h +2 -0
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}

--
Robin

# Not a flying toy.

#24 lore raw

PATCH v10 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  4 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 51 ++++++++++++++++++--
 6 files changed, 134 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +4 -0
index 1c2cd1ef31..03caaaad7e 100644
@@ -49,6 +49,10 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size intervals.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..b4c9739262 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h``. When enabled, tracks cycles
+  spent processing various burst size intervals per node.
+  The interval edges are build-time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +48 -3

80 lines not on this page · raw message

Signature · 1 line
2.43.0
#25 lore raw

PATCH v11 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  4 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 51 ++++++++++++++++++--
 6 files changed, 134 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +4 -0
index 1c2cd1ef31..03caaaad7e 100644
@@ -49,6 +49,10 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size intervals.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..b4c9739262 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h``. When enabled, tracks cycles
+  spent processing various burst size intervals per node.
+  The interval edges are build-time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +48 -3

80 lines not on this page · raw message

Signature · 1 line
2.43.0
#26 lore raw

PATCH v12 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  4 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 51 ++++++++++++++++++--
 6 files changed, 134 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +4 -0
index 1c2cd1ef31..03caaaad7e 100644
@@ -49,6 +49,10 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size intervals.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..5403f913b4 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size intervals per node.
+  The interval edges are build-time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +48 -3

80 lines not on this page · raw message

Signature · 1 line
2.43.0
#27 lore raw

PATCH v13 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  4 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 69 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 58 ++++++++++++++++++++--
 6 files changed, 143 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +4 -0
index 1c2cd1ef31..03caaaad7e 100644
@@ -49,6 +49,10 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details.
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size intervals.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..5403f913b4 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build-time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size intervals per node.
+  The interval edges are build-time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +69 -0

87 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +55 -3

87 lines not on this page · raw message

Signature · 1 line
2.43.0
#28 lore raw

PATCH v14 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 58 ++++++++++++++++++++--
 6 files changed, 142 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +5 -0
index 1c2cd1ef31..76349d0fe0 100644
@@ -49,6 +49,11 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details
+  (disabled by default).
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size intervals.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..8104c17e4a 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size intervals per node.
+  The interval edges are build time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +55 -3

87 lines not on this page · raw message

Signature · 1 line
2.43.0
#29 lore raw

PATCH v15 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v15:
* Used the term "ranges" instead of "intervals". (AI)
* Described the last range as "%u+" instead of "[%u;[". Correct would be "[%u;+∞[", but prefer ASCII here.
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 58 ++++++++++++++++++++--
 6 files changed, 142 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +5 -0
index 1c2cd1ef31..aa5faf4e82 100644
@@ -49,6 +49,11 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details
+  (disabled by default).
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size ranges.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..2c822b6eee 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size ranges per node.
+  The edges of the ranges are build time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +55 -3

87 lines not on this page · raw message

Signature · 1 line
2.43.0
#30 lore raw

PATCH v16 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v16:
* Refactored range bucketing for clarity and performance. (AI) v15:
* Used the term "ranges" instead of "intervals". (AI)
* Described the last range as "%u+" instead of "[%u;[". Correct would be "[%u;+∞[", but prefer ASCII here.
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 57 ++++++++++++++++++++--
 6 files changed, 141 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +5 -0
index 1c2cd1ef31..aa5faf4e82 100644
@@ -49,6 +49,11 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details
+  (disabled by default).
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size ranges.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..2c822b6eee 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size ranges per node.
+  The edges of the ranges are build time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +54 -3

86 lines not on this page · raw message

Signature · 1 line
2.43.0
#31 lore raw

PATCH v17 1/1 graph: add optional profiling stats

In reply to Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v17:
* Snapshot cycles as positive number, and subtract after processing. (Robin Jarry)
v16:
* Refactored range bucketing for clarity and performance. (AI) v15:
* Used the term "ranges" instead of "intervals". (AI)
* Described the last range as "%u+" instead of "[%u;[". Correct would be "[%u;+∞[", but prefer ASCII here.
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 57 ++++++++++++++++++++--
 6 files changed, 141 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +5 -0
index 1c2cd1ef31..aa5faf4e82 100644
@@ -49,6 +49,11 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details
+  (disabled by default).
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size ranges.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..2c822b6eee 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size ranges per node.
+  The edges of the ranges are build time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0

85 lines not on this page · raw message

lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +54 -3

86 lines not on this page · raw message

Signature · 1 line
2.43.0
Acked-by on v17 1/1
#32 lore raw
Quoted 5 lines · Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---

Quoted 325 lines

v17:
* Snapshot cycles as positive number, and subtract after processing. (Robin Jarry)
v16:
* Refactored range bucketing for clarity and performance. (AI) v15:
* Used the term "ranges" instead of "intervals". (AI)
* Described the last range as "%u+" instead of "[%u;[". Correct would be "[%u;+∞[", but prefer ASCII here.
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 57 ++++++++++++++++++++--
 6 files changed, 141 insertions(+), 3 deletions(-)
config/rte_config.h +4 -0
index 0447cdf2ad..6beee01b09 100644
@@ -106,6 +106,10 @@
 /* rte_graph defines */
 #define RTE_GRAPH_BURST_SIZE 256
 #define RTE_LIBRTE_GRAPH_STATS 1
+/* RTE_GRAPH_PROFILE is not set */
+#define RTE_GRAPH_PROFILE_BURST_SMALL 8
+#define RTE_GRAPH_PROFILE_BURST_MEDIUM 32
+#define RTE_GRAPH_PROFILE_BURST_LARGE RTE_GRAPH_BURST_SIZE
 
 /****** driver defines ********/
 
doc/guides/prog_guide/graph_lib.rst +5 -0
index 1c2cd1ef31..aa5faf4e82 100644
@@ -49,6 +49,11 @@ Performance tuning parameters
   RTE_GRAPH_BURST_SIZE config option.
   The testing shows, on x86 and arm64 servers, The sweet spot is 256 burst
   size. While on arm64 embedded SoCs, it is either 64 or 128.
+- Enable the ``RTE_GRAPH_PROFILE`` config option for more profiling details
+  (disabled by default).
+  Set the ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``,
+  and ``RTE_GRAPH_PROFILE_BURST_LARGE`` config options to sample specific
+  burst size ranges.
 - Disable node statistics (using ``RTE_LIBRTE_GRAPH_STATS`` config option)
   if not needed.
 
doc/guides/rel_notes/release_26_11.rst +9 -0
index c8cc86295d..2c822b6eee 100644
@@ -55,6 +55,15 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added optional graph profiling statistics.**
+
+  Added build time configurable graph node profiling statistics via
+  ``RTE_GRAPH_PROFILE`` in ``rte_config.h`` (disabled by default). When enabled,
+  tracks cycles spent processing various burst size ranges per node.
+  The edges of the ranges are build time configurable via
+  ``RTE_GRAPH_PROFILE_BURST_SMALL``, ``RTE_GRAPH_PROFILE_BURST_MEDIUM``, and
+  ``RTE_GRAPH_PROFILE_BURST_LARGE`` in ``rte_config.h``.
+
 
 Removed Items
 -------------
lib/graph/graph_debug.c +67 -0
index e3b8cccdc1..a2aef9918f 100644
@@ -60,6 +60,7 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 	rte_graph_off_t off;
 	struct rte_node *n;
 	rte_edge_t i;
+	uint64_t all_total_cycles = 0;
 
 	fprintf(f, "graph <%s> @ %p\n", g->name, g);
 	fprintf(f, "  id=%" PRIu32 "\n", g->id);
@@ -72,6 +73,12 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 	fprintf(f, "  nodes_start=0x%" PRIx32 "\n", g->nodes_start);
 	fprintf(f, "  cir_start=%p\n", g->cir_start);
 
+	rte_graph_foreach_node(count, off, g, n) {
+		if (!all && n->idx == 0)
+			continue;
+		all_total_cycles += n->total_cycles;
+	}
+
 	rte_graph_foreach_node(count, off, g, n) {
 		if (!all && n->idx == 0)
 			continue;
@@ -93,6 +100,66 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all)
 				n->dispatch.total_sched_fail);
 		}
 		fprintf(f, "       total_calls=%" PRId64 "\n", n->total_calls);
+		if (rte_graph_has_stats_feature())
+			fprintf(f, "       total_cycles=%" PRIu64 " (%.1f%% of all nodes), avg cycles/call=%.1f\n",
+				n->total_cycles,
+				all_total_cycles == 0 ? 0.0 :
+				(double)n->total_cycles / (double)all_total_cycles * 100.0,
+				n->total_calls == 0 ? 0.0 :
+				(double)n->total_cycles / (double)n->total_calls);
+
+#ifdef RTE_GRAPH_PROFILE
+		static const uint16_t sample_sizes[] = {
+				0, 1, 2, RTE_GRAPH_PROFILE_BURST_SMALL,
+				RTE_GRAPH_PROFILE_BURST_MEDIUM, RTE_GRAPH_PROFILE_BURST_LARGE};
+		static_assert(RTE_DIM(sample_sizes) == 2U + RTE_DIM(n->usage_stats),
+				"usage_stats array size mismatch");
+		for (unsigned int idx = 0; idx < RTE_DIM(sample_sizes); idx++) {
+			uint64_t calls;
+			uint64_t cycles;
+			double objs_per_call;
+			if (idx < 2) {
+				calls = n->usage_stats_01[idx].calls;
+				cycles = n->usage_stats_01[idx].cycles;
+				objs_per_call = (double)idx;
+				fprintf(f, "       for %u objs/call\n",
+					idx);
+			} else {
+				calls = n->usage_stats[idx - 2].calls;
+				cycles = n->usage_stats[idx - 2].cycles;
+				objs_per_call = calls == 0 ? 0.0 :
+						(double)n->usage_stats[idx - 2].objs /
+						(double)calls;
+				if (idx < RTE_DIM(sample_sizes) - 1)
+					fprintf(f, "       for [%u;%u[ objs/call",
+						sample_sizes[idx], sample_sizes[idx + 1]);
+				else
+					fprintf(f, "       for %u+ objs/call",
+						sample_sizes[idx]);
+				if (calls != 0)
+					fprintf(f, ", avg %.1f objs/call\n",
+						objs_per_call);
+				fprintf(f, "\n");
+			}
+			fprintf(f, "         calls=%" PRIu64,
+				calls);
+			if (calls != 0) {
+				fprintf(f, " (%.1f%% of this node)\n",
+					n->total_calls == 0 ? 0.0 :
+					(double)calls / (double)n->total_calls * 100.0);
+				fprintf(f, "         cycles=%" PRIu64 " (%.1f%% of this node), avg cycles/call=%.1f",
+					cycles,
+					n->total_cycles == 0 ? 0.0 :
+					(double)cycles / (double)n->total_cycles * 100.0,
+					(double)cycles / (double)calls);
+				if (objs_per_call != 0.0)
+					fprintf(f, ", avg cycles/obj=%.1f",
+						(double)cycles / (double)calls / objs_per_call);
+			}
+			fprintf(f, "\n");
+		}
+#endif /* RTE_GRAPH_PROFILE */
+
 		for (i = 0; i < n->nb_edges; i++)
 			fprintf(f, "          edge[%d] <%s>\n", i,
 				n->nodes[i]->name);
lib/graph/node.c +2 -0
index 1fce3e6632..19b38881ae 100644
@@ -110,10 +110,12 @@ __rte_node_register(const struct rte_node_register *reg)
 	rte_edge_t i;
 	size_t sz;
 
+#ifndef RTE_GRAPH_PROFILE
 	/* Limit Node specific metadata to one cacheline on 64B CL machine */
 	RTE_BUILD_BUG_ON((offsetof(struct rte_node, nodes) -
 			  offsetof(struct rte_node, ctx)) !=
 			 RTE_CACHE_LINE_MIN_SIZE);
+#endif
 
 	graph_spinlock_lock();
 
lib/graph/rte_graph_worker_common.h +54 -4
index 4ab53a533e..89c1f3dbf9 100644
@@ -121,6 +121,27 @@ struct __rte_cache_aligned rte_node {
 	rte_graph_off_t xstat_off; /**< Offset to xstat counters. */
 
 	/** Fast path area cache line 2. */
+#ifdef RTE_GRAPH_PROFILE
+	/** Usage when this node processed 0 or 1 objects. */
+	alignas(RTE_CACHE_LINE_MIN_SIZE)
+	struct {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+	} usage_stats_01[2];
+	/**
+	 * Usage when this node processed N objects:
+	 * - index 0 (micro): 2 <= N < RTE_GRAPH_PROFILE_BURST_SMALL
+	 * - index 1 (small): RTE_GRAPH_PROFILE_BURST_SMALL <= N < RTE_GRAPH_PROFILE_BURST_MEDIUM
+	 * - index 2 (medium): RTE_GRAPH_PROFILE_BURST_MEDIUM <= N < RTE_GRAPH_PROFILE_BURST_LARGE
+	 * - index 3 (large): RTE_GRAPH_PROFILE_BURST_LARGE <= N
+	 */
+	struct {
+		uint64_t calls;     /**< Calls done. */
+		uint64_t cycles;    /**< Cycles spent. */
+		uint64_t objs;      /**< Objects processed. */
+	} usage_stats[4];
+	/** Fast path area cache line 4. */
+#endif
 	__extension__ struct __rte_cache_aligned {
 #define RTE_NODE_CTX_SZ 16
 		union {
@@ -148,8 +169,10 @@ struct __rte_cache_aligned rte_node {
 	};
 };
 
+#ifndef RTE_GRAPH_PROFILE
 static_assert(offsetof(struct rte_node, nodes) - offsetof(struct rte_node, ctx)
 	== RTE_CACHE_LINE_MIN_SIZE, "rte_node fast path area must fit in 64 bytes");
+#endif
 
 /**
  * @internal
@@ -197,7 +220,7 @@ void __rte_node_stream_alloc_size(struct rte_graph *graph,
 static __rte_always_inline void
 __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 {
-	uint64_t start;
+	uint64_t cycles;
 	uint16_t rc;
 	void **objs;
 
@@ -206,11 +229,39 @@ __rte_node_process(struct rte_graph *graph, struct rte_node *node)
 	rte_prefetch0(objs);
 
 	if (rte_graph_has_stats_feature()) {
-		start = rte_rdtsc();
+		cycles = rte_rdtsc();
 		rc = node->process(graph, node, objs, node->idx);
-		node->total_cycles += rte_rdtsc() - start;
+		cycles = rte_rdtsc() - cycles;
+		node->total_cycles += cycles;
 		node->total_calls++;
 		node->total_objs += rc;
+#ifdef RTE_GRAPH_PROFILE
+		static_assert(RTE_GRAPH_PROFILE_BURST_SMALL >= 2,
+			"BURST_SMALL must be >= 2");
+		static_assert(RTE_GRAPH_PROFILE_BURST_SMALL < RTE_GRAPH_PROFILE_BURST_MEDIUM,
+			"BURST_SMALL must be < BURST_MEDIUM");
+		static_assert(RTE_GRAPH_PROFILE_BURST_MEDIUM < RTE_GRAPH_PROFILE_BURST_LARGE,
+			"BURST_MEDIUM must be < BURST_LARGE");
+		if (rc < 2) {
+			node->usage_stats_01[rc].calls++;
+			node->usage_stats_01[rc].cycles += cycles;
+		} else {
+			unsigned int index;
+
+			if (rc >= RTE_GRAPH_PROFILE_BURST_LARGE)
+				index = 3;
+			else if (rc >= RTE_GRAPH_PROFILE_BURST_MEDIUM)
+				index = 2;
+			else if (rc >= RTE_GRAPH_PROFILE_BURST_SMALL)
+				index = 1;
+			else
+				index = 0;
+
+			node->usage_stats[index].calls++;
+			node->usage_stats[index].cycles += cycles;
+			node->usage_stats[index].objs += rc;
+		}
+#endif
 	} else {
 		node->process(graph, node, objs, node->idx);
 	}
--

2.43.0

Acked-by Jerin Jacob Applied
#33 lore raw
Quoted 5 lines
Quoted 4 lines

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

Applied, thanks.

I would prefer it is easier to enable,
but I understand the performance is important?
The idea would be to avoid using rte_config.h.

Acked-by on v17 1/1
#34 lore raw
In reply to Morten Brørup
Quoted 66 lines · Morten Brørup

Added graph node profiling stats, build time configurable by enabling RTE_GRAPH_PROFILE in rte_config.h.

---
v17:
* Snapshot cycles as positive number, and subtract after processing. (Robin Jarry)
v16:
* Refactored range bucketing for clarity and performance. (AI) v15:
* Used the term "ranges" instead of "intervals". (AI)
* Described the last range as "%u+" instead of "[%u;[". Correct would be "[%u;+∞[", but prefer ASCII here.
v14:
* Changed some minor details suggested by AI.
v13:
* Fixed cache alignment; array should be aligned, not struct.
* Changed some minor details suggested by AI.
v12:
* Multiply printed percent values by 100.0. (AI)
* Added to release note that this feature is disabled by default. (AI) v11:
* Fixed signedness comparison and copy-paste bug.
v10:
* Use intervals instead of point samples. (Robin Jarry)
* Do not double-indent printf continuations.
Follows existing coding style in the file, and
avoids a long line warning from checkpatch.
* Rebased.
Moved release note to 26.11 file.
v9:
* Fixed comment still mentioning 32 objects.
* Moved sample size array outside loop. (AI)
* Added release note. (AI)
v8:
* Added static const array as local variable, instead of indexing directly into const array. (AI)
This also eliminates the space required between "} [idx];" weirdness.
* Added build time configurable RTE_GRAPH_PROFILE_BURST_SIZE to replace the hardcoded burst size of 32. (AI)
v7:
* Use RTE_DIM() in histogram for loop.
* Added static_assert for histogram index values.
* Minor details to please checkpatch.
Although I disagree with requiring a space when indexing into a constant array "(const type []){values} [idx];",
I have changed the code to comply.
v6:
* Consolidate the four histogram entries into one array. (Saeed Bishara)
* Sample at 32 objs instead of a half burst. (Saeed Bishara)
* Moved stats to different location in rte_node structure. (Jerin)
* Minor details to please checkpatch.
v5:
* Added stats for a half burst and a full burst.
v4:
* Added documentation. (AI)
* Added more comments. (AI)
* Improved dump. (AI)
* Debug shows both cycles/call and cycles/obj.
v3:
* Debug shows cycles/obj instead of cycles/call.
* Fixed missing --in-reply-to.
v2:
* Fixed indentation.

Quoted 7 lines
---
 config/rte_config.h                    |  4 ++
 doc/guides/prog_guide/graph_lib.rst    |  5 ++
 doc/guides/rel_notes/release_26_11.rst |  9 ++++
 lib/graph/graph_debug.c                | 67 ++++++++++++++++++++++++++
 lib/graph/node.c                       |  2 +
 lib/graph/rte_graph_worker_common.h    | 57 ++++++++++++++++++++--