Morten Brørup, Dec 09, 2025 at 13:11:
>> My issue is that I would like the total_objs stat but without the
>> overhead of rte_rdtsc() being called twice for every node visit.
>
> I get that. My proposal provides that.

I didn't get that from your previous message:

Morten Brørup, Dec 09, 2025 at 12:13:
>>> Looking at patch 2/2, I disagree with the approach.
>>>
>>> RTE_LIBRTE_GRAPH_STATS should control all stats, incl. total_calls and 
>>> total_objs.
>>> Then, if enabled, the total_cycles stats can be controlled by 
>>> rte_graph_cycle_stats_enable().
>>>
>>> Your v1 series introduces unnecessary overhead for applications not caring 
>>> about total_calls/total_objs stats and thus built without 
>>> RTE_LIBRTE_GRAPH_STATS.

Where do you propose a new flag to determine whether total_calls and
total_objs are updated and total_cycles are not?

>> And also, I would like to be able to enable/disable these stats *at
>> runtime*.
>
> Why would you enable/disable total_calls/total_objs at runtime?

I don't want to disable/enable total_calls/total_objs. I want to
disable/enable total_cycles at runtime.

>> Having it behind a compile time constant makes it very not flexible.
>
> Agree, but instrumentation has a performance cost, and should be
> possible to disable at compile time.
>
>> I could have two booleans to control whether total_calls/total_objs are
>> updated *and* whether total_cycles are computed. But that seems a bit
>> overkill and it would mean two fields to check (two branches) instead
>> of
>> one per node.
>> 
>> Is it really that bad to update two uint64_t counters?
>
> The cost is unnecessary. It's instrumentation.

In that instance, I consider total_objs not to be "instrumentation" but
more like regular counters (e.g. ethdev stats, xstats, etc.). Unless
I am mistaken, there is no way to disable statistics for interfaces for
example.

For example, in grout, we use total_objs in the main loop to determine
if we can save power by willingly putting the CPU to sleep for very
short periods of time. If total_objs is no longer updated, grout cannot
save power.

total_cycles however, *is* instrumentation. It is only useful to
identify hotspots and debug issues. But it can be interesting to enable
it *at runtime* without recompiling.

Reply via email to