From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Jerin Jacob" <jerinjacobk@gmail.com>, <thomas@monjalon.net>,
<david.marchand@redhat.com>
Cc: <dev@dpdk.org>, "Jerin Jacob" <jerinj@marvell.com>,
"Kiran Kumar K" <kirankumark@marvell.com>,
"Nithin Dabilpuram" <ndabilpuram@marvell.com>,
"Zhirun Yan" <yanzhirun_163@163.com>
Subject: RE: [PATCH v5] graph: add optional profiling stats
Date: Tue, 23 Jun 2026 09:10:21 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65938@smartserver.smartshare.dk> (raw)
In-Reply-To: <CALBAE1OZDXfH1FoVLJ=vXVqr=9hYPgqeCzN8h278wN8FbU+XaQ@mail.gmail.com>
+Thomas Monjalon & +David Marchand, as intended by Jerin
> From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> Sent: Tuesday, 23 June 2026 08.57
>
> On Tue, Jun 23, 2026 at 12:15 PM Morten Brørup
> <mb@smartsharesystems.com> wrote:
> >
> > > From: Jerin Jacob [mailto:jerinjacobk@gmail.com]
> > > Sent: Tuesday, 23 June 2026 07.13
> > >
> > > On Mon, Jun 22, 2026 at 12:11 AM Morten Brørup
> > > <mb@smartsharesystems.com> wrote:
> > > >
> > > > Added graph node profiling stats, build time configurable by
> enabling
> > > > RTE_GRAPH_PROFILE in rte_config.h.
> > > >
> > > > Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> > >
> > > Please update app/test/test_graph.c to validate this featue.
> >
> > Ack.
> >
> > > > @@ -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);
> > > > }
> > > > - 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.
> >
> > Disagree, see below.
> >
> > >
> > > > + 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,
> > >
> > > >
> > > > diff --git a/lib/graph/rte_graph_worker_common.h
> > > b/lib/graph/rte_graph_worker_common.h
> > > > index 4ab53a533e..0d8039575d 100644
> > > > --- a/lib/graph/rte_graph_worker_common.h
> > > > +++ b/lib/graph/rte_graph_worker_common.h
> > > > @@ -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
> > >
> > > 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
>
>
> >
> > 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)
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.
>
>
>
> >
> > >
> > > > alignas(RTE_CACHE_LINE_MIN_SIZE) struct rte_node
> > > *nodes[]; /**< Next nodes. */
> > > > };
> > > > };
> > > >
next prev parent reply other threads:[~2026-06-23 7:10 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-19 20:20 [PATCH] graph: add optional profiling stats Morten Brørup
2026-06-19 20:56 ` [PATCH v3] " Morten Brørup
2026-06-21 17:55 ` [PATCH v4] " Morten Brørup
2026-06-21 18:41 ` [PATCH v5] " Morten Brørup
2026-06-23 5:13 ` Jerin Jacob
2026-06-23 6:45 ` Morten Brørup
2026-06-23 6:56 ` Jerin Jacob
2026-06-23 7:10 ` Morten Brørup [this message]
2026-06-23 9:08 ` Jerin Jacob
2026-08-10 6:28 ` Morten Brørup
2026-06-23 8:33 ` saeed bishara
2026-06-23 12:04 ` Morten Brørup
2026-06-23 14:10 ` saeed bishara
2026-06-24 7:59 ` Morten Brørup
2026-06-24 13:09 ` saeed bishara
2026-07-03 13:18 ` [PATCH v6] " Morten Brørup
2026-07-03 13:53 ` [PATCH v7] " Morten Brørup
2026-07-03 14:22 ` [PATCH v8] " Morten Brørup
2026-07-03 15:43 ` [PATCH v9] " Morten Brørup
2026-08-13 6:56 ` Morten Brørup
2026-08-22 9:52 ` Robin Jarry
2026-08-22 10:18 ` Morten Brørup
2026-08-23 9:25 ` [PATCH v10] " Morten Brørup
2026-08-23 10:40 ` [PATCH v11] " Morten Brørup
2026-08-23 10:57 ` [PATCH v12] " Morten Brørup
2026-08-23 11:57 ` [PATCH v13] " Morten Brørup
2026-08-23 12:52 ` [PATCH v14] " Morten Brørup
2026-08-23 13:42 ` [PATCH v15] " Morten Brørup
2026-08-23 14:25 ` [PATCH v16] " Morten Brørup
2026-08-23 15:01 ` [PATCH v17] " Morten Brørup
2026-08-24 11:15 ` kirankumark
2026-08-24 14:56 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=98CBD80474FA8B44BF855DF32C47DC35F65938@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=jerinjacobk@gmail.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=thomas@monjalon.net \
--cc=yanzhirun_163@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.