> -----Original Message----- > From: Stephen Hemminger [mailto:stephen at networkplumber.org] > Sent: Saturday, February 21, 2015 1:53 AM > To: Dumitrescu, Cristian > Cc: Thomas Monjalon; dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 4/7] rte_sched: don't clear statistics when > read > > On Fri, 20 Feb 2015 21:28:55 +0000 > "Dumitrescu, Cristian" <cristian.dumitrescu at intel.com> wrote: > > > Agree. > > Stephen, how about a run-time solution (I agree it would be much better, > why did I not consider this in the first place?) of adding a new bool > parameter > in struct rte_sched_port_params: clear_stats_on_reset? > > Both stats read function get the port handle (struct rte_sched_port *) as > parameter, so there should be no ripple effect to propagate this flag. > > Why not read_and_clear function if absolutely necessary.
I am not sure I understand what you mean. Are you suggesting different set of stats read functions, one that is read and clear, while the other one is read without clear? Personally, I think we should avoid proliferating the number of stats functions, I would keep a single set of stats read functions, which can clear the stats or not, depending on behaviour configured per rte_sched object at creation time. Basically, based on the value of configuration parameter struct rte_sched_params::clear_stats_on_reset, the stats read functions do clear the counters or not. In my opinion, this allows a clean init-time selection of the required behaviour, and it also provides backward compatibility. Any issues with this approach?